lang: prefer 'clear (snap) history' to 'scrub' (#721)
This commit is contained in:
@@ -457,37 +457,38 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
return 'OK'
|
return 'OK'
|
||||||
|
|
||||||
|
|
||||||
@app.route("/scrub/<string:uuid>", methods=['GET'])
|
@app.route("/clear_history/<string:uuid>", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def scrub_watch(uuid):
|
def clear_watch_history(uuid):
|
||||||
try:
|
try:
|
||||||
datastore.scrub_watch(uuid)
|
datastore.clear_watch_history(uuid)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
flash('Watch not found', 'error')
|
flash('Watch not found', 'error')
|
||||||
else:
|
else:
|
||||||
flash("Scrubbed watch {}".format(uuid))
|
flash("Cleared snapshot history for watch {}".format(uuid))
|
||||||
|
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
@app.route("/scrub", methods=['GET', 'POST'])
|
@app.route("/clear_history", methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def scrub_page():
|
def clear_all_history():
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
confirmtext = request.form.get('confirmtext')
|
confirmtext = request.form.get('confirmtext')
|
||||||
|
|
||||||
if confirmtext == 'scrub':
|
if confirmtext == 'clear':
|
||||||
changes_removed = 0
|
changes_removed = 0
|
||||||
for uuid in datastore.data['watching'].keys():
|
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:
|
else:
|
||||||
flash('Incorrect confirmation text.', 'error')
|
flash('Incorrect confirmation text.', 'error')
|
||||||
|
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
output = render_template("scrub.html")
|
output = render_template("clear_all_history.html")
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@@ -854,7 +855,7 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
uuid = list(datastore.data['watching'].keys()).pop()
|
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
|
# 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:
|
if datastore.data['watching'][uuid].history_n == 0:
|
||||||
flash("Preview unavailable - No fetch/check completed or triggers not reached", "error")
|
flash("Preview unavailable - No fetch/check completed or triggers not reached", "error")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def main():
|
|||||||
create_datastore_dir = False
|
create_datastore_dir = False
|
||||||
|
|
||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
# if opt == '--purge':
|
# if opt == '--clear-all-history':
|
||||||
# Remove history, the actual files you need to delete manually.
|
# Remove history, the actual files you need to delete manually.
|
||||||
# for uuid, watch in datastore.data['watching'].items():
|
# for uuid, watch in datastore.data['watching'].items():
|
||||||
# watch.update({'history': {}, 'last_checked': 0, 'last_changed': 0, 'previous_md5': None})
|
# watch.update({'history': {}, 'last_checked': 0, 'last_changed': 0, 'previous_md5': None})
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class ChangeDetectionStore:
|
|||||||
return self.data['watching'][uuid].get(val)
|
return self.data['watching'][uuid].get(val)
|
||||||
|
|
||||||
# Remove a watchs data but keep the entry (URL etc)
|
# Remove a watchs data but keep the entry (URL etc)
|
||||||
def scrub_watch(self, uuid):
|
def clear_watch_history(self, uuid):
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
self.__data['watching'][uuid].update(
|
self.__data['watching'][uuid].update(
|
||||||
|
|||||||
@@ -3,22 +3,22 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="edit-form">
|
<div class="edit-form">
|
||||||
<div class="box-wrap inner">
|
<div class="box-wrap inner">
|
||||||
<form class="pure-form pure-form-stacked" action="{{url_for('scrub_page')}}" method="POST">
|
<form class="pure-form pure-form-stacked" action="{{url_for('clear_all_history')}}" method="POST">
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
This will remove ALL version snapshots/data, but keep your list of URLs. <br/>
|
This will remove version history (snapshots) for ALL watches, but keep your list of URLs! <br/>
|
||||||
You may like to use the <strong>BACKUP</strong> link first.<br/>
|
You may like to use the <strong>BACKUP</strong> link first.<br/>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="confirmtext">Confirmation text</label>
|
<label for="confirmtext">Confirmation text</label>
|
||||||
<input type="text" id="confirmtext" required="" name="confirmtext" value="" size="10"/>
|
<input type="text" id="confirmtext" required="" name="confirmtext" value="" size="10"/>
|
||||||
<span class="pure-form-message-inline">Type in the word <strong>scrub</strong> to confirm that you understand!</span>
|
<span class="pure-form-message-inline">Type in the word <strong>clear</strong> to confirm that you understand.</span>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<button type="submit" class="pure-button pure-button-primary">Scrub!</button>
|
<button type="submit" class="pure-button pure-button-primary">Clear History!</button>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
@@ -275,8 +275,8 @@ Unavailable") }}
|
|||||||
|
|
||||||
<a href="{{url_for('form_delete', uuid=uuid)}}"
|
<a href="{{url_for('form_delete', uuid=uuid)}}"
|
||||||
class="pure-button button-small button-error ">Delete</a>
|
class="pure-button button-small button-error ">Delete</a>
|
||||||
<a href="{{url_for('scrub_watch', uuid=uuid)}}"
|
<a href="{{url_for('clear_watch_history', uuid=uuid)}}"
|
||||||
class="pure-button button-small button-error ">Scrub</a>
|
class="pure-button button-small button-error ">Clear History</a>
|
||||||
<a href="{{url_for('form_clone', uuid=uuid)}}"
|
<a href="{{url_for('form_clone', uuid=uuid)}}"
|
||||||
class="pure-button button-small ">Create Copy</a>
|
class="pure-button button-small ">Create Copy</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ nav
|
|||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
{{ render_button(form.save_button) }}
|
{{ render_button(form.save_button) }}
|
||||||
<a href="{{url_for('index')}}" class="pure-button button-small button-cancel">Back</a>
|
<a href="{{url_for('index')}}" class="pure-button button-small button-cancel">Back</a>
|
||||||
<a href="{{url_for('scrub_page')}}" class="pure-button button-small button-cancel">Delete History Snapshot Data</a>
|
<a href="{{url_for('clear_all_history')}}" class="pure-button button-small button-cancel">Clear Snapshot History</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user