Files
cloud-ip-validator/internal/dashboard/templates/ips.html
T

64 lines
2.5 KiB
HTML
Raw Normal View History

2026-08-23 20:39:22 +03:00
{{define "ips_page"}}
<!doctype html>
<html lang="ru">
<head>{{template "html_head" .}}</head>
<body>
{{template "page_header" .}}
2026-08-23 21:15:31 +03:00
<main class="container-fluid py-3">
2026-08-23 20:39:22 +03:00
<div id="error-banner">{{template "banner_inner" .Banner}}</div>
{{template "ips_content" .}}
</main>
</body>
</html>
{{end}}
{{define "ips_content"}}
<h1>Очередь IP</h1>
2026-08-23 21:15:31 +03:00
<form class="card card-body mb-3 py-2" hx-post="/ips" hx-target="#ips-table-wrap" hx-swap="innerHTML" hx-on::after-request="this.reset()">
<div class="row g-2 align-items-end">
<div class="col-12 col-md-9">
<label for="addresses" class="form-label mb-1">Адреса (по одному на строку или через запятую)</label>
<textarea id="addresses" name="addresses" class="form-control form-control-sm" rows="2" placeholder="203.0.113.10&#10;203.0.113.11"></textarea>
</div>
<div class="col-12 col-md-3">
<button type="submit" class="btn btn-sm btn-primary w-100">Добавить / перепроверить</button>
</div>
</div>
<p class="muted mt-2 mb-0">Новый адрес встаёт в очередь; уже завершённый (done/failed) запускается заново
2026-08-23 20:39:22 +03:00
(тот же вызов); тот, что сейчас проверяется, не трогается.</p>
</form>
<div id="ips-table-wrap">
{{template "ips_table" .}}
</div>
{{end}}
{{define "ips_table"}}
2026-08-23 21:15:31 +03:00
<div class="table-responsive">
<table class="table table-sm table-striped table-hover align-middle">
2026-08-23 20:39:22 +03:00
<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}}
2026-08-23 21:15:31 +03:00
<button class="btn btn-sm btn-outline-secondary" hx-post="/ips/{{.IPAddress}}/recheck" hx-target="#ips-table-wrap" hx-swap="innerHTML">Перепроверить</button>
2026-08-23 20:39:22 +03:00
{{else}}
2026-08-23 21:15:31 +03:00
<button class="btn btn-sm btn-outline-danger" hx-post="/ips/{{.IPAddress}}/cancel" hx-target="#ips-table-wrap" hx-swap="innerHTML" hx-confirm="Остановить проверку {{.IPAddress}}?">Отменить</button>
2026-08-23 20:39:22 +03:00
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
2026-08-23 21:15:31 +03:00
</div>
2026-08-23 20:39:22 +03:00
{{if not .Items}}<p class="muted">Очередь пуста.</p>{{end}}
{{end}}