feat(alerts): live refresh table with toggle + severity colour cues #11
Reference in New Issue
Block a user
Delete Branch "alerts-live-refresh"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the auto-refresh feature on /alerts (5s poll, paused when tab is hidden or toggle is off), plus tints the severity-filter dropdown options to match the row colours.
Why
Alerts is the one screen where staleness is genuinely harmful — an operator can be looking at an Open tab that's already been resolved by another admin or auto-resolved by the engine, and act on a row that no longer exists.
Severity dropdown previously named a concept that the table itself didn't render (kind column shows kind only, severity is encoded as colour). Tinting the dropdown options bridges the gap.
Changes
Live refresh (
web/templates/pages/alerts.html,internal/server/http/ui_alerts.go):hx-getpolls the same URL every 5s,hx-select="#alerts-table"swaps just the table panel — filter strip + page header don't flashdocument.visibilityState==='visible' && localStorage.getItem('rm-alerts-live')!=='off'— pauses on hidden tabs and when the operator turns it offrm-alerts-live=on|offto localStorage; choice survives full-page navigationalertsPage.RefreshURL = r.URL.RequestURI()keeps any status/severity/host_id/q params intact across refreshesSeverity colour cues (
web/templates/pages/alerts.html):<option>carries an inlinecolor:matching the row's oklch tint (info=neutral, warning=orange, critical=red), plus a leading●Other screens (dashboard, hosts, jobs) deliberately stay manual-refresh per the project's anti-flicker stance.
Test plan
go test ./...)