65 lines
2.2 KiB
HTML
65 lines
2.2 KiB
HTML
{{define "validators_page"}}
|
|
<!doctype html>
|
|
<html lang="ru">
|
|
<head>{{template "html_head" .}}</head>
|
|
<body>
|
|
{{template "page_header" .}}
|
|
<main class="container-fluid py-3">
|
|
<div id="error-banner">{{template "banner_inner" .Banner}}</div>
|
|
{{template "validators_content" .}}
|
|
</main>
|
|
</body>
|
|
</html>
|
|
{{end}}
|
|
|
|
{{define "validators_content"}}
|
|
<h1>Валидаторы</h1>
|
|
|
|
<form class="card card-body mb-3 py-2" hx-post="/validators" hx-target="#validators-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-4">
|
|
<label class="form-label mb-1">validator_id</label>
|
|
<input type="text" name="validator_id" class="form-control form-control-sm" required>
|
|
</div>
|
|
<div class="col-12 col-md-4">
|
|
<label class="form-label mb-1">os_port_id</label>
|
|
<input type="text" name="os_port_id" class="form-control form-control-sm" placeholder="Neutron port ID">
|
|
</div>
|
|
<div class="col-12 col-md-4">
|
|
<button type="submit" class="btn btn-sm btn-primary w-100">Добавить</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<div id="validators-table-wrap">
|
|
{{template "validators_table" .}}
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "validators_table"}}
|
|
<div class="table-responsive">
|
|
<table class="table table-sm table-striped align-middle">
|
|
<thead><tr><th>ID</th><th>OS Port ID</th><th>Состояние</th><th>Действия</th></tr></thead>
|
|
<tbody>
|
|
{{range .Items}}
|
|
{{$b := validatorBadge .State}}
|
|
<tr>
|
|
<td>{{.ValidatorID}}</td>
|
|
<td>
|
|
<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}}" class="form-control form-control-sm">
|
|
<button type="submit" class="btn btn-sm btn-outline-secondary">Сохранить</button>
|
|
</form>
|
|
</td>
|
|
<td><span class="{{$b.Class}}">{{$b.Label}}</span></td>
|
|
<td class="actions-cell">
|
|
<button class="btn btn-sm btn-outline-danger" hx-delete="/validators/{{.ValidatorID}}" hx-target="#validators-table-wrap" hx-swap="innerHTML" hx-confirm="Удалить валидатор {{.ValidatorID}}?">Удалить</button>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{if not .Items}}<p class="muted">Валидаторов нет.</p>{{end}}
|
|
{{end}}
|