02e4ef7544
Smoothes the rough edges that came up exercising a live deployment.
First-run bootstrap UI: /bootstrap renders a username + password form
that uses the in-memory token directly (operator no longer copies it
out of the log); /login redirects there while bootstrap is available.
Agent reliability: failJob synthetic envelopes so command.run early
returns no longer hang the server-side job; runtime probe of restic
restore --help drives --no-ownership instead of version sniffing
(0.18.x had it removed). Server unit re-shaped: ProtectSystem=full
plus ReadWritePaths=/etc/restic-manager, no ProtectHome — restore
can now write anywhere a user might want.
Restore wizard: default target is /root/rm-restore/<job-id>/ with
clearer help text. Re-init confirm input uses .field (was .input,
which doesn't exist — text was invisible).
NS-01 host delete: store DeleteHost, admin-band /hosts/{id}/delete
with hostname-confirm danger zone, audit, FK cascade, live WS close.
NS-02 enrollment-token recovery: outstanding-tokens panel on
/hosts/new, regenerate (preserves attachments) and revoke handlers
+ audit, store-level ListOutstandingEnrollmentTokens and
DeleteEnrollmentToken.
NS-03 repo init / probe surface: migration 0020 adds
hosts.repo_status + repo_status_error; WS handler projects every
init job's outcome onto the host row (idempotent already-initialised
collapses to ready); creds-save resets status and dispatches a fresh
probe; /hosts/{id}/repo/probe retry endpoint with banner.
NS-04 dashboard live + sort + filter: query-string filter
(q/status/repo_status/tag/sort/dir), 5s htmx live poll mirroring the
alerts pattern with a localStorage live toggle, sortable column
headers, filter row + clear.
Alerts page: ack'd-by line resolves user_id ULID to username.
Compose.yaml ignored — host-specific.
106 lines
4.2 KiB
HTML
106 lines
4.2 KiB
HTML
{{define "alert_row"}}
|
|
{{$a := .Alert}}
|
|
{{$hostNames := .HostNames}}
|
|
{{$usernames := .Usernames}}
|
|
{{$filter := .Filter}}
|
|
{{$status := alertStatus $a.ResolvedAt $a.AcknowledgedAt}}
|
|
|
|
{{/* derive query string for redirect-back after ack/resolve */}}
|
|
{{$qs := ""}}
|
|
{{if $filter.Status}}{{$qs = printf "status=%s" $filter.Status}}{{end}}
|
|
{{if $filter.Severity}}{{$qs = printf "%s&severity=%s" $qs $filter.Severity}}{{end}}
|
|
{{if $filter.HostID}}{{$qs = printf "%s&host_id=%s" $qs $filter.HostID}}{{end}}
|
|
{{if $filter.Search}}{{$qs = printf "%s&q=%s" $qs $filter.Search}}{{end}}
|
|
|
|
<div class="alert-row severity-{{$a.Severity}}{{if eq $status "resolved"}} resolved{{end}}"
|
|
{{if eq $status "acknowledged"}}style="background: color-mix(in oklch, var(--warn), transparent 96%);"{{end}}>
|
|
|
|
{{/* dot */}}
|
|
<div>
|
|
{{if eq $status "resolved"}}
|
|
<span class="dot dot-online"></span>
|
|
{{else if eq $a.Severity "critical"}}
|
|
<span class="dot dot-failed"></span>
|
|
{{else if eq $a.Severity "warning"}}
|
|
<span class="dot dot-degraded"></span>
|
|
{{else}}
|
|
<span class="dot dot-offline"></span>
|
|
{{end}}
|
|
</div>
|
|
|
|
{{/* severity + kind tag */}}
|
|
<div>
|
|
{{if eq $a.Severity "critical"}}
|
|
<span class="tag tag-critical">{{$a.Kind}}</span>
|
|
{{else if eq $a.Severity "warning"}}
|
|
<span class="tag tag-warn">{{$a.Kind}}</span>
|
|
{{else}}
|
|
<span class="tag tag-info">{{$a.Kind}}</span>
|
|
{{end}}
|
|
</div>
|
|
|
|
{{/* host */}}
|
|
<div class="mono {{if eq $status "resolved"}}text-ink-mid{{else}}text-ink{{end}}">
|
|
{{mapGet $hostNames $a.HostID}}
|
|
</div>
|
|
|
|
{{/* message */}}
|
|
<div class="{{if eq $status "resolved"}}text-ink-mute{{else}}text-ink{{end}}">
|
|
{{$a.Message}}
|
|
</div>
|
|
|
|
{{/* raised (created_at) */}}
|
|
<div class="mono {{if eq $status "resolved"}}text-ink-fade{{else}}text-ink-mid{{end}}">
|
|
{{relTime $a.CreatedAt}}
|
|
</div>
|
|
|
|
{{/* last seen */}}
|
|
<div class="mono {{if and (eq $status "open") (stillHappening $a.LastSeenAt)}}text-warn{{else if eq $status "resolved"}}text-ink-fade{{else}}text-ink-mid{{end}}">
|
|
{{if and (eq $status "open") (stillHappening $a.LastSeenAt)}}
|
|
still happening · {{relTime $a.LastSeenAt}}
|
|
{{else}}
|
|
{{relTime $a.LastSeenAt}}
|
|
{{end}}
|
|
</div>
|
|
|
|
{{/* actions */}}
|
|
<div style="display: flex; gap: 6px; justify-content: flex-end; align-items: center;">
|
|
{{if eq $status "open"}}
|
|
<form method="post" action="/alerts/{{$a.ID}}/acknowledge">
|
|
{{if $qs}}<input type="hidden" name="qs" value="{{$qs}}">{{end}}
|
|
<button type="submit" class="btn"
|
|
hx-post="/alerts/{{$a.ID}}/acknowledge{{if $qs}}?{{$qs}}{{end}}"
|
|
hx-swap="none"
|
|
title="I've seen this — silence further fan-out, but the alert is still open until the condition clears or you Resolve it.">Acknowledge</button>
|
|
</form>
|
|
<form method="post" action="/alerts/{{$a.ID}}/resolve">
|
|
{{if $qs}}<input type="hidden" name="qs" value="{{$qs}}">{{end}}
|
|
<button type="submit" class="btn"
|
|
hx-post="/alerts/{{$a.ID}}/resolve{{if $qs}}?{{$qs}}{{end}}"
|
|
hx-swap="none"
|
|
title="The underlying issue is fixed. Closes the alert. If the condition fires again a fresh alert will be raised with a new fan-out.">Resolve</button>
|
|
</form>
|
|
{{else if eq $status "acknowledged"}}
|
|
<span class="text-ink-fade" style="font-size: 11px;">
|
|
{{$ackedBy := ""}}
|
|
{{if $a.AcknowledgedBy}}
|
|
{{$id := deref $a.AcknowledgedBy}}
|
|
{{if index $usernames $id}}{{$ackedBy = index $usernames $id}}{{else}}{{$ackedBy = $id}}{{end}}
|
|
{{end}}
|
|
ack'd{{if $ackedBy}} by {{$ackedBy}}{{end}} · {{relTime $a.AcknowledgedAt}}
|
|
</span>
|
|
<form method="post" action="/alerts/{{$a.ID}}/resolve">
|
|
{{if $qs}}<input type="hidden" name="qs" value="{{$qs}}">{{end}}
|
|
<button type="submit" class="btn"
|
|
hx-post="/alerts/{{$a.ID}}/resolve{{if $qs}}?{{$qs}}{{end}}"
|
|
hx-swap="none"
|
|
title="The underlying issue is fixed. Closes the alert.">Resolve</button>
|
|
</form>
|
|
{{else}}
|
|
<span class="text-ink-fade" style="font-size: 11px;">resolved · {{relTime $a.ResolvedAt}}</span>
|
|
{{end}}
|
|
</div>
|
|
|
|
</div>
|
|
{{end}}
|