aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates/sent_source.html
blob: d3da4eac49a4671c92ecf6fa135b3252d9bc864f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!--
SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>

SPDX-License-Identifier: BSD-3-Clause
-->
{% extends "base.html" %}

{% from "bootstrap5/pagination.html" import render_pagination %}
{% set sent_status_presentation = {
  "sent": {
    "badge_class": "text-bg-success",
    "label": "Sent"
  },
  "no_endpoint": {
    "badge_class": "text-bg-warning",
    "label": "Unsupported"
  },
  "failed": {
    "badge_class": "text-bg-danger",
    "label": "Failed"
  }
} %}

{% block content %}
  <div class="mb-3">
    <a href="{{ url_for('webmentions.sent_list', page=source_page, **filters) }}">← Back to Sent Webmentions</a>
  </div>
  <div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mb-4">
    <h1 class="mb-0">Sent Webmention Source</h1>
    {% if source.deleted_at is none %}
      <span class="badge fs-6 text-bg-success">Active</span>
    {% else %}
      <span class="badge fs-6 text-bg-danger">Deleted</span>
    {% endif %}
  </div>
  <section class="card mb-4" aria-labelledby="source-details-heading">
    <div class="card-body">
      <h2 class="h4 card-title mb-3" id="source-details-heading">Source details</h2>
      <dl class="row mb-0">
        <dt class="col-md-3">Path</dt>
        <dd class="col-md-9 text-break">
          {{ source.path }}
        </dd>
        <dt class="col-md-3">URL</dt>
        <dd class="col-md-9 text-break">
          <a href="{{ source.url }}">{{ source.url }}</a>
        </dd>
        <dt class="col-md-3">Revision</dt>
        <dd class="col-md-9">
          {{ source.revision }}
        </dd>
        <dt class="col-md-3">Created</dt>
        <dd class="col-md-9">
          <time datetime="{{ source.created_at | utc_isoformat }}"
                title="{{ source.created_at | utc_timestamp }}">{{ source.created_at | relative_time }}</time>
        </dd>
        <dt class="col-md-3">Last seen</dt>
        <dd class="col-md-9">
          <time datetime="{{ source.last_seen_at | utc_isoformat }}"
                title="{{ source.last_seen_at | utc_timestamp }}">{{ source.last_seen_at | relative_time }}</time>
        </dd>
        <dt class="col-md-3">Last revised</dt>
        <dd class="col-md-9">
          <time datetime="{{ source.revised_at | utc_isoformat }}"
                title="{{ source.revised_at | utc_timestamp }}">{{ source.revised_at | relative_time }}</time>
        </dd>
        {% if source.deleted_at is not none %}
          <dt class="col-md-3">Deleted</dt>
          <dd class="col-md-9">
            <time datetime="{{ source.deleted_at | utc_isoformat }}"
                  title="{{ source.deleted_at | utc_timestamp }}">{{ source.deleted_at | relative_time }}</time>
          </dd>
        {% endif %}
        <dt class="col-md-3">Source ID</dt>
        <dd class="col-md-9">
          <code class="text-break">{{ source.uuid }}</code>
        </dd>
        <dt class="col-md-3">Content hash</dt>
        <dd class="col-md-9">
          <code class="text-break">{{ source.content_hash }}</code>
        </dd>
      </dl>
    </div>
  </section>
  <div class="d-flex flex-wrap gap-2 mb-4" aria-label="Source actions">
    <button type="button"
            class="btn btn-sm btn-danger"
            data-bs-toggle="modal"
            data-bs-target="#confirmation-modal"
            data-action="{{ url_for('webmentions.resend_failed_source_webmentions', source_uuid=source.uuid, source_page=source_page, page=webmentions.page, history_page=history.page, **filters) }}"
            data-title="Resend all failed webmentions for this source?"
            data-message="Only failed Webmentions belonging to this source will be queued again, including failed targets on other pages. Successful, unsupported, and pending Webmentions will not be resent."
            data-confirm-label="Resend all failed"
            data-confirm-class="btn-danger">Resend all failed</button>
    <button type="button"
            class="btn btn-sm btn-primary"
            data-bs-toggle="modal"
            data-bs-target="#confirmation-modal"
            data-action="{{ url_for('webmentions.resend_all_source_webmentions', source_uuid=source.uuid, source_page=source_page, page=webmentions.page, history_page=history.page, **filters) }}"
            data-title="Resend all webmentions for this source?"
            data-message="Every outgoing Webmention for this source will be queued again, including successful sends and mentions on other pages."
            data-confirm-label="Resend all"
            data-confirm-class="btn-primary">Resend all</button>
  </div>
  <section aria-labelledby="sent-webmentions-heading" class="mb-4">
    <div class="d-flex justify-content-between align-items-center gap-2 mb-3">
      <h2 class="h4 mb-0" id="sent-webmentions-heading">Sent Webmentions</h2>
      <span class="text-body-secondary">{{ webmentions.total }} targets</span>
    </div>
    {% if webmentions.items %}
      <div class="table-responsive">
        <table class="table table-bordered table-striped table-hover align-middle">
          <thead>
            <tr>
              <th scope="col">Status</th>
              <th scope="col">Target</th>
              <th scope="col" class="d-none d-md-table-cell">Link</th>
              <th scope="col" class="d-none d-md-table-cell">Last attempt</th>
              <th scope="col">Details</th>
            </tr>
          </thead>
          <tbody>
            {% for webmention in webmentions %}
              {% set style = sent_status_presentation.get(webmention.status, {"badge_class": "text-bg-info", "label": "Pending"}) %}
              <tr>
                <td><span class="badge {{ style.badge_class }}">{{ style.label }}</span></td>
                <td class="text-break"><a href="{{ webmention.target }}">{{ webmention.target }}</a></td>
                <td class="d-none d-md-table-cell">
                  {% if webmention.linked %}
                    <span class="badge text-bg-success">Linked</span>
                  {% else %}
                    <span class="badge text-bg-secondary">Removed</span>
                  {% endif %}
                </td>
                <td class="text-nowrap d-none d-md-table-cell">
                  {% if webmention.last_attempted_at is not none %}
                    <time datetime="{{ webmention.last_attempted_at | utc_isoformat }}"
                          title="{{ webmention.last_attempted_at | utc_timestamp }}">{{ webmention.last_attempted_at | relative_time }}</time>
                  {% else %}
                    —
                  {% endif %}
                </td>
                <td>
                  <a class="btn btn-sm btn-primary"
                     href="{{ url_for('webmentions.sent_webmention_detail', source_uuid=source.uuid, webmention_uuid=webmention.uuid, source_page=source_page, page=webmentions.page, **filters) }}"
                     aria-label="Details for Webmention to {{ webmention.target }}">Details</a>
                </td>
              </tr>
            {% endfor %}
          </tbody>
        </table>
      </div>
      {% if webmentions.pages > 1 %}
        <div class="mt-3">{{ render_pagination(webmentions, args=dict(filters, source_page=source_page, history_page=history.page)) }}</div>
      {% endif %}
    {% else %}
      <p class="text-body-secondary">No Webmentions have been discovered for this source.</p>
    {% endif %}
  </section>
  <section aria-labelledby="source-history-heading">
    <h2 class="h4 mb-3" id="source-history-heading">Source history</h2>
    {% if history.items %}
      <ol class="list-group mb-3">
        {% for event in history.items %}
          <li class="list-group-item">
            <div class="d-flex flex-wrap align-items-center gap-2">
              <strong>{{ event.action }}</strong>
              <span class="text-body-secondary small">Revision {{ event.revision }}</span>
              <time class="ms-auto text-body-secondary small"
                    datetime="{{ event.occurred_at | utc_isoformat }}"
                    title="{{ event.occurred_at | utc_timestamp }}">{{ event.occurred_at | relative_time }}</time>
            </div>
          </li>
        {% endfor %}
      </ol>
      {% if history.pages > 1 %}
        <div class="mt-3">
          {{ render_pagination(
            history,
            endpoint='webmentions.sent_source_history_pagination',
            args=dict(
              filters,
              source_uuid=source.uuid,
              source_page=source_page if source_page > 1 else none,
              webmentions_page=webmentions.page if webmentions.page > 1 else none
            ),
            fragment='source-history-heading'
          ) }}
        </div>
      {% endif %}
    {% else %}
      <p class="text-body-secondary">No source lifecycle events have been recorded yet. Delivery history is available on each Webmention's detail page.</p>
    {% endif %}
  </section>
  {% include "includes/confirmation_modal.html" %}
{% endblock %}

{% block scripts %}
  {{ super() }}
  <script src="{{ url_for('static', filename='js/confirmation-modal.js') }}"></script>
{% endblock %}