aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates
diff options
context:
space:
mode:
authorDennis Fink2026-11-18 21:13:34 +0100
committerDennis Fink2026-11-18 21:13:34 +0100
commitb2b5429bcf008db357d9d65db77ba37f7af908a8 (patch)
treeed913ee050817609b56d2f5515b2c3fbc9945a75 /webmentions_ssg/templates
parentbeb0131b089293512c2dab2243b9b2ff314e2387 (diff)
downloadwebmentions-ssg-b2b5429bcf008db357d9d65db77ba37f7af908a8.tar.gz
webmentions-ssg-b2b5429bcf008db357d9d65db77ba37f7af908a8.zip
feat(sender): add source list filters and sorting
Add status, search, date, sorting, and page-size controls to the source list with validated query parameters and stable pagination. Preserve list context across source details, rescans, resends, and pagination, and surface failed and retrying delivery counts with retry deadlines.
Diffstat (limited to 'webmentions_ssg/templates')
-rw-r--r--webmentions_ssg/templates/sent.html103
-rw-r--r--webmentions_ssg/templates/sent_source.html23
2 files changed, 103 insertions, 23 deletions
diff --git a/webmentions_ssg/templates/sent.html b/webmentions_ssg/templates/sent.html
index d2a319d..6febdb9 100644
--- a/webmentions_ssg/templates/sent.html
+++ b/webmentions_ssg/templates/sent.html
@@ -7,6 +7,19 @@ SPDX-License-Identifier: BSD-3-Clause
{% from "bootstrap5/pagination.html" import render_pagination %}
+{% macro sortable_header(label, column, responsive_class="") %}
+ {% set active = sort_key == column %}
+ <th scope="col"
+ class="{{ responsive_class }}"
+ aria-sort="{{ ('ascending' if sort_order == 'asc' else 'descending') if active else 'none' }}">
+ <a href="{{ sort_urls[column] }}"
+ class="link-body-emphasis text-decoration-none">
+ {{ label }}
+ {% if active %}<span aria-hidden="true">{{ "↑" if sort_order == "asc" else "↓" }}</span>{% endif %}
+ </a>
+ </th>
+{% endmacro %}
+
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="mb-0">Sources</h1>
@@ -16,29 +29,72 @@ SPDX-License-Identifier: BSD-3-Clause
class="btn btn-sm btn-primary"
data-bs-toggle="modal"
data-bs-target="#confirmation-modal"
- data-action="{{ url_for('webmentions.rescan_sources') }}"
+ data-action="{{ url_for('webmentions.rescan_sources', page=sources.page, **filters) }}"
data-title="Rescan sources?"
data-message="All sources will be scanned again for changes and webmentions."
data-confirm-label="Rescan"
data-confirm-class="btn-primary">Rescan</button>
</div>
</div>
+ <form action="{{ url_for('webmentions.source_list') }}"
+ method="get"
+ class="row g-2 align-items-end mb-4"
+ role="search">
+ {{ form.sort }}
+ {{ form.order }}
+ <div class="col-sm-6 col-lg">
+ {{ form.status.label(class_="form-label") }}
+ {{ form.status(class_="form-select") }}
+ </div>
+ <div class="col-sm-6 col-lg">
+ {{ form.q.label(class_="form-label") }}
+ {{ form.q(class_="form-control", placeholder="Search paths and URLs") }}
+ </div>
+ <div class="col-sm-6 col-lg">
+ {{ form.date_from.label(class_="form-label") }}
+ {{ form.date_from(class_="form-control") }}
+ </div>
+ <div class="col-sm-6 col-lg">
+ {{ form.date_to.label(class_="form-label") }}
+ {{ form.date_to(class_="form-control") }}
+ </div>
+ <div class="col-sm-6 col-lg-auto">
+ {{ form.per_page.label(class_="form-label") }}
+ {{ form.per_page(class_="form-control", min=1, max=max_source_page_size, step=1) }}
+ </div>
+ <div class="col-auto d-flex gap-2 ms-auto">
+ <button type="submit" class="btn btn-primary">Filter</button>
+ <a href="{{ url_for('webmentions.source_list') }}"
+ class="btn btn-outline-secondary">Clear</a>
+ </div>
+ </form>
{% if sources.items %}
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover align-middle">
<thead>
<tr>
- <th scope="col">Path</th>
- <th scope="col" class="d-none d-md-table-cell">URL</th>
- <th scope="col">Webmentions</th>
- <th scope="col" class="d-none d-md-table-cell">Revision</th>
- <th scope="col" class="d-none d-md-table-cell">Created</th>
- <th scope="col" class="d-none d-md-table-cell">Last seen</th>
- <th scope="col">Status</th>
+ {{ sortable_header('Status', 'status') }}
+ {{ sortable_header('Path', 'path') }}
+ {{ sortable_header('URL', 'url', 'd-none d-md-table-cell') }}
+ {{ sortable_header('Webmentions', 'webmentions') }}
+ {{ sortable_header('Revision', 'revision', 'd-none d-md-table-cell') }}
+ {{ sortable_header('Created', 'created', 'd-none d-md-table-cell') }}
+ {{ sortable_header('Last seen', 'last_seen', 'd-none d-md-table-cell') }}
</tr>
</thead>
<tbody>
{% for source in sources %}
+ {% set statistics = namespace(sent=0, failed=0, retrying=0) %}
+ {% for webmention in source.sent_webmentions %}
+ {% if webmention.status == "sent" %}
+ {% set statistics.sent = statistics.sent + 1 %}
+ {% elif webmention.status == "failed" %}
+ {% set statistics.failed = statistics.failed + 1 %}
+ {% endif %}
+ {% if webmention.awaiting_processing and webmention.attempt_count > 0 and webmention.next_retry_at is not none %}
+ {% set statistics.retrying = statistics.retrying + 1 %}
+ {% endif %}
+ {% endfor %}
{% if source.deleted_at is none %}
{% set row_class = "table-success" %}
{% set badge_class = "text-bg-success" %}
@@ -49,13 +105,27 @@ SPDX-License-Identifier: BSD-3-Clause
{% set status_text = "Deleted" %}
{% endif %}
<tr class="{{ row_class }}">
+ <td>
+ <span class="badge {{ badge_class }}">{{ status_text }}</span>
+ </td>
<td class="text-break">
- <a href="{{ url_for('webmentions.source_detail', source_uuid=source.uuid) }}">{{ source.path }}</a>
+ <a href="{{ url_for('webmentions.source_detail', source_uuid=source.uuid, source_page=sources.page, **filters) }}">{{ source.path }}</a>
</td>
<td class="text-break d-none d-md-table-cell">
<a href="{{ source.url }}">{{ source.url }}</a>
</td>
- <td>{{ source.sent_webmentions | length }}</td>
+ <td>
+ <span class="badge text-bg-info">{{ source.sent_webmentions | length }} Total</span>
+ {% if statistics.sent %}
+ <span class="badge text-bg-success">{{ statistics.sent }} sent</span>
+ {% endif %}
+ {% if statistics.failed %}
+ <span class="badge text-bg-danger">{{ statistics.failed }} failed</span>
+ {% endif %}
+ {% if statistics.retrying %}
+ <span class="badge text-bg-warning">{{ statistics.retrying }} awaiting retry</span>
+ {% endif %}
+ </td>
<td class="d-none d-md-table-cell">{{ source.revision }}</td>
<td class="text-nowrap d-none d-md-table-cell">
<time datetime="{{ source.created_at | utc_isoformat }}"
@@ -69,21 +139,22 @@ SPDX-License-Identifier: BSD-3-Clause
{{ source.last_seen_at | relative_time }}
</time>
</td>
- <td>
- <span class="badge {{ badge_class }}">{{ status_text }}</span>
- </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if sources.pages > 1 %}
- <div class="mt-3">{{ render_pagination(sources) }}</div>
+ <div class="mt-3">{{ render_pagination(sources, args=filters) }}</div>
{% endif %}
- {% include "includes/confirmation_modal.html" %}
{% else %}
- <p class="text-body-secondary">No Webmention sources have been discovered yet.</p>
+ {% if filters %}
+ <p class="text-body-secondary">No sources match these filters.</p>
+ {% else %}
+ <p class="text-body-secondary">No Webmention sources have been discovered yet.</p>
+ {% endif %}
{% endif %}
+ {% include "includes/confirmation_modal.html" %}
{% endblock %}
{% block scripts %}
diff --git a/webmentions_ssg/templates/sent_source.html b/webmentions_ssg/templates/sent_source.html
index 33e26a2..04f9d07 100644
--- a/webmentions_ssg/templates/sent_source.html
+++ b/webmentions_ssg/templates/sent_source.html
@@ -26,7 +26,7 @@ SPDX-License-Identifier: BSD-3-Clause
{% block content %}
<div class="mb-3">
- <a href="{{ url_for('webmentions.source_list') }}">← Back to sources</a>
+ <a href="{{ url_for('webmentions.source_list', page=source_page, **filters) }}">← Back to sources</a>
</div>
<div class="d-flex justify-content-between align-items-start mb-3">
<h1 class="mb-0">Source Details</h1>
@@ -96,8 +96,8 @@ SPDX-License-Identifier: BSD-3-Clause
<table class="table table-bordered table-striped table-hover align-middle">
<thead>
<tr>
- <th scope="col">Target</th>
<th scope="col">Status</th>
+ <th scope="col">Target</th>
<th scope="col" class="d-none d-md-table-cell">Active</th>
<th scope="col" class="d-none d-md-table-cell">Revisions</th>
<th scope="col" class="d-none d-md-table-cell">Delivery</th>
@@ -110,13 +110,22 @@ SPDX-License-Identifier: BSD-3-Clause
{% set style = sent_status_presentation.get(webmention.status, {"row_class": "table-info", "badge_class": "text-bg-info", "label": "Pending" }) %}
<tr class="{{ style.row_class }}">
<td class="text-break">
- <a href="{{ webmention.target }}">{{ webmention.target }}</a>
- </td>
- <td class="text-break">
<span class="badge {{ style.badge_class }}">{{ style.label }}</span>
{% if webmention.failure_reason is not none %}
<div class="small mt-2">{{ webmention.failure_reason }}</div>
{% endif %}
+ {% if webmention.awaiting_processing and webmention.attempt_count > 0 and webmention.next_retry_at is not none %}
+ <div class="small mt-2">
+ Retry scheduled after attempt {{ webmention.attempt_count }}:
+ <time datetime="{{ webmention.next_retry_at | utc_isoformat }}"
+ title="{{ webmention.next_retry_at | utc_timestamp }}">
+ {{ webmention.next_retry_at | relative_time }}
+ </time>
+ </div>
+ {% endif %}
+ </td>
+ <td class="text-break">
+ <a href="{{ webmention.target }}">{{ webmention.target }}</a>
</td>
<td class="d-none d-md-table-cell">
{% if webmention.linked %}
@@ -199,7 +208,7 @@ SPDX-License-Identifier: BSD-3-Clause
class="btn btn-sm btn-primary"
data-bs-toggle="modal"
data-bs-target="#confirmation-modal"
- data-action="{{ url_for('webmentions.resend_webmention', source_uuid=source.uuid, webmention_uuid=webmention.uuid) }}"
+ data-action="{{ url_for('webmentions.resend_webmention', source_uuid=source.uuid, webmention_uuid=webmention.uuid, source_page=source_page, page=webmentions.page, **filters) }}"
data-title="Resend Webmention?"
data-message="This Webmention will be queued again for delivery to {{ webmention.target }}."
data-confirm-label="Resend"
@@ -211,7 +220,7 @@ SPDX-License-Identifier: BSD-3-Clause
</table>
</div>
{% if webmentions.pages > 1 %}
- <div class="mt-3">{{ render_pagination(webmentions) }}</div>
+ <div class="mt-3">{{ render_pagination(webmentions, args=dict(filters, source_page=source_page)) }}</div>
{% endif %}
{% include "includes/confirmation_modal.html" %}
{% else %}