diff options
Diffstat (limited to 'webmentions_ssg/templates')
| -rw-r--r-- | webmentions_ssg/templates/includes/received_failure.html | 22 | ||||
| -rw-r--r-- | webmentions_ssg/templates/received_detail.html | 27 |
2 files changed, 38 insertions, 11 deletions
diff --git a/webmentions_ssg/templates/includes/received_failure.html b/webmentions_ssg/templates/includes/received_failure.html new file mode 100644 index 0000000..65ed7a3 --- /dev/null +++ b/webmentions_ssg/templates/includes/received_failure.html @@ -0,0 +1,22 @@ +<!-- +SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> + +SPDX-License-Identifier: BSD-3-Clause +--> + +{% macro render_failure(reason) %} + {% set guidance = reason | received_failure_guidance %} + {% if guidance %} + <div class="text-break">{{ guidance.explanation }}</div> + {% if guidance.next_step %} + <div class="mt-1 text-break"><strong>Suggested next step:</strong> {{ guidance.next_step }}</div> + {% endif %} + <details class="mt-2"> + <summary class="small text-body-secondary">Technical reason</summary> + <div class="small text-break text-pre-formatted">{{ reason }}</div> + </details> + {% else %} + <div class="text-break text-pre-formatted">{{ reason }}</div> + <div class="small text-body-secondary mt-1">Check the application logs for details before reverifying.</div> + {% endif %} +{% endmacro %} diff --git a/webmentions_ssg/templates/received_detail.html b/webmentions_ssg/templates/received_detail.html index 091e2e4..32d3e05 100644 --- a/webmentions_ssg/templates/received_detail.html +++ b/webmentions_ssg/templates/received_detail.html @@ -5,6 +5,7 @@ SPDX-License-Identifier: BSD-3-Clause --> {% extends "base.html" %} +{% from "includes/received_failure.html" import render_failure %} {% set status_presentation = { "received": { "badge": "text-bg-info", @@ -78,7 +79,7 @@ SPDX-License-Identifier: BSD-3-Clause <dt class="col-md-3">Failure reason</dt> <dd class="col-md-9"> {% if webmention.failure_reason %} - <div class="text-break text-pre-formatted">{{ webmention.failure_reason }}</div> + {{ render_failure(webmention.failure_reason) }} {% else %} <span class="text-body-secondary">None</span> {% endif %} @@ -121,17 +122,21 @@ SPDX-License-Identifier: BSD-3-Clause <ol class="list-group list-group-numbered mb-3"> {% for event in history %} {% set event_style = status_presentation.get(event.status, {"badge": "text-bg-secondary", "label": "Unknown"}) %} - <li class="list-group-item"> - <div class="d-flex flex-wrap align-items-center gap-2 mb-1"> - <span class="badge {{ event_style.badge }}">{{ event_style.label }}</span> - <strong>{{ event.action }}</strong> - <time class="ms-auto text-body-secondary small" - datetime="{{ event.occurred_at.isoformat() }}">{{ event.occurred_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC</time> + <li class="list-group-item d-flex gap-2"> + <div class="flex-grow-1" style="min-width: 0;"> + <div class="d-flex flex-wrap align-items-center gap-2 mb-1"> + <span class="badge {{ event_style.badge }}">{{ event_style.label }}</span> + <strong>{{ event.action }}</strong> + <time class="ms-auto text-body-secondary small" + datetime="{{ event.occurred_at.isoformat() }}"> + {{ event.occurred_at.strftime("%Y-%m-%d %H:%M:%S") }} UTC + </time> + </div> + <div class="small text-body-secondary">Recovery attempts: {{ event.recovery_attempts }}</div> + {% if event.failure_reason %} + <div class="mt-2">{{ render_failure(event.failure_reason) }}</div> + {% endif %} </div> - <div class="small text-body-secondary">Recovery attempts: {{ event.recovery_attempts }}</div> - {% if event.failure_reason %} - <div class="mt-2 text-break text-pre-formatted">{{ event.failure_reason }}</div> - {% endif %} </li> {% endfor %} </ol> |
