76 lines
2.4 KiB
HTML
76 lines
2.4 KiB
HTML
{{define "targets_page"}}
|
|
<!doctype html>
|
|
<html lang="ru">
|
|
<head>{{template "html_head" .}}</head>
|
|
<body>
|
|
<input type="checkbox" id="nav-toggle" class="nav-toggle">
|
|
<div class="shell">
|
|
{{template "sidebar_nav" .}}
|
|
<div>
|
|
{{template "topbar_mobile" .}}
|
|
<main class="main">
|
|
<div id="error-banner">{{template "banner_inner" .Banner}}</div>
|
|
{{template "targets_content" .}}
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
{{end}}
|
|
|
|
{{define "targets_content"}}
|
|
<div class="topbar"><h1>Цели проверки</h1></div>
|
|
<p class="muted" style="margin-bottom:16px">Группа целей — именованный список URL/адресов, на который затем ссылаются типы проверок.</p>
|
|
|
|
<div class="panel">
|
|
<div class="panel-body">
|
|
<form hx-post="/targets" hx-target="#targets-table-wrap" hx-swap="innerHTML" hx-on::after-request="this.reset()">
|
|
<div class="field-row">
|
|
<div class="field" style="flex: 0 1 200px;">
|
|
<label>Имя новой группы</label>
|
|
<input type="text" name="name" placeholder="web" required>
|
|
</div>
|
|
<div class="field" style="flex: 1 1 380px;">
|
|
<label>Цели (по одной на строку или через запятую)</label>
|
|
<textarea name="targets" rows="2" placeholder="https://hub.docker.com https://github.com" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Создать</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="targets-table-wrap">
|
|
{{template "targets_table" .}}
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "targets_table"}}
|
|
<div class="panel">
|
|
<div class="table-scroll">
|
|
<table>
|
|
<thead><tr><th>Группа</th><th>Цели</th><th></th></tr></thead>
|
|
<tbody>
|
|
{{range .Items}}
|
|
<tr>
|
|
<td class="mono" data-label="Группа">{{.Name}}</td>
|
|
<td data-label="Цели">
|
|
<form class="inline-form" hx-put="/targets/{{.Name}}" hx-target="#targets-table-wrap" hx-swap="innerHTML">
|
|
<textarea name="targets" rows="2">{{join .Targets "\n"}}</textarea>
|
|
<button type="submit" class="btn btn-ghost btn-sm">Сохранить</button>
|
|
</form>
|
|
</td>
|
|
<td data-label="">
|
|
<div class="actions">
|
|
<button class="btn btn-danger-ghost btn-sm" hx-delete="/targets/{{.Name}}" hx-target="#targets-table-wrap" hx-swap="innerHTML" hx-confirm="Удалить группу {{.Name}}?">Удалить</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{{if not .Items}}<p class="muted">Групп целей нет.</p>{{end}}
|
|
{{end}}
|