diff --git a/backend/backend.py b/backend/backend.py index 4a1873fc..d0a962a1 100644 --- a/backend/backend.py +++ b/backend/backend.py @@ -199,8 +199,6 @@ def import_page(): messages.append({'class': 'ok', 'message': "{} Imported, {} Skipped.".format(good, len(remaining_urls))}) - launch_checks() - output = render_template("import.html", messages=messages, remaining="\n".join(remaining_urls) @@ -314,7 +312,6 @@ def api_watch_add(): # @todo add_watch should throw a custom Exception for validation etc datastore.add_watch(url=request.form.get('url').strip(), tag=request.form.get('tag').strip()) messages.append({'class': 'ok', 'message': 'Watch added.'}) - launch_checks() return redirect(url_for('main_page')) @@ -332,20 +329,28 @@ def api_delete(): def api_watch_checknow(): global messages - uuid = request.args.get('uuid') - update_q.put(uuid) - tag = request.args.get('tag') - return redirect(url_for('main_page', tag=tag)) + uuid = request.args.get('uuid') + i=0 + if uuid: + update_q.put(uuid) + i = 1 -@app.route("/api/recheckall", methods=['GET']) -def api_watch_recheckall(): + elif tag != None: + for watch_uuid, watch in datastore.data['watching'].items(): + if (tag != None and tag in watch['tag']): + i += 1 + update_q.put(watch_uuid) + else: + # No tag, no uuid, add everything. + for watch_uuid, watch in datastore.data['watching'].items(): + i += 1 + update_q.put(watch_uuid) - for uuid, watch in datastore.data['watching'].items(): - update_q.put(uuid) + messages.append({'class': 'ok', 'message': "{} watches are rechecking.".format(i)}) + return redirect(url_for('main_page', tag=tag)) - return "Triggered recheck of {} watches.".format(len(datastore.data['watching'])) # Requests for checking on the site use a pool of thread Workers managed by a Queue. @@ -362,7 +367,9 @@ class Worker(threading.Thread): while True: uuid = self.q.get() # Blocking self.current_uuid = uuid - fetch_site_status.perform_site_check(uuid=uuid, datastore=datastore) + # A little safety protection + if uuid in list( datastore.data['watching'].keys()): + fetch_site_status.perform_site_check(uuid=uuid, datastore=datastore) self.current_uuid = None # Done self.q.task_done() diff --git a/backend/static/css/styles.css b/backend/static/css/styles.css index 9a5afd7c..c61e36c9 100644 --- a/backend/static/css/styles.css +++ b/backend/static/css/styles.css @@ -82,7 +82,16 @@ section.content { margin: 0 3px 0 5px; } -/* hotovo */ +#check-all-button { + text-align:right; +} + +#check-all-button a { + border-top-left-radius: initial; + border-top-right-radius: initial; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; +} body:after { diff --git a/backend/templates/watch-overview.html b/backend/templates/watch-overview.html index b97d490a..939343c8 100644 --- a/backend/templates/watch-overview.html +++ b/backend/templates/watch-overview.html @@ -26,7 +26,6 @@