diff --git a/changedetectionio/blueprint/watchlist/templates/watch-overview.html b/changedetectionio/blueprint/watchlist/templates/watch-overview.html index b72e721b..728a204c 100644 --- a/changedetectionio/blueprint/watchlist/templates/watch-overview.html +++ b/changedetectionio/blueprint/watchlist/templates/watch-overview.html @@ -1,6 +1,6 @@ -{% extends 'base.html' %} -{% block content %} -{% from '_helpers.html' import render_simple_field, render_field, render_nolabel_field, sort_by_title %} +{%- extends 'base.html' -%} +{%- block content -%} +{%- from '_helpers.html' import render_simple_field, render_field, render_nolabel_field, sort_by_title -%} @@ -55,73 +55,78 @@ document.addEventListener('DOMContentLoaded', function() { - {% if watches|length >= pagination.per_page %} + {%- if watches|length >= pagination.per_page -%} {{ pagination.info }} - {% endif %} - {% if search_q %}
Searching "{{search_q}}"
{% endif %} + {%- endif -%} + {%- if search_q -%}
Searching "{{search_q}}"
{%- endif -%}
All - {% for uuid, tag in tags %} - {% if tag != "" %} + {%- for uuid, tag in tags -%} + {%- if tag != "" -%} {{ tag.title }} - {% endif %} - {% endfor %} + {%- endif -%} + {%- endfor -%}
- {% set sort_order = sort_order or 'asc' %} - {% set sort_attribute = sort_attribute or 'last_changed' %} - {% set pagination_page = request.args.get('page', 0) %} - {% set cols_required = 6 %} - {% set any_has_restock_price_processor = datastore.any_watches_have_processor_by_name("restock_diff") %} - {% if any_has_restock_price_processor %} - {% set cols_required = cols_required + 1 %} - {% endif %} + {%- set sort_order = sort_order or 'asc' -%} + {%- set sort_attribute = sort_attribute or 'last_changed' -%} + {%- set pagination_page = request.args.get('page', 0) -%} + {%- set cols_required = 6 -%} + {%- set any_has_restock_price_processor = datastore.any_watches_have_processor_by_name("restock_diff") -%} + {%- if any_has_restock_price_processor -%} + {%- set cols_required = cols_required + 1 -%} + {%- endif -%}
- {% set link_order = "desc" if sort_order == 'asc' else "asc" %} - {% set arrow_span = "" %} + {%- set link_order = "desc" if sort_order == 'asc' else "asc" -%} + {%- set arrow_span = "" -%} - {% if any_has_restock_price_processor %} + {%- if any_has_restock_price_processor -%} - {% endif %} + {%- endif -%} - {% if not watches|length %} + {%- if not watches|length -%} - {% endif %} - {% for watch in (watches|sort(attribute=sort_attribute, reverse=sort_order == 'asc'))|pagination_slice(skip=pagination.skip) %} - - {% set checking_now = is_checking_now(watch) %} - + {%- endif -%} + {%- for watch in (watches|sort(attribute=sort_attribute, reverse=sort_order == 'asc'))|pagination_slice(skip=pagination.skip) -%} + {%- set checking_now = is_checking_now(watch) -%} + {%- set history_n = watch.history_n -%} + {# Mirror in changedetectionio/static/js/realtime.js for the frontend #} + {%- set row_classes = [ + loop.cycle('pure-table-odd', 'pure-table-even'), + 'processor-' ~ watch['processor'], + 'has-error' if watch.compile_error_texts()|length > 2 else '', + 'paused' if watch.paused is defined and watch.paused != False else '', + 'unviewed' if watch.has_unviewed else '', + 'has-restock-info' if watch.has_restock_info else 'no-restock-info', + 'in-stock' if watch.has_restock_info and watch['restock']['in_stock'] else '', + 'not-in-stock' if watch.has_restock_info and not watch['restock']['in_stock'] else '', + 'queued' if watch.uuid in queued_uuids else '', + 'checking-now' if checking_now else '', + 'notification_muted' if watch.notification_muted else '', + 'single-history' if history_n == 1 else '', + 'multiple-history' if history_n >= 2 else '' + ] -%} + @@ -129,53 +134,52 @@ document.addEventListener('DOMContentLoaded', function() { - {% if watch.get_fetch_backend == "html_webdriver" + {%- if watch.get_fetch_backend == "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 - {% endif %} + {%- endif -%} - {% if watch.is_pdf %}Converting PDF to text{% endif %} - {% if watch.has_browser_steps %}Browser Steps is enabled{% endif %} + {%- if watch.is_pdf -%}Converting PDF to text{%- endif -%} + {%- if watch.has_browser_steps -%}Browser Steps is enabled{%- endif -%} - {% if watch['processor'] == 'text_json_diff' %} - {% if watch['has_ldjson_price_data'] and not watch['track_ldjson_price_data'] %} + {%- if watch['processor'] == 'text_json_diff' -%} + {%- if watch['has_ldjson_price_data'] and not watch['track_ldjson_price_data'] -%}
Switch to Restock & Price watch mode? Yes No
- {% endif %} - {% endif %} - {% if watch['processor'] == 'restock_diff' %} + {%- endif -%} + {%- endif -%} + {%- if watch['processor'] == 'restock_diff' -%} Price - {% endif %} - {% for watch_tag_uuid, watch_tag in datastore.get_all_tags_for_watch(watch['uuid']).items() %} + {%- endif -%} + {%- for watch_tag_uuid, watch_tag in datastore.get_all_tags_for_watch(watch['uuid']).items() -%} {{ watch_tag.title }} - {% endfor %} + {%- endfor -%} - -{% if any_has_restock_price_processor %} +{%- if any_has_restock_price_processor -%} -{% endif %} +{%- endif -%} {#last_checked becomes fetch-start-time#} - - - - {% endfor %} + {%- endfor -%}
# Website Restock & PriceLast Checked Last Changed
No website watches configured, please add a URL in the box above, or import a list.
{{ loop.index+pagination.skip }} Pause checks - Mute notification - {% if watch['processor'] == 'restock_diff' %} - {% if watch.has_restock_info %} + {%- if watch['processor'] == 'restock_diff' -%} + {%- if watch.has_restock_info -%} - {% if watch['restock']['in_stock'] %} In stock {% else %} Not in stock {% endif %} + {%- if watch['restock']['in_stock']-%} In stock {%- else-%} Not in stock {%- endif -%} - {% endif %} + {%- endif -%} - {% if watch.get('restock') and watch['restock']['price'] != None %} - {% if watch['restock']['price'] != None %} + {%- if watch.get('restock') and watch['restock']['price'] != None -%} + {%- if watch['restock']['price'] != None -%} {{ watch['restock']['price']|format_number_locale }} {{ watch['restock']['currency'] }} - {% endif %} - {% elif not watch.has_restock_info %} + {%- endif -%} + {%- elif not watch.has_restock_info -%} No information - {% endif %} - {% endif %} + {%- endif -%} + {%- endif -%} {{watch|format_last_checked_time|safe}} {% if watch.history_n >=2 and watch.last_changed >0 %} + {%- if watch.history_n >=2 and watch.last_changed >0 -%} {{watch.last_changed|format_timestamp_timeago}} - {% else %} + {%- else -%} Not yet - {% endif %} + {%- endif -%} + {%- set target_attr = ' target="' ~ watch.uuid ~ '"' if datastore.data['settings']['application']['ui'].get('open_diff_in_new_tab') else '' -%} - Recheck Edit - - {% if watch.history_n >= 2 %} - - {% set open_diff_in_new_tab = datastore.data['settings']['application']['ui'].get('open_diff_in_new_tab') %} - {% set target_attr = ' target="' ~ watch.uuid ~ '"' if open_diff_in_new_tab else '' %} - - {% if watch.has_unviewed %} - History - {% else %} - History - {% endif %} - - {% else %} - {% if watch.history_n == 1 or (watch.history_n ==0 and watch.error_text_ctime )%} - Preview - {% endif %} - {% endif %} + +
-{% endblock %} \ No newline at end of file +{%- endblock -%} \ No newline at end of file diff --git a/changedetectionio/realtime/socket_server.py b/changedetectionio/realtime/socket_server.py index 745280b9..1546ca10 100644 --- a/changedetectionio/realtime/socket_server.py +++ b/changedetectionio/realtime/socket_server.py @@ -227,6 +227,7 @@ def handle_watch_update(socketio, **kwargs): 'last_changed': watch.get('last_changed'), 'last_checked': watch.get('last_checked'), 'error_text': error_texts, + 'history_n': watch.history_n, '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', diff --git a/changedetectionio/static/js/realtime.js b/changedetectionio/static/js/realtime.js index 371ba32e..5f6984c9 100644 --- a/changedetectionio/static/js/realtime.js +++ b/changedetectionio/static/js/realtime.js @@ -97,6 +97,8 @@ $(document).ready(function () { $($watchRow).toggleClass('has-error', watch.has_error); $($watchRow).toggleClass('notification_muted', watch.notification_muted); $($watchRow).toggleClass('paused', watch.paused); + $($watchRow).toggleClass('single-history', watch.history_n === 1); + $($watchRow).toggleClass('multiple-history', watch.history_n >= 2); $('td.title-col .error-text', $watchRow).html(watch.error_text) diff --git a/changedetectionio/static/styles/scss/parts/_watch_table.scss b/changedetectionio/static/styles/scss/parts/_watch_table.scss index 531a5c17..b6f0ff6b 100644 --- a/changedetectionio/static/styles/scss/parts/_watch_table.scss +++ b/changedetectionio/static/styles/scss/parts/_watch_table.scss @@ -117,5 +117,18 @@ display: block !important; } } + + tr.single-history { + a.preview-link { + display: inline-block !important; + } + } + tr.multiple-history { + a.history-link { + display: inline-block !important; + } + } } + + diff --git a/changedetectionio/static/styles/styles.css b/changedetectionio/static/styles/styles.css index bbf5e47f..7699ea28 100644 --- a/changedetectionio/static/styles/styles.css +++ b/changedetectionio/static/styles/styles.css @@ -582,6 +582,10 @@ body.preview-text-enabled { color: var(--color-watch-table-error); } .watch-table tr.has-error .error-text { display: block !important; } + .watch-table tr.single-history a.preview-link { + display: inline-block !important; } + .watch-table tr.multiple-history a.history-link { + display: inline-block !important; } ul#conditions_match_logic { list-style: none; }