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

63 lines
2.4 KiB
HTML
Raw Normal View History

2026-08-23 20:39:22 +03:00
{{define "targets_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 "targets_content" .}}
</main>
</body>
</html>
{{end}}
{{define "targets_content"}}
<h1>Цели проверки</h1>
<p class="muted">Группа целей — именованный список URL/адресов, на который затем ссылаются типы проверок.</p>
2026-08-23 21:15:31 +03:00
<form class="card card-body mb-3 py-2" hx-post="/targets" hx-target="#targets-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-3">
<label class="form-label mb-1">Имя новой группы</label>
<input type="text" name="name" class="form-control form-control-sm" placeholder="web" required>
</div>
<div class="col-12 col-md-7">
<label class="form-label mb-1">Цели (по одной на строку или через запятую)</label>
<textarea name="targets" class="form-control form-control-sm" rows="2" placeholder="https://hub.docker.com&#10;https://github.com" required></textarea>
</div>
<div class="col-12 col-md-2">
<button type="submit" class="btn btn-sm btn-primary w-100">Создать</button>
</div>
</div>
2026-08-23 20:39:22 +03:00
</form>
<div id="targets-table-wrap">
{{template "targets_table" .}}
</div>
{{end}}
{{define "targets_table"}}
2026-08-23 21:15:31 +03:00
<div class="table-responsive">
<table class="table table-sm table-striped align-middle">
2026-08-23 20:39:22 +03:00
<thead><tr><th>Группа</th><th>Цели</th><th>Действия</th></tr></thead>
<tbody>
{{range .Items}}
<tr>
2026-08-23 21:15:31 +03:00
<td class="text-nowrap">{{.Name}}</td>
2026-08-23 20:39:22 +03:00
<td>
2026-08-23 21:15:31 +03:00
<form class="inline-form" hx-put="/targets/{{.Name}}" hx-target="#targets-table-wrap" hx-swap="innerHTML">
<textarea name="targets" class="form-control form-control-sm" rows="2">{{join .Targets "\n"}}</textarea>
<button type="submit" class="btn btn-sm btn-outline-secondary text-nowrap">Сохранить</button>
2026-08-23 20:39:22 +03:00
</form>
</td>
<td class="actions-cell">
2026-08-23 21:15:31 +03:00
<button class="btn btn-sm btn-outline-danger" hx-delete="/targets/{{.Name}}" hx-target="#targets-table-wrap" hx-swap="innerHTML" hx-confirm="Удалить группу {{.Name}}?">Удалить</button>
2026-08-23 20:39:22 +03:00
</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}}