From 7c12c47204673ed7d50dd41612a3e2166b9aa045 Mon Sep 17 00:00:00 2001 From: jtagcat Date: Sat, 25 Jun 2022 11:43:57 +0000 Subject: [PATCH] lang: prefer 'clear (snap) history' to 'scrub' (#721) --- changedetectionio/__init__.py | 25 ++++++++++--------- changedetectionio/changedetection.py | 2 +- changedetectionio/store.py | 2 +- .../{scrub.html => clear_all_history.html} | 8 +++--- changedetectionio/templates/edit.html | 4 +-- changedetectionio/templates/settings.html | 2 +- 6 files changed, 22 insertions(+), 21 deletions(-) rename changedetectionio/templates/{scrub.html => clear_all_history.html} (81%) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 18d9e71e..9b868685 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -457,37 +457,38 @@ def changedetection_app(config=None, datastore_o=None): return 'OK' - @app.route("/scrub/", methods=['GET']) + @app.route("/clear_history/", methods=['GET']) @login_required - def scrub_watch(uuid): + def clear_watch_history(uuid): try: - datastore.scrub_watch(uuid) + datastore.clear_watch_history(uuid) except KeyError: flash('Watch not found', 'error') else: - flash("Scrubbed watch {}".format(uuid)) + flash("Cleared snapshot history for watch {}".format(uuid)) return redirect(url_for('index')) - @app.route("/scrub", methods=['GET', 'POST']) + @app.route("/clear_history", methods=['GET', 'POST']) @login_required - def scrub_page(): + def clear_all_history(): if request.method == 'POST': confirmtext = request.form.get('confirmtext') - if confirmtext == 'scrub': + if confirmtext == 'clear': changes_removed = 0 for uuid in datastore.data['watching'].keys(): - datastore.scrub_watch(uuid) + datastore.clear_watch_history(uuid) + #TODO: KeyError not checked, as it is above - flash("Cleared all snapshot history") + flash("Cleared snapshot history for all watches") else: flash('Incorrect confirmation text.', 'error') return redirect(url_for('index')) - output = render_template("scrub.html") + output = render_template("clear_all_history.html") return output @@ -854,7 +855,7 @@ def changedetection_app(config=None, datastore_o=None): uuid = list(datastore.data['watching'].keys()).pop() # Normally you would never reach this, because the 'preview' button is not available when there's no history - # However they may try to scrub and reload the page + # However they may try to clear snapshots and reload the page if datastore.data['watching'][uuid].history_n == 0: flash("Preview unavailable - No fetch/check completed or triggers not reached", "error") return redirect(url_for('index')) @@ -1368,4 +1369,4 @@ def ticker_thread_check_time_launch_checks(): time.sleep(1) # Should be low so we can break this out in testing - app.config.exit.wait(1) \ No newline at end of file + app.config.exit.wait(1) diff --git a/changedetectionio/changedetection.py b/changedetectionio/changedetection.py index 6708e8e1..2adf5ffc 100755 --- a/changedetectionio/changedetection.py +++ b/changedetectionio/changedetection.py @@ -35,7 +35,7 @@ def main(): create_datastore_dir = False for opt, arg in opts: - # if opt == '--purge': + # if opt == '--clear-all-history': # Remove history, the actual files you need to delete manually. # for uuid, watch in datastore.data['watching'].items(): # watch.update({'history': {}, 'last_checked': 0, 'last_changed': 0, 'previous_md5': None}) diff --git a/changedetectionio/store.py b/changedetectionio/store.py index d506aa92..8eda5f14 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -250,7 +250,7 @@ class ChangeDetectionStore: return self.data['watching'][uuid].get(val) # Remove a watchs data but keep the entry (URL etc) - def scrub_watch(self, uuid): + def clear_watch_history(self, uuid): import pathlib self.__data['watching'][uuid].update( diff --git a/changedetectionio/templates/scrub.html b/changedetectionio/templates/clear_all_history.html similarity index 81% rename from changedetectionio/templates/scrub.html rename to changedetectionio/templates/clear_all_history.html index 5b9a15da..379b0b7c 100644 --- a/changedetectionio/templates/scrub.html +++ b/changedetectionio/templates/clear_all_history.html @@ -3,22 +3,22 @@ {% block content %}
-
+
- This will remove ALL version snapshots/data, but keep your list of URLs.
+ This will remove version history (snapshots) for ALL watches, but keep your list of URLs!
You may like to use the BACKUP link first.

- Type in the word scrub to confirm that you understand! + Type in the word clear to confirm that you understand.

- +

diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 6a72153c..f76ea7c1 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -275,8 +275,8 @@ Unavailable") }} Delete - Scrub + Clear History Create Copy
diff --git a/changedetectionio/templates/settings.html b/changedetectionio/templates/settings.html index 21929d9d..f653f642 100644 --- a/changedetectionio/templates/settings.html +++ b/changedetectionio/templates/settings.html @@ -173,7 +173,7 @@ nav
{{ render_button(form.save_button) }} Back - Delete History Snapshot Data + Clear Snapshot History