aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates/sent_source.html
blob: 8e5932c251e7ff6c8d72d16e4a2d5c873ed54edc (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
{% extends "base.html" %}
{% 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 | length }} webmentions</span>
  </div>
  {% if webmentions %}
    <div class="table-responsive">
      <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">Active</th>
            <th scope="col">Desired revision</th>
            <th scope="col">Processed revision</th>
            <th scope="col">Sent revision</th>
            <th scope="col">Failure Reason</th>
            <th scope="col">Endpoint</th>
            <th scope="col">Response Status</th>
            <th scope="col">Status URL</th>
            <th scope="col">Last attempted at</th>
            <th scope="col">Last sent at</th>
          </tr>
        </thead>
        <tbody>
          {% for webmention in webmentions %}
            {% if 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 not none %}
                  <span class="badge {{ badge_class }}">{{ webmention.status.value.title() }}</span>
                {% 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>{{ webmention.desired_revision }}</td>
              <td>
                {{ webmention.processed_revision
                  if webmention.processed_revision is not none
                  else "—" }}
              </td>
              <td>
                {{ webmention.sent_revision
                  if webmention.sent_revision is not none
                  else "—" }}
              </td>
              <td>
                {{ webmention.failure_reason
                  if webmention.failure_reason is not none
                  else "—" }}
              </td>
              <td class="text-break">
                {% if webmention.endpoint is not none %}
                  <a href="{{ webmention.endpoint }}">{{ webmention.endpoint }}</a>
                {% else %}
                  —
                {% endif %}
              </td>
              <td>
                {{ webmention.response_status
                  if webmention.response_status is not none
                  else "—" }}
              </td>
              <td class="text-break">
                {% if webmention.status_url is not none %}
                  <a href="{{ webmention.status_url }}">{{ webmention.status_url }}</a>
                {% else %}
                  —
                {% endif %}
              </td>
              <td>
                {% 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 %}
              </td>
              <td>
                {% 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 %}
              </td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% else %}
    <p class="text-body-secondary">No Webmentions have been discovered for this source.</p>
  {% endif %}
{% endblock %}