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>
66 lines
2.7 KiB
HTML
66 lines
2.7 KiB
HTML
{{define "overview_fragment"}}
|
|
<div class="stat-grid">
|
|
<div class="stat-card accented"><span class="value">{{.Status.TotalIPs}}</span><span class="label">всего IP</span></div>
|
|
<div class="stat-card"><span class="value">{{.Status.TotalValidators}}</span><span class="label">валидаторов</span></div>
|
|
{{range $state, $count := .Status.IPsByState}}
|
|
<div class="stat-card{{if eq $state "failed"}} bad{{else if eq $state "checking"}} accented{{end}}"><span class="value">{{$count}}</span><span class="label">{{$state}}</span></div>
|
|
{{end}}
|
|
</div>
|
|
|
|
<h2 class="section-title">Текущая проверка</h2>
|
|
{{if .CurrentItems}}
|
|
<div class="panel">
|
|
<div class="table-scroll">
|
|
<table>
|
|
<thead><tr><th>Адрес</th><th>Состояние</th><th>Валидатор</th><th>Попытка</th><th>Назначено</th></tr></thead>
|
|
<tbody>
|
|
{{range .CurrentItems}}
|
|
{{$b := ipBadge .State .OverallResult .FIPAssociatedAt 0}}
|
|
<tr>
|
|
<td class="addr" data-label="Адрес"><a href="/ips/{{.IPAddress}}">{{.IPAddress}}</a></td>
|
|
<td data-label="Состояние"><span class="pill {{$b.Class}}">{{$b.Label}}</span></td>
|
|
<td data-label="Валидатор">{{deref .OwnerValidatorID}}</td>
|
|
<td class="num" data-label="Попытка">{{.AttemptNumber}}</td>
|
|
<td class="num" data-label="Назначено">{{fmtTime .AssignedAt}}</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
{{if or .Query .StatusFilter}}<p class="muted">Ничего не найдено по текущему фильтру.</p>
|
|
{{else}}<p class="muted">Сейчас нет адресов в обработке.</p>{{end}}
|
|
{{end}}
|
|
|
|
<h2 class="section-title">Последние {{.LastN}} завершённых</h2>
|
|
<div class="breakdown">
|
|
<span>pass <b>{{index .Breakdown "pass"}}</b></span>
|
|
<span>partial <b>{{index .Breakdown "partial"}}</b></span>
|
|
<span>fail <b>{{index .Breakdown "fail"}}</b></span>
|
|
<span>cancelled <b>{{index .Breakdown "cancelled"}}</b></span>
|
|
</div>
|
|
{{if .LastCompleted}}
|
|
<div class="panel">
|
|
<div class="table-scroll">
|
|
<table>
|
|
<thead><tr><th>Адрес</th><th>Итог</th><th>Завершено</th></tr></thead>
|
|
<tbody>
|
|
{{range .LastCompleted}}
|
|
{{$b := ipBadge .State .OverallResult .FIPAssociatedAt 0}}
|
|
<tr>
|
|
<td class="addr" data-label="Адрес"><a href="/ips/{{.IPAddress}}">{{.IPAddress}}</a></td>
|
|
<td data-label="Итог"><span class="pill {{$b.Class}}">{{$b.Label}}</span></td>
|
|
<td class="num" data-label="Завершено">{{fmtTime .AggregatedAt}}</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
{{if or .Query .StatusFilter}}<p class="muted">Ничего не найдено по текущему фильтру.</p>
|
|
{{else}}<p class="muted">Пока ничего не завершено.</p>{{end}}
|
|
{{end}}
|
|
{{end}}
|