From 7da4cc26e24208c014aa428e0421cde590910d8c Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 18 Nov 2026 01:36:20 -0500 Subject: [PATCH] Polish: phone alert cards, quieter badges, footer, small layout fixes - Active alerts on the dashboard become one card per alert on phones instead of a table squeezed to a letter per line. - Section count badges are neutral; red is kept for active alerts and tickets to follow up, so "History 0" no longer looks like a problem. - Host cards only tag the data source when it isn't node_exporter (a ping-only host), instead of "prometheus" on every card. - WAN / Fiber: the BGW320 doesn't report uptime here, so show the last restart instead of a permanent "Uptime -". - Footer: CFG and HELP read like the hints beside them rather than grey browser buttons, and the footer sits at the bottom of short pages. - Wider alert filter and suppression name fields so their hints fit. - "just now" instead of a negative age when a clock runs a little ahead. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- static/app.js | 34 ++++++++++++++++++++++------------ static/base.js | 1 + static/style.css | 38 ++++++++++++++++++++++++++++++-------- templates/index.html | 28 ++++++++++++++-------------- tests/test_app.py | 19 +++++++++++++++++++ 6 files changed, 87 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 6429aa2..fa3a272 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Ping-only (no node_exporter): **pbs** (10.10.10.3) Served by `GET /api/attention` (`attention.py`) and refreshed with the rest of the page. - Device search (see Device pages below) - Active alerts table with severity, target, consecutive failures, ticket link -- WAN / Fiber panel: WAN and PON state, Rx/Tx power, optics temperature, throughput, errors, gateway uptime and last restart, a 24 hour internet health strip from UniFi, 7-day Rx trend, recent WAN outages +- WAN / Fiber panel: WAN and PON state, Rx/Tx power, optics temperature, throughput, errors, gateway uptime and last restart (just the last restart when the gateway doesn't report uptime), a 24 hour internet health strip from UniFi, 7-day Rx trend, recent WAN outages - Hosts with per-NIC link state; NICs marked unused fold into a "+N unused" line - UniFi devices as a compact list (name and model; offline ones turn red with a suppress button) - Recently resolved alerts, folded until opened diff --git a/static/app.js b/static/app.js index 1429f86..ef59b89 100644 --- a/static/app.js +++ b/static/app.js @@ -363,6 +363,16 @@ function _modemLastRestart(history) { return `restarted ${_modemWhen(last.at)}${last.by ? ` by ${last.by}` : ''}`; } +function _modemUptimeStat(data) { + if (data.uptime_s !== null && data.uptime_s !== undefined) { + return _modemStat('Uptime', _modemUptime(data.uptime_s), '', _modemLastRestart(data.wan_history)); + } + const restarts = (data.wan_history && data.wan_history.restarts) || []; + if (!restarts.length) return ''; + const last = restarts[restarts.length - 1]; + return _modemStat('Last restart', _modemWhen(last.at), '', last.by ? `by ${last.by}` : ''); +} + function _modemDuration(seconds) { if (seconds < 60) return `${Math.round(seconds)}s`; if (seconds < 3600) return `${Math.floor(seconds / 60)}m ${Math.round(seconds % 60)}s`; @@ -467,7 +477,7 @@ function updateModem(data) { ${_modemOptic('Optics temp', optics.temperature, status.temperature, '°C')} ${_modemStat('Throughput', `↓ ${_modemRate(rates.rx_bytes)}`, '', `↑ ${_modemRate(rates.tx_bytes)}`)} ${_modemStat('Errors / drops', `${errs} / ${drops}`, errs ? 'lt-text-amber' : '', 'since modem reboot')} - ${_modemStat('Uptime', _modemUptime(data.uptime_s), '', _modemLastRestart(data.wan_history))} + ${_modemUptimeStat(data)} ${_modemQuality(data.wan_quality)} ${_modemChart(data.history)} @@ -526,16 +536,16 @@ function updateEventsTable(events, totalActive) { : ''; return ` - ${e.severity}${supBadge}${staleBadge}${closedBadge} - ${lt.escHtml(e.event_type.replace(/_/g,' '))} - ${lt.escHtml(e.target_name)} - ${lt.escHtml(e.target_detail || '-')} - ${lt.escHtml((e.description||'').substring(0,60))}${(e.description||'').length>60?'…':''} - ${lt.time.ago(_toIso(e.first_seen))} - ${lt.time.ago(_toIso(e.last_seen))} - ${e.consecutive_failures} - ${ticket} - + ${e.severity}${supBadge}${staleBadge}${closedBadge} + ${lt.escHtml(e.event_type.replace(/_/g,' '))} + ${lt.escHtml(e.target_name)} + ${lt.escHtml(e.target_detail || '-')} + ${lt.escHtml((e.description||'').substring(0,60))}${(e.description||'').length>60?'…':''} + ${lt.time.ago(_toIso(e.first_seen))} + ${lt.time.ago(_toIso(e.last_seen))} + ${e.consecutive_failures} + ${ticket} +