Files
cloud-ip-validator/internal/dashboard/templates/validators.html
T
2026-08-23 21:58:19 +03:00

77 lines
2.2 KiB
HTML

{{define "validators_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 "validators_content" .}}
</main>
</div>
</div>
</body>
</html>
{{end}}
{{define "validators_content"}}
<div class="topbar"><h1>Валидаторы</h1></div>
<div class="panel">
<div class="panel-body">
<form hx-post="/validators" hx-target="#validators-table-wrap" hx-swap="innerHTML" hx-on::after-request="this.reset()">
<div class="field-row">
<div class="field">
<label>validator_id</label>
<input type="text" name="validator_id" required>
</div>
<div class="field">
<label>os_port_id</label>
<input type="text" name="os_port_id" placeholder="Neutron port ID">
</div>
<button type="submit" class="btn btn-primary">Добавить</button>
</div>
</form>
</div>
</div>
<div id="validators-table-wrap">
{{template "validators_table" .}}
</div>
{{end}}
{{define "validators_table"}}
<div class="panel">
<div class="table-scroll">
<table>
<thead><tr><th>ID</th><th>OS Port ID</th><th>Состояние</th><th></th></tr></thead>
<tbody>
{{range .Items}}
{{$b := validatorBadge .State}}
<tr>
<td class="mono" data-label="ID">{{.ValidatorID}}</td>
<td data-label="OS Port ID">
<form class="inline-form" hx-put="/validators/{{.ValidatorID}}" hx-target="#validators-table-wrap" hx-swap="innerHTML">
<input type="text" name="os_port_id" value="{{.OSPortID}}">
<button type="submit" class="btn btn-ghost btn-sm">Сохранить</button>
</form>
</td>
<td data-label="Состояние"><span class="pill {{$b.Class}}">{{$b.Label}}</span></td>
<td data-label="">
<div class="actions">
<button class="btn btn-danger-ghost btn-sm" hx-delete="/validators/{{.ValidatorID}}" hx-target="#validators-table-wrap" hx-swap="innerHTML" hx-confirm="Удалить валидатор {{.ValidatorID}}?">Удалить</button>
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{if not .Items}}<p class="muted">Валидаторов нет.</p>{{end}}
{{end}}