Both pages rendered their full lists with no way to narrow them. Adds a ?q=&status= filter (substring match on address, exact match on result status) applied dashboard-side, in Go, over the already-fetched list — no control-api/db changes needed. Overview: the filter form lives outside the polling target (#overview-live) so the recurring poll never wipes out what's typed/selected; the poll and both filter inputs share hx-sync="#overview-live:queue last" (the same fix that resolved the earlier abandoned /ips auto-refresh races) and the poll now carries hx-include="#overview-filter" so it keeps honoring the current filter on every tick. Applies uniformly to both the "Текущая проверка" and "Последние N завершённых" tables, per the confirmed design: picking a specific status naturally hides in-progress rows, since they have no result yet. Registry: no polling exists there, so the filter form reuses the full page via hx-select/hx-replace-url — simpler than adding a parallel fragment endpoint, and gives a bookmarkable/shareable filtered URL. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
59 lines
2.3 KiB
HTML
59 lines
2.3 KiB
HTML
{{define "overview_page"}}
|
|
<!doctype html>
|
|
<html lang="ru">
|
|
<head>{{template "html_head" .}}</head>
|
|
<body>
|
|
<div class="bg-grid"></div>
|
|
<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 "overview_content" .}}
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
{{end}}
|
|
|
|
{{define "overview_content"}}
|
|
<div class="topbar">
|
|
<h1>Обзор</h1>
|
|
</div>
|
|
|
|
<form id="overview-filter" class="panel" onsubmit="return false">
|
|
<div class="panel-body field-row">
|
|
<div class="field" style="flex:1 1 260px">
|
|
<label for="overview-q">Поиск по IP</label>
|
|
<input type="search" id="overview-q" name="q" value="{{.Query}}" placeholder="203.0.113.10"
|
|
hx-get="/overview/fragment" hx-target="#overview-live" hx-swap="innerHTML"
|
|
hx-include="#overview-filter" hx-trigger="input changed delay:300ms"
|
|
hx-sync="#overview-live:queue last">
|
|
</div>
|
|
<div class="field">
|
|
<label for="overview-status">Статус</label>
|
|
<select id="overview-status" name="status"
|
|
hx-get="/overview/fragment" hx-target="#overview-live" hx-swap="innerHTML"
|
|
hx-include="#overview-filter" hx-trigger="change" hx-sync="#overview-live:queue last">
|
|
<option value="">Все</option>
|
|
<option value="pass" {{if eq .StatusFilter "pass"}}selected{{end}}>pass</option>
|
|
<option value="partial" {{if eq .StatusFilter "partial"}}selected{{end}}>partial</option>
|
|
<option value="fail" {{if eq .StatusFilter "fail"}}selected{{end}}>fail</option>
|
|
<option value="cancelled" {{if eq .StatusFilter "cancelled"}}selected{{end}}>cancelled</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<p class="muted" style="padding:0 16px 12px">Действует на обе таблицы ниже. Фильтр по статусу — это фильтр по
|
|
итоговому результату, поэтому при выборе конкретного статуса строки «Текущей проверки» (у неё ещё нет результата)
|
|
не показываются.</p>
|
|
</form>
|
|
|
|
<div id="overview-live" hx-get="/overview/fragment" hx-trigger="every {{.PollSeconds}}s"
|
|
hx-include="#overview-filter" hx-sync="#overview-live:queue last" hx-swap="innerHTML">
|
|
{{template "overview_fragment" .}}
|
|
</div>
|
|
{{end}}
|