admin control features and admin dashboard

This commit is contained in:
ayurishchev committed 2026-08-23 20:39:22 +03:00
1 parent c630f13c57
commit 37910e410b
69 files changed
+4959 -400

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
{{define "ips_page"}}
<!doctype html>
<html lang="ru">
<head>{{template "html_head" .}}</head>
<body>
{{template "page_header" .}}
<main>
<div id="error-banner">{{template "banner_inner" .Banner}}</div>
{{template "ips_content" .}}
</main>
</body>
</html>
{{end}}
{{define "ips_content"}}
<h1>Очередь IP</h1>
<form hx-post="/ips" hx-target="#ips-table-wrap" hx-swap="innerHTML" hx-on::after-request="this.reset()">
<label for="addresses">Адреса (по одному на строку или через запятую)</label>
<textarea id="addresses" name="addresses" rows="3" placeholder="203.0.113.10&#10;203.0.113.11"></textarea>
<button type="submit">Добавить / принудительно перепроверить</button>
<p class="muted">Новый адрес встаёт в очередь; уже завершённый (done/failed) запускается заново
(тот же вызов); тот, что сейчас проверяется, не трогается.</p>
</form>
<div id="ips-table-wrap">
{{template "ips_table" .}}
</div>
{{end}}
{{define "ips_table"}}
<table role="grid">
<thead><tr><th>Адрес</th><th>Состояние</th><th>Валидатор</th><th>Попытка</th><th>Обновлено</th><th>Действия</th></tr></thead>
<tbody>
{{range .Items}}
{{$b := ipBadge .State .OverallResult}}
{{$terminal := or (eq .State "done") (eq .State "failed")}}
<tr>
<td><a href="/ips/{{.IPAddress}}">{{.IPAddress}}</a></td>
<td><span class="{{$b.Class}}">{{$b.Label}}</span></td>
<td>{{deref .OwnerValidatorID}}</td>
<td>{{.AttemptNumber}}</td>
<td>{{fmtTime .UpdatedAt}}</td>
<td class="actions-cell">
{{if $terminal}}
<button class="secondary" hx-post="/ips/{{.IPAddress}}/recheck" hx-target="#ips-table-wrap" hx-swap="innerHTML">Перепроверить</button>
{{else}}
<button class="contrast" hx-post="/ips/{{.IPAddress}}/cancel" hx-target="#ips-table-wrap" hx-swap="innerHTML" hx-confirm="Остановить проверку {{.IPAddress}}?">Отменить</button>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
{{if not .Items}}<p class="muted">Очередь пуста.</p>{{end}}
{{end}}