blob: a44b70635ff2bad48d32e554efe8f5a4ce40396e (
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
|
{% extends "base.html" %}
{% from "bootstrap5/form.html" import render_form %}
{% from "bootstrap5/pagination.html" import render_pagination %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-3">
<h1 class="mb-0">Received Webmentions</h1>
<span class="text-body-secondary">{{ webmentions.total }} total</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">Source</th>
<th scope="col">Target</th>
<th scope="col">Received</th>
<th scope="col">Updated</th>
<th scope="col">Reason</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for webmention in webmentions %}
{% if webmention.status == "received" %}
{% set row_class = "table-info" %}
{% set display_status = "Pending" %}
{% elif webmention.status == "verifying" %}
{% set row_class = "table-warning" %}
{% set display_status = "Verifying" %}
{% elif webmention.status == "verified" %}
{% set row_class = "table-success" %}
{% set display_status = "Verified" %}
{% else %}
{% set row_class = "table-danger" %}
{% set display_status = "Declined" %}
{% endif %}
<tr class="{{ row_class }}">
<td>
<strong>{{ display_status }}</strong>
</td>
<td class="text-break">
<a href="{{ webmention.source }}">{{ webmention.source }}</a>
</td>
<td class="text-break">
<a href="{{ webmention.target }}">{{ webmention.target }}</a>
</td>
<td class="text-nowrap">
<time datetime="{{ webmention.created_at.isoformat() }}">
{{ webmention.created_at.strftime("%Y-%m-%d %H:%M:%S") }}
</time>
</td>
<td class="text-nowrap">
<time datetime="{{ webmention.updated_at.isoformat() }}">
{{ webmention.updated_at.strftime("%Y-%m-%d %H:%M:%S") }}
</time>
</td>
<td>{{ webmention.failure_reason or "—" }}</td>
<td class="text-nowrap">
<button type="button"
class="btn btn-sm btn-primary"
data-bs-toggle="modal"
data-bs-target="#confirmation-modal"
data-action="{{ url_for('root.reverify_received_webmention', identifier=webmention.uuid, page=webmentions.page) }}"
data-title="Reverify webmention?"
data-message="The webmention will be fetched and verified again."
data-confirm-label="Reverify"
data-confirm-class="btn-primary">Reverify</button>
<button type="button"
class="btn btn-sm btn-danger"
data-bs-toggle="modal"
data-bs-target="#confirmation-modal"
data-action="{{ url_for('root.delete_received_webmention', identifier=webmention.uuid, page=webmentions.page) }}"
data-title="Delete webmention?"
data-message="This permanently deletes the webmention and cannot be undone."
data-confirm-label="Delete"
data-confirm-class="btn-danger">Delete</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if webmentions.pages > 1 %}
<div class="mt-3">{{ render_pagination(webmentions) }}</div>
{% endif %}
<div class="modal fade"
id="confirmation-modal"
tabindex="-1"
aria-labelledby="confirmation-modal-title"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="confirmation-modal-title"></h1>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<p id="confirmation-modal-message" class="mb-0"></p>
</div>
<div class="modal-footer">
{{ render_form(action_form,
id="confirmation-modal-form",
button_style="primary",
form_group_classes="mb-0") }}
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
{% else %}
<p class="text-body-secondary">No Webmentions have been received yet.</p>
{% endif %}
{% endblock %}
{% block scripts %}
{{ super() }}
<script>
const confirmationModal = document.getElementById(
"confirmation-modal"
);
confirmationModal.addEventListener("show.bs.modal", (event) => {
const button = event.relatedTarget;
const form = confirmationModal.querySelector(
"#confirmation-modal-form"
);
const title = confirmationModal.querySelector(
"#confirmation-modal-title"
);
const message = confirmationModal.querySelector(
"#confirmation-modal-message"
);
const submit = form.querySelector("#submit");
form.action = button.dataset.action;
title.textContent = button.dataset.title;
message.textContent = button.dataset.message;
submit.value = button.dataset.confirmLabel;
submit.className = `btn ${button.dataset.confirmClass}`;
});
</script>
{% endblock %}
|