aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates/sent_source.html
blob: db8f89839078ba4b87ec63ebecef3effadab9cfd (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
202
203
204
205
206
207
208
209
210
211
<!--
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 %}
{% block content %}
  <div class="mb-3">
    <a href="{{ url_for("root.sent") }}">&larr; Back to sources</a>
  </div>
  <div class="d-flex justify-content-between align-items-start mb-3">
    <h1 class="mb-0">Source Details</h1>
  </div>
  <div class="d-flex justify-content-between align-items-start mb-3">
    <dl class="row">
      <dt class="col-sm-2">UUID</dt>
      <dd class="col-sm-4">
        {{ source.uuid }}
      </dd>
      <dt class="col-sm-2">Hash</dt>
      <dd class="col-sm-4">
        {{ source.content_hash }}
      </dd>
      <dt class="col-sm-2">Path</dt>
      <dd class="col-sm-4">
        {{ source.path }}
      </dd>
      <dt class="col-sm-2">URL</dt>
      <dd class="col-sm-4">
        <a href="{{ source.url }}" class="text-break">{{ source.url }}</a>
      </dd>
      <dt class="col-sm-2">Created at</dt>
      <dd class="col-sm-4">
        <time datetime="{{ source.created_at.isoformat() }}">
          {{ source.created_at.strftime("%Y-%m-%d %H:%M:%S") }}
        </time>
      </dd>
      <dt class="col-sm-2">Last seen at</dt>
      <dd class="col-sm-4">
        <time datetime="{{ source.last_seen_at.isoformat() }}">
          {{ source.last_seen_at.strftime("%Y-%m-%d %H:%M:%S") }}
        </time>
      </dd>
      <dt class="col-sm-2">Revised at</dt>
      <dd class="col-sm-4">
        <time datetime="{{ source.revised_at.isoformat() }}">
          {{ source.revised_at.strftime("%Y-%m-%d %H:%M:%S") }}
        </time>
      </dd>
      <dt class="col-sm-2">Deleted at</dt>
      <dd class="col-sm-4">
        {% if source.deleted_at is none %}
          N/A
        {% else %}
          <time datetime="{{ source.deleted_at.isoformat() }}">
            {{ source.deleted_at.strftime("%Y-%m-%d %H:%M:%S") }}
          </time>
        {% endif %}
      </dd>
      <dt class="col-sm-2">Revision</dt>
      <dd class="col-sm-4">
        {{ source.revision }}
      </dd>
    </dl>
  </div>
  <div class="d-flex justify-content-between align-items-start mb-3">
    <h2 class="mb-0">Sent Webmentions</h2>
    <span class="text-body-secondary">{{ webmentions.item | length }} webmentions</span>
  </div>
  {% if webmentions.items %}
    <table class="table table-bordered table-striped table-hover align-middle">
      <thead>
        <tr>
          <th scope="col" class="w-25">Target</th>
          <th scope="col">Status</th>
          <th scope="col">Active</th>
          <th scope="col">Revisions</th>
          <th scope="col">Delivery</th>
          <th scope="col">Last activity</th>
          <th scope="col">Actions</th>
        </tr>
      </thead>
      <tbody>
        {% for webmention in webmentions %}
          {% if webmention.status is none %}
            {% set row_class = "table-info" %}
            {% set badge_class = "text-bg-info" %}
          {% elif webmention.status.value == "sent" %}
            {% set row_class = "table-success" %}
            {% set badge_class = "text-bg-success" %}
          {% elif webmention.status.value == "unsupported" %}
            {% set row_class = "table-warning" %}
            {% set badge_class = "text-bg-warning" %}
          {% elif webmention.status.value == "failed" %}
            {% set row_class = "table-danger" %}
            {% set badge_class = "text-bg-danger" %}
          {% else %}
            {% set row_class = "table-info" %}
            {% set badge_class = "text-bg-info" %}
          {% endif %}
          <tr class="{{ row_class }}">
            <td class="text-break">
              <a href="{{ webmention.target }}">{{ webmention.target }}</a>
            </td>
            <td>
              {% if webmention.status is none %}
                <span class="badge {{ badge_class }}">Pending</span>
              {% else %}
                <span class="badge {{ badge_class }}">{{ webmention.status.value.title() }}</span>
              {% endif %}
              {% if webmention.failure_reason is not none %}
                <div class="small mt-2">{{ webmention.failure_reason }}</div>
              {% endif %}
            </td>
            <td>
              {% if webmention.active %}
                <span class="badge text-bg-success">Active</span>
              {% else %}
                <span class="badge text-bg-danger">Removed</span>
              {% endif %}
            </td>
            <td class="small text-nowrap">
              <div>
                <strong>Desired:</strong>
                {{ webmention.desired_revision }}
              </div>
              <div>
                <strong>Processed:</strong>
                {{ webmention.processed_revision
                  if webmention.processed_revision is not none
                  else "—" }}
              </div>
              <div>
                <strong>Sent:</strong>
                {{ webmention.sent_revision
                  if webmention.sent_revision is not none
                  else "—" }}
              </div>
            </td>
            <td class="small">
              {% if webmention.endpoint is not none %}
                <div class="mb-1">
                  <strong>Endpoint:</strong>
                  <a href="{{ webmention.endpoint }}" class="text-break">{{ webmention.endpoint }}</a>
                </div>
              {% endif %}
              {% if webmention.response_status is not none %}
                <div class="mb-1">
                  <strong>HTTP:</strong>
                  {{ webmention.response_status }}
                </div>
              {% endif %}
              {% if webmention.status_url is not none %}
                <div>
                  <strong>Status:</strong>
                  <a href="{{ webmention.status_url }}" class="text-break">{{ webmention.status_url }}</a>
                </div>
              {% endif %}
            </td>
            <td class="small text-nowrap">
              <div class="mb-1">
                <strong>Attempted:</strong>
                <br>
                {% if webmention.last_attempted_at is not none %}
                  <time datetime="{{ webmention.last_attempted_at.isoformat() }}">
                    {{ webmention.last_attempted_at.strftime("%Y-%m-%d %H:%M:%S") }}
                  </time>
                {% else %}
                  —
                {% endif %}
              </div>
              <div>
                <strong>Sent:</strong>
                <br>
                {% if webmention.last_sent_at is not none %}
                  <time datetime="{{ webmention.last_sent_at.isoformat() }}">
                    {{ webmention.last_sent_at.strftime("%Y-%m-%d %H:%M:%S") }}
                  </time>
                {% else %}
                  —
                {% endif %}
              </div>
            </td>
            <td>
              <button type="button"
                      class="btn btn-sm btn-primary"
                      data-bs-toggle="modal"
                      data-bs-target="#confirmation-modal"
                      data-action="{{ url_for("root.resend_sent_webmention", source_identifier=source.uuid, webmention_identifier=webmention.uuid) }}"
                      data-title="Resend Webmention?"
                      data-message="This Webmention will be queued again for delivery to {{ webmention.target }}."
                      data-confirm-label="Resend"
                      data-confirm-class="btn-primary">Resend</button>
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
    {% if webmentions.pages > 1 %}
      <div class="mt-3">{{ render_pagination(webmentions) }}</div>
    {% endif %}
    {% include "includes/confirmation_modal.html" %}
  {% else %}
    <p class="text-body-secondary">No Webmentions have been discovered for this source.</p>
  {% endif %}
{% endblock %}
{% block scripts %}
  {{ super() }}
  <script src="{{ url_for('static', filename='js/confirmation-modal.js') }}"></script>
{% endblock %}