From 163a2adb821657cbbe8b07b69f3ebd2a576daa99 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 14 May 2025 16:50:58 +0200 Subject: [PATCH] fixes to error handling output --- .../watchlist/templates/watch-overview.html | 34 +++++++++---------- changedetectionio/model/__init__.py | 1 + changedetectionio/realtime/socket_server.py | 6 ++-- changedetectionio/static/js/socket.js | 1 + .../styles/scss/parts/_watch_table.scss | 5 +++ changedetectionio/static/styles/styles.css | 2 ++ 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/changedetectionio/blueprint/watchlist/templates/watch-overview.html b/changedetectionio/blueprint/watchlist/templates/watch-overview.html index 7071801d..aa8b838e 100644 --- a/changedetectionio/blueprint/watchlist/templates/watch-overview.html +++ b/changedetectionio/blueprint/watchlist/templates/watch-overview.html @@ -127,7 +127,7 @@ {% if watch.get_fetch_backend == "html_webdriver" - or ( watch.get_fetch_backend == "system" and system_default_fetcher == 'html_webdriver' ) + or ( watch.get_fetch_backend == "system" and system_default_fetcher == 'html_webdriver' ) or "extra_browser_" in watch.get_fetch_backend %} Using a Chrome browser @@ -135,24 +135,24 @@ {%if watch.is_pdf %}{% endif %} {% if watch.has_browser_steps %}{% endif %} - {% if watch.last_error is defined and watch.last_error != False %} -
{{ watch.last_error }} - {% if '403' in watch.last_error %} - {% if has_proxies %} - Try other proxies/location  - {% endif %} - Try adding external proxies/locations - - {% endif %} - {% if 'empty result or contain only an image' in watch.last_error %} - more help here. - {% endif %} + - {% endif %} - {% if watch.last_notification_error is defined and watch.last_notification_error != False %} - - {% endif %} + + {#@todo - link this to ajax update or update someother way.. maybe watch.full_error text method?#} + {# #}{% if watch.last_notification_error is defined and watch.last_notification_error != False %} + {# #} + {# #}{% endif %} {% if watch['processor'] == 'text_json_diff' %} {% if watch['has_ldjson_price_data'] and not watch['track_ldjson_price_data'] %} diff --git a/changedetectionio/model/__init__.py b/changedetectionio/model/__init__.py index 383a9c55..2a6587aa 100644 --- a/changedetectionio/model/__init__.py +++ b/changedetectionio/model/__init__.py @@ -36,6 +36,7 @@ class watch_base(dict): 'include_filters': [], 'last_checked': 0, 'last_error': False, + 'last_notification_error': None, 'last_viewed': 0, # history key value of the last viewed via the [diff] link 'method': 'GET', 'notification_alert_count': 0, diff --git a/changedetectionio/realtime/socket_server.py b/changedetectionio/realtime/socket_server.py index 660fee04..a4dbfffe 100644 --- a/changedetectionio/realtime/socket_server.py +++ b/changedetectionio/realtime/socket_server.py @@ -54,14 +54,16 @@ def handle_watch_update(socketio, **kwargs): queue_list.append(q_item.item['uuid']) # Create a simplified watch data object to send to clients + last_error_text = ' - '.join(filter(None, [watch.get('last_notification_error', ''), watch.get('error_text', '')])).strip() watch_data = { 'checking_now': True if watch.get('uuid') in running_uuids else False, 'fetch_time': watch.get('fetch_time'), - 'has_error': watch.get('last_error') or watch.get('last_notification_error'), + 'has_error': True if watch.get('last_error') or watch.get('last_notification_error') else False, 'last_changed': watch.get('last_changed'), 'last_checked': watch.get('last_checked'), + 'error_text': last_error_text, 'last_checked_text': _jinja2_filter_datetime(watch), - 'last_changed_text': timeago.format(int(watch['last_changed']), time.time()) if watch.history_n >=2 and int(watch.get('last_changed',0)) >0 else 'Not yet', + 'last_changed_text': timeago.format(int(watch['last_changed']), time.time()) if watch.history_n >= 2 and int(watch.get('last_changed', 0)) > 0 else 'Not yet', 'queued': True if watch.get('uuid') in queue_list else False, 'paused': True if watch.get('paused') else False, 'notification_muted': True if watch.get('notification_muted') else False, diff --git a/changedetectionio/static/js/socket.js b/changedetectionio/static/js/socket.js index 0123e6f5..27ae9a35 100644 --- a/changedetectionio/static/js/socket.js +++ b/changedetectionio/static/js/socket.js @@ -54,6 +54,7 @@ $(document).ready(function () { $($watchRow).toggleClass('notification_muted', watch.notification_muted); $($watchRow).toggleClass('paused', watch.paused); + $('td.error', $watchRow).text(watch.last_error_text) $('td.last-changed', $watchRow).text(watch.last_checked_text) $('td.last-checked .innertext', $watchRow).text(watch.last_checked_text) $('td.last-checked', $watchRow).data('timestamp', watch.last_checked).data('fetchduration', watch.fetch_time); diff --git a/changedetectionio/static/styles/scss/parts/_watch_table.scss b/changedetectionio/static/styles/scss/parts/_watch_table.scss index 153e9968..830b966f 100644 --- a/changedetectionio/static/styles/scss/parts/_watch_table.scss +++ b/changedetectionio/static/styles/scss/parts/_watch_table.scss @@ -88,5 +88,10 @@ } } } + tr.error { + .fetch-error { + display: inline-block !important; + } + } } diff --git a/changedetectionio/static/styles/styles.css b/changedetectionio/static/styles/styles.css index 681e99f9..2b54e680 100644 --- a/changedetectionio/static/styles/styles.css +++ b/changedetectionio/static/styles/styles.css @@ -567,6 +567,8 @@ body.preview-text-enabled { display: inline !important; } .watch-table tr.notification_muted a.mute-toggle.state-off { display: none !important; } + .watch-table tr.error .fetch-error { + display: inline-block !important; } ul#conditions_match_logic { list-style: none; }