use bootstrap 5 for UI, compact UI

This commit is contained in:
ayurishchev committed 2026-08-23 21:15:31 +03:00
1 parent 37910e410b
commit ee2a29cb36
18 files changed
+284 -161

No files matched your search

+21 -11
View File
@@ -4,7 +4,7 @@
<head>{{template "html_head" .}}</head>
<body>
{{template "page_header" .}}
<main>
<main class="container-fluid py-3">
<div id="error-banner">{{template "banner_inner" .Banner}}</div>
{{template "validators_content" .}}
</main>
@@ -15,11 +15,19 @@
{{define "validators_content"}}
<h1>Валидаторы</h1>
<form hx-post="/validators" hx-target="#validators-table-wrap" hx-swap="innerHTML" hx-on::after-request="this.reset()">
<div class="grid">
<input type="text" name="validator_id" placeholder="validator_id" required>
<input type="text" name="os_port_id" placeholder="os_port_id (Neutron port ID)" required>
<button type="submit">Добавить</button>
<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>
@@ -29,7 +37,8 @@
{{end}}
{{define "validators_table"}}
<table role="grid">
<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}}
@@ -37,18 +46,19 @@
<tr>
<td>{{.ValidatorID}}</td>
<td>
<form hx-put="/validators/{{.ValidatorID}}" hx-target="#validators-table-wrap" hx-swap="innerHTML" style="display:flex;gap:.5rem;margin:0">
<input type="text" name="os_port_id" value="{{.OSPortID}}" style="margin:0">
<button type="submit" class="secondary" style="margin:0">Сохранить</button>
<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="contrast" hx-delete="/validators/{{.ValidatorID}}" hx-target="#validators-table-wrap" hx-swap="innerHTML" hx-confirm="Удалить валидатор {{.ValidatorID}}?">Удалить</button>
<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}}