mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-12 11:05:42 +00:00
Order by created time by default
This commit is contained in:
@@ -20,6 +20,7 @@ base_config = {
|
|||||||
'body': None,
|
'body': None,
|
||||||
'check_unique_lines': False, # On change-detected, compare against all history if its something new
|
'check_unique_lines': False, # On change-detected, compare against all history if its something new
|
||||||
'check_count': 0,
|
'check_count': 0,
|
||||||
|
'date_created': None,
|
||||||
'consecutive_filter_failures': 0, # Every time the CSS/xPath filter cannot be located, reset when all is fine.
|
'consecutive_filter_failures': 0, # Every time the CSS/xPath filter cannot be located, reset when all is fine.
|
||||||
'extract_text': [], # Extract text by regex after filters
|
'extract_text': [], # Extract text by regex after filters
|
||||||
'extract_title_as_title': False,
|
'extract_title_as_title': False,
|
||||||
|
|||||||
@@ -316,7 +316,8 @@ class ChangeDetectionStore:
|
|||||||
# #Re 569
|
# #Re 569
|
||||||
new_watch = Watch.model(datastore_path=self.datastore_path, default={
|
new_watch = Watch.model(datastore_path=self.datastore_path, default={
|
||||||
'url': url,
|
'url': url,
|
||||||
'tag': tag
|
'tag': tag,
|
||||||
|
'date_created': int(time.time())
|
||||||
})
|
})
|
||||||
|
|
||||||
new_uuid = new_watch['uuid']
|
new_uuid = new_watch['uuid']
|
||||||
@@ -679,3 +680,13 @@ class ChangeDetectionStore:
|
|||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# We don't know when the date_created was in the past until now, so just add an index number for now.
|
||||||
|
def update_11(self):
|
||||||
|
i = 0
|
||||||
|
for uuid, watch in self.data['watching'].items():
|
||||||
|
if not watch.get('date_created'):
|
||||||
|
watch['date_created'] = i
|
||||||
|
i+=1
|
||||||
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -50,17 +50,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% set sort_order = request.args.get('order', 'asc') == 'asc' %}
|
{% set sort_order = request.args.get('order', 'asc') == 'asc' %}
|
||||||
{% set sort_attribute = request.args.get('sort', 'last_changed') %}
|
{% set sort_attribute = request.args.get('sort', 'date_created') %}
|
||||||
{% set pagination_page = request.args.get('page', 0) %}
|
{% set pagination_page = request.args.get('page', 0) %}
|
||||||
|
|
||||||
<div id="watch-table-wrapper">
|
<div id="watch-table-wrapper">
|
||||||
<table class="pure-table pure-table-striped watch-table">
|
<table class="pure-table pure-table-striped watch-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><input style="vertical-align: middle" type="checkbox" id="check-all"/> #</th>
|
|
||||||
<th></th>
|
|
||||||
{% set link_order = "desc" if sort_order else "asc" %}
|
{% set link_order = "desc" if sort_order else "asc" %}
|
||||||
{% set arrow_span = "" %}
|
{% set arrow_span = "" %}
|
||||||
|
<th><input style="vertical-align: middle" type="checkbox" id="check-all"/> <a class="{{ 'active '+link_order if sort_attribute == 'date_added' else 'inactive' }}" href="{{url_for('index', sort='date_added', order=link_order, tag=active_tag)}}"># <span class='arrow {{link_order}}'></span></a></th>
|
||||||
|
<th></th>
|
||||||
<th><a class="{{ 'active '+link_order if sort_attribute == 'label' else 'inactive' }}" href="{{url_for('index', sort='label', order=link_order, tag=active_tag)}}">Website <span class='arrow {{link_order}}'></span></a></th>
|
<th><a class="{{ 'active '+link_order if sort_attribute == 'label' else 'inactive' }}" href="{{url_for('index', sort='label', order=link_order, tag=active_tag)}}">Website <span class='arrow {{link_order}}'></span></a></th>
|
||||||
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_checked' else 'inactive' }}" href="{{url_for('index', sort='last_checked', order=link_order, tag=active_tag)}}">Last Checked <span class='arrow {{link_order}}'></span></a></th>
|
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_checked' else 'inactive' }}" href="{{url_for('index', sort='last_checked', order=link_order, tag=active_tag)}}">Last Checked <span class='arrow {{link_order}}'></span></a></th>
|
||||||
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_changed' else 'inactive' }}" href="{{url_for('index', sort='last_changed', order=link_order, tag=active_tag)}}">Last Changed <span class='arrow {{link_order}}'></span></a></th>
|
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_changed' else 'inactive' }}" href="{{url_for('index', sort='last_changed', order=link_order, tag=active_tag)}}">Last Changed <span class='arrow {{link_order}}'></span></a></th>
|
||||||
@@ -69,8 +69,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{% set sorted_watches = watches|sort(attribute=sort_attribute, reverse=sort_order) %}
|
{% for watch in watches|sort(attribute='date_created', reverse=sort_order) %}
|
||||||
{% for watch in sorted_watches %}
|
|
||||||
|
|
||||||
{# WIP for pagination, disabled for now
|
{# WIP for pagination, disabled for now
|
||||||
{% if not ( loop.index >= 3 and loop.index <=4) %}{% continue %}{% endif %} -->
|
{% if not ( loop.index >= 3 and loop.index <=4) %}{% continue %}{% endif %} -->
|
||||||
|
|||||||
Reference in New Issue
Block a user