diff options
| author | Dennis Fink | 2026-11-18 08:01:26 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-18 08:01:26 +0100 |
| commit | b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a (patch) | |
| tree | 322d85654e5518c2836ce57beafaa7e2abaab741 /webmentions_ssg/templates | |
| parent | 63af533d98aac82b6d4f069b217d3e837285508d (diff) | |
| download | webmentions-ssg-b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a.tar.gz webmentions-ssg-b908ee61770dc78f8d8fbbbfc4f3c00d7877d42a.zip | |
feat(core): add dashboard overview
Replace the root redirect with an authenticated dashboard showing
received and outgoing status counts, recent activity, pending sends,
retries, and queue depth.
Persist the last completed source scan so operational status survives
restarts and only advances after a successful, conclusive scan.
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/templates/base.html | 2 | ||||
| -rw-r--r-- | webmentions_ssg/templates/dashboard.html | 148 |
2 files changed, 150 insertions, 0 deletions
diff --git a/webmentions_ssg/templates/base.html b/webmentions_ssg/templates/base.html index 4fffb38..115f193 100644 --- a/webmentions_ssg/templates/base.html +++ b/webmentions_ssg/templates/base.html @@ -43,6 +43,8 @@ SPDX-License-Identifier: BSD-3-Clause </a> {% if current_user.is_authenticated %} <div class="navbar-nav flex-row gap-3"> + <a class="nav-link{% if request.endpoint == 'webmentions.index' %} active{% endif %}" + href="{{ url_for('webmentions.index') }}">Dashboard</a> <a class="nav-link{% if request.endpoint in ('webmentions.received_list', 'webmentions.received_detail') %} active{% endif %}" href='{{ url_for("webmentions.received_list") }}'>Received</a> <a class="nav-link{% if request.endpoint and request.endpoint.startswith('webmentions.moderation') %} active{% endif %}" diff --git a/webmentions_ssg/templates/dashboard.html b/webmentions_ssg/templates/dashboard.html new file mode 100644 index 0000000..a7f968e --- /dev/null +++ b/webmentions_ssg/templates/dashboard.html @@ -0,0 +1,148 @@ +<!-- +SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> + +SPDX-License-Identifier: BSD-3-Clause +--> +{% extends "base.html" %} + +{% block content %} + <div class="d-flex justify-content-between align-items-center mb-4"> + <h1 class="mb-0">Dashboard</h1> + <span class="text-body-secondary">Single-site overview</span> + </div> + + <div class="row g-4 mb-4"> + <section class="col-lg-6" aria-labelledby="received-summary"> + <div class="card h-100"> + <div class="card-body"> + <div class="d-flex justify-content-between align-items-center mb-3"> + <h2 class="h4 mb-0" id="received-summary">Received</h2> + <a href="{{ url_for('webmentions.received_list') }}">View all</a> + </div> + <p class="display-6 mb-3">{{ received_total }} <span class="fs-6 text-body-secondary">total</span></p> + <div class="row row-cols-2 g-3"> + <div class="col"> + <a href="{{ url_for('webmentions.received_list', status='pending') }}">Pending</a> + <div class="h3">{{ received_counts.received }}</div> + </div> + <div class="col"> + <a href="{{ url_for('webmentions.received_list', status='verifying') }}">Verifying</a> + <div class="h3">{{ received_counts.verifying }}</div> + </div> + <div class="col"> + <a href="{{ url_for('webmentions.received_list', status='verified') }}">Verified</a> + <div class="h3">{{ received_counts.verified }}</div> + </div> + <div class="col"> + <a href="{{ url_for('webmentions.received_list', status='declined') }}">Declined</a> + <div class="h3">{{ received_counts.failed + received_counts.source_removed }}</div> + <p class="small text-body-secondary mb-0">Failed: {{ received_counts.failed }} ยท Source removed: {{ received_counts.source_removed }}</p> + </div> + </div> + </div> + </div> + </section> + + <section class="col-lg-6" aria-labelledby="sent-summary"> + <div class="card h-100"> + <div class="card-body"> + <div class="d-flex justify-content-between align-items-center mb-3"> + <h2 class="h4 mb-0" id="sent-summary">Outgoing</h2> + <a href="{{ url_for('webmentions.source_list') }}">View sources</a> + </div> + <p class="display-6 mb-3">{{ sent_total }} <span class="fs-6 text-body-secondary">total</span></p> + <div class="row row-cols-2 g-3"> + <div class="col"> + <div>Sent</div> + <div class="h3">{{ sent_counts.sent }}</div> + </div> + <div class="col"> + <div>No endpoint</div> + <div class="h3">{{ sent_counts.no_endpoint }}</div> + </div> + <div class="col"> + <div>Failed (final)</div> + <div class="h3">{{ sent_counts.failed }}</div> + </div> + <div class="col"> + <div>Not attempted</div> + <div class="h3">{{ not_attempted }}</div> + </div> + <div class="col"> + <div>Pending</div> + <div class="h3">{{ pending_sends }}</div> + <p class="small text-body-secondary mb-0">Waiting to retry: {{ waiting_retries }}</p> + </div> + </div> + </div> + </div> + </section> + </div> + + <section class="mb-4" aria-labelledby="recent-activity"> + <h2 class="h4" id="recent-activity">Recent activity</h2> + <div class="table-responsive"> + <table class="table table-bordered align-middle"> + <thead> + <tr> + <th scope="col">Activity (UTC)</th> + <th scope="col">Last 7 days</th> + <th scope="col">Last 30 days</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">New received Webmentions</th> + <td>{{ recent[7].received }}</td> + <td>{{ recent[30].received }}</td> + </tr> + <tr> + <th scope="row">Webmentions last sent successfully</th> + <td>{{ recent[7].sent }}</td> + <td>{{ recent[30].sent }}</td> + </tr> + </tbody> + </table> + </div> + </section> + + <section aria-labelledby="operations"> + <h2 class="h4" id="operations">Operations</h2> + <div class="row g-3"> + <div class="col-md-4"> + <div class="card h-100"> + <div class="card-body"> + <h3 class="h6 text-body-secondary">Source documents</h3> + <p class="h3 mb-0">{{ source_count }}</p> + </div> + </div> + </div> + <div class="col-md-4"> + <div class="card h-100"> + <div class="card-body"> + <h3 class="h6 text-body-secondary">Last completed source scan</h3> + {% if last_scan %} + <time datetime="{{ last_scan.isoformat() }}" class="fs-5"> + {{ last_scan.strftime("%Y-%m-%d %H:%M:%S") }} UTC + </time> + {% else %} + <p class="text-body-secondary mb-0">No completed scan yet</p> + {% endif %} + </div> + </div> + </div> + <div class="col-md-4"> + <div class="card h-100"> + <div class="card-body"> + <h3 class="h6 text-body-secondary">Huey pending tasks</h3> + {% if queue_size is not none %} + <p class="h3 mb-0">{{ queue_size }}</p> + {% else %} + <p class="text-body-secondary mb-0">Unavailable</p> + {% endif %} + </div> + </div> + </div> + </div> + </section> +{% endblock %} |
