Calmer dashboard and navigation, short page intros
Lint / JS (eslint) (push) Successful in 27s
Lint / Python (flake8) (push) Successful in 2m30s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 2m0s
Test / Python Tests (pytest) (push) Successful in 1m46s
Lint / Python (flake8) (pull_request) Successful in 1m43s
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m7s
Test / Python Tests (pytest) (pull_request) Successful in 1m10s
Lint / JS (eslint) (push) Successful in 27s
Lint / Python (flake8) (push) Successful in 2m30s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 2m0s
Test / Python Tests (pytest) (push) Successful in 1m46s
Lint / Python (flake8) (pull_request) Successful in 1m43s
Lint / JS (eslint) (pull_request) Successful in 11s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m7s
Test / Python Tests (pytest) (pull_request) Successful in 1m10s
Dashboard: the stat cards are gone (Needs attention says it better); host cards fold unused NICs into one line and move Suppress to a small icon; UniFi devices become a compact list; recently resolved alerts fold. Navigation keeps Dashboard, Topology, Rack and Cutsheet in view with Alert history and Suppressions under More; the phone drawer groups them the same way and gains Start maintenance, and the phone header hides the user name and the Ctrl+K hint so GANDALF fits. Rack and topology intros are one line with the how-to behind a ?; the topology problem bar is one line until opened. README updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,17 +106,30 @@ Ping-only (no node_exporter): **pbs** (10.10.10.3)
|
||||
## Pages
|
||||
|
||||
### Dashboard (`/`)
|
||||
- **Needs attention** at the top gathers what every page would flag into two lists, each line linking to
|
||||
where it is fixed:
|
||||
- *Broken now*: active alerts (one line, with the devices), an outlet that is off but feeds a device,
|
||||
frozen outlet readings, and cables not where the cutsheet says.
|
||||
- *Tidy up*: UniFi port names pointing at the wrong device or at an empty port, live links not on the
|
||||
cutsheet, labels to print, powered outlets with no device assigned, and rack items that overlap or sit
|
||||
outside the rack.
|
||||
|
||||
Served by `GET /api/attention` (`attention.py`) and refreshed with the rest of the page.
|
||||
- Device search (see Device pages below)
|
||||
- Active alerts first, then the WAN / Fiber panel, hosts, UniFi devices, and recently resolved alerts
|
||||
- Real-time host status grid with per-NIC link state (UP / DOWN / degraded)
|
||||
- WAN / Fiber panel: WAN and PON state, Rx/Tx power, optics temperature, throughput, errors, gateway uptime and last restart, 7-day Rx trend, recent WAN outages
|
||||
- UniFi device table (switches, APs, gateway)
|
||||
- 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, 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
|
||||
- Follow-up flags (see Follow-up below): a ⏳ badge on alerts active for days, a "ticket closed" badge when the
|
||||
ticket was closed but the alert is still active, and a Needs Follow-up panel of tickets left open after their
|
||||
alert cleared. A "TO FOLLOW UP" chip in the status bar counts them all.
|
||||
- Quick-suppress modal: apply timed or manual suppression from any alert row
|
||||
- Auto-refreshes every 30 seconds via `/api/status` + `/api/network`
|
||||
- Quick-suppress modal: apply timed or manual suppression from any alert row or host card
|
||||
- Auto-refreshes every 30 seconds via `/api/status` + `/api/network` + `/api/attention`
|
||||
|
||||
The header spells out the name; the navigation keeps Dashboard, Topology, Rack and Cutsheet in view, with
|
||||
Alert history and Suppressions under **More** (and in the command palette, Ctrl+K). On a phone the drawer
|
||||
holds every page and Start maintenance.
|
||||
|
||||
### Alert history (`/events`)
|
||||
Every alert Gandalf raised in the last 24 hours to 90 days, including ones that cleared before anyone
|
||||
@@ -185,9 +198,11 @@ The rack front, drawn from the rack units set on cutsheet items, top first.
|
||||
The whole network as the switches see it now, top down: the internet, the modem, the gateway, then
|
||||
each switch by how many hops it is from the gateway, the gear and unknown devices below them, and the
|
||||
servers along the bottom. Power gear (PDU, UPS, power strip) sits in a rail on the right.
|
||||
- **What needs a look** is listed above the diagram: devices down, degraded or with active alerts,
|
||||
cables down or last seen elsewhere, ports named after the wrong device, and cables with errors.
|
||||
Click one to jump to it. With nothing to report it says all clear. Problem cables are drawn in full
|
||||
- **What needs a look** sits above the diagram as one line ("7 to look at" and the first two):
|
||||
devices down, degraded or with active alerts, cables down or last seen elsewhere, ports named after
|
||||
the wrong device, and cables with errors. Open it to list them all and click one to jump to it; it
|
||||
remembers whether it was open. With nothing to report it says all clear. The how-to hides behind the
|
||||
**?** next to the page intro. Problem cables are drawn in full
|
||||
colour with a glow and always shown, whatever the filters; healthy cables are drawn quietly.
|
||||
- **A card per device**, all the same height so the whole network reads at a glance: name, state
|
||||
(coloured edge and dot), and a picture: UniFi gear shows its real faceplate (the same drawings as the
|
||||
@@ -339,8 +354,13 @@ entry in `FACEPLATES`.
|
||||
Where every cable is meant to go, checked against what Gandalf actually sees. Anyone who can log in
|
||||
can view it; only the `admin` group can edit, and every change is logged with who made it and when.
|
||||
|
||||
The page has five tabs, each with its count: **Cables**, **To do** (undocumented links, port names
|
||||
in UniFi, labels to make), **Patch panels**, **Inventory** and **History**. A link to a section, cable
|
||||
or item (`/cutsheet#cable-7`, `#cs-portnames-section`) opens the tab that holds it, and
|
||||
`/cutsheet?problems=1` opens the cables with problems. Printing prints every tab.
|
||||
|
||||
- **Inventory**: things discovery can't see: patch panels, wall jacks, shelves, and rack positions
|
||||
for devices (use a device's exact Gandalf name). Panels and jacks are passive: a cable on a
|
||||
for devices (use a device's exact Gandalf name). The rack page draws them. Panels and jacks are passive: a cable on a
|
||||
port's front continues through the same port's rear.
|
||||
- **Cables**: two endpoints each (device or item, port, and front/rear for panels and jacks), plus
|
||||
ID, type, length, color, status (`planned`, `installed`, `dark`, `retired`) and notes. Leave the
|
||||
|
||||
+20
-43
@@ -140,16 +140,6 @@ function updateStatusBar(summary, lastCheck, daemonOk, followUps = 0, hasStaleTi
|
||||
alertBadge.style.display = total ? '' : 'none';
|
||||
}
|
||||
|
||||
// Update stat cards
|
||||
const scCrit = document.getElementById('stat-critical-val');
|
||||
const scWarn = document.getElementById('stat-warning-val');
|
||||
const scRes = document.getElementById('stat-resolved-val');
|
||||
if (scCrit) scCrit.textContent = critCount;
|
||||
if (scWarn) scWarn.textContent = warnCount;
|
||||
if (scRes && summary.resolved_24h !== null && summary.resolved_24h !== undefined) scRes.textContent = summary.resolved_24h;
|
||||
const statCritCard = document.getElementById('stat-critical');
|
||||
if (statCritCard) statCritCard.classList.toggle('lt-stat-card--alert', critCount > 0);
|
||||
|
||||
// Stale data banner: warn if last_check is older than 15 minutes
|
||||
let staleBanner = document.getElementById('stale-banner');
|
||||
if (lastCheck) {
|
||||
@@ -173,9 +163,6 @@ function updateStatusBar(summary, lastCheck, daemonOk, followUps = 0, hasStaleTi
|
||||
}
|
||||
|
||||
function updateHostGrid(hosts) {
|
||||
const scHosts = document.getElementById('stat-hosts-val');
|
||||
if (scHosts) scHosts.textContent = Object.keys(hosts).length;
|
||||
|
||||
for (const [name, host] of Object.entries(hosts)) {
|
||||
const card = document.querySelector(`.host-card[data-host="${CSS.escape(name)}"]`);
|
||||
if (!card) continue;
|
||||
@@ -188,15 +175,17 @@ function updateHostGrid(hosts) {
|
||||
|
||||
const ifaceList = card.querySelector('.iface-list');
|
||||
if (ifaceList && host.interfaces && Object.keys(host.interfaces).length > 0) {
|
||||
ifaceList.innerHTML = Object.entries(host.interfaces)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([iface, state]) => `
|
||||
// NICs marked unused fold into one line, so the card shows what is cabled
|
||||
const all = Object.entries(host.interfaces).sort(([a], [b]) => a.localeCompare(b));
|
||||
const inUse = all.filter(([, state]) => state !== 'unused');
|
||||
const unused = all.length - inUse.length;
|
||||
ifaceList.innerHTML = inUse.map(([iface, state]) => `
|
||||
<div class="iface-row">
|
||||
<span class="iface-dot dot-${state}"></span>
|
||||
<span class="iface-dot dot-${lt.escHtml(state)}"></span>
|
||||
<span class="iface-name">${lt.escHtml(iface)}</span>
|
||||
<span class="iface-state state-${state}">${state}</span>
|
||||
<span class="iface-state state-${lt.escHtml(state)}">${lt.escHtml(state)}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
`).join('') + (unused ? `<div class="iface-unused">+${unused} unused</div>` : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,30 +441,18 @@ function updateModem(data) {
|
||||
}
|
||||
|
||||
function updateUnifiTable(devices) {
|
||||
const tbody = document.querySelector('#unifi-table tbody');
|
||||
if (!tbody || !devices.length) return;
|
||||
|
||||
tbody.innerHTML = devices.map(d => {
|
||||
const statusClass = d.connected ? '' : 'row-critical';
|
||||
const dotClass = d.connected ? 'dot-up' : 'dot-down';
|
||||
const statusText = d.connected ? 'ONLINE' : 'OFFLINE';
|
||||
const suppressBtn = !d.connected
|
||||
? `<button class="lt-btn lt-btn-ghost lt-btn-sm btn-suppress"
|
||||
data-sup-type="unifi_device"
|
||||
data-sup-name="${lt.escHtml(d.name)}"
|
||||
data-sup-detail=""
|
||||
aria-label="Suppress alerts for ${lt.escHtml(d.name)}">🔕 Suppress</button>`
|
||||
: '';
|
||||
return `
|
||||
<tr class="${statusClass}">
|
||||
<td><span class="${dotClass}"></span> ${statusText}</td>
|
||||
<td><a class="device-link" href="${lt.escHtml(deviceUrl(d.name))}"><strong>${lt.escHtml(d.name)}</strong></a></td>
|
||||
<td>${lt.escHtml(d.type)}</td>
|
||||
<td>${lt.escHtml(d.model)}</td>
|
||||
<td>${lt.escHtml(d.ip)}</td>
|
||||
<td>${suppressBtn}</td>
|
||||
</tr>`;
|
||||
}).join('');
|
||||
const grid = document.getElementById('unifi-grid');
|
||||
if (!grid || !devices.length) return;
|
||||
const esc = lt.escHtml;
|
||||
grid.innerHTML = devices.map(d => `
|
||||
<li class="unifi-chip${d.connected ? '' : ' unifi-chip-down'}">
|
||||
<span class="${d.connected ? 'dot-up' : 'dot-down'}" title="${d.connected ? 'Online' : 'Offline'}"></span>
|
||||
<a class="device-link unifi-chip-name" href="${esc(deviceUrl(d.name))}">${esc(d.name)}</a>
|
||||
<span class="unifi-chip-model">${esc(d.model)}</span>
|
||||
${d.connected ? '' : `<button class="lt-btn lt-btn-ghost lt-btn-sm btn-suppress" data-sup-type="unifi_device"
|
||||
data-sup-name="${esc(d.name)}" data-sup-detail="" title="Suppress alerts for ${esc(d.name)}"
|
||||
aria-label="Suppress alerts for ${esc(d.name)}">🔕</button>`}
|
||||
</li>`).join('');
|
||||
}
|
||||
|
||||
function updateEventsTable(events, totalActive) {
|
||||
|
||||
@@ -1752,3 +1752,66 @@ body.fp-marks-off .fp-svg .fp-mark { display: none; }
|
||||
.g-help-about b { color: var(--accent-cyan); }
|
||||
/* A tab holding one section already says what it is: skip the repeated heading */
|
||||
.lt-tab-panel > .g-section:only-child > .g-section-header { display: none; }
|
||||
|
||||
/* ── Dashboard: calmer host cards and device list ────────────────── */
|
||||
.host-suppress { margin-left: auto; padding: 0 6px; opacity: .45; }
|
||||
.host-suppress:hover, .host-suppress:focus-visible { opacity: 1; }
|
||||
.iface-unused { font-size: .74em; color: var(--text-muted); padding: 2px 0 0 14px; }
|
||||
.unifi-grid {
|
||||
list-style: none; margin: 0; padding: 0;
|
||||
display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px;
|
||||
}
|
||||
.unifi-chip {
|
||||
display: flex; align-items: center; gap: 8px; min-width: 0;
|
||||
padding: 6px 10px; border: 1px solid var(--border-color); background: var(--bg-card);
|
||||
font-size: .84em;
|
||||
}
|
||||
.unifi-chip-down { border-color: var(--accent-red); }
|
||||
.unifi-chip-name { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.unifi-chip-model { margin-left: auto; color: var(--text-muted); font-size: .86em; }
|
||||
.unifi-chip .btn-suppress { padding: 0 6px; }
|
||||
.resolved-fold > summary { cursor: pointer; list-style: none; }
|
||||
.resolved-fold > summary::-webkit-details-marker { display: none; }
|
||||
.resolved-fold > summary::after { content: '▸ show'; margin-left: auto; font-size: .72em; color: var(--text-muted); }
|
||||
.resolved-fold[open] > summary::after { content: '▾ hide'; }
|
||||
|
||||
/* ── Navigation: More menu ───────────────────────────────────────── */
|
||||
.g-nav-more { position: relative; }
|
||||
.g-nav-more > summary { list-style: none; cursor: pointer; }
|
||||
.g-nav-more > summary::-webkit-details-marker { display: none; }
|
||||
.g-nav-more-menu {
|
||||
position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
|
||||
display: flex; flex-direction: column; min-width: 180px;
|
||||
background: var(--bg-secondary); border: 1px solid var(--border-color);
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,.35);
|
||||
}
|
||||
.g-nav-more-link {
|
||||
padding: 9px 14px; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
|
||||
color: var(--text-secondary); text-decoration: none;
|
||||
}
|
||||
.g-nav-more-link:hover, .g-nav-more-link:focus-visible { color: var(--accent-cyan); background: rgba(0,212,255,.05); }
|
||||
.g-nav-more-link.active { color: var(--accent-orange); }
|
||||
.g-drawer-group {
|
||||
display: block; margin: 14px 0 4px; padding: 0 16px; font-size: .66rem;
|
||||
letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* ── Page intros: the how-to sits behind a small "?" ─────────────── */
|
||||
.g-howto { display: inline; }
|
||||
.g-howto > summary {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
width: 1.5em; height: 1.5em; margin-left: 4px; cursor: pointer; list-style: none;
|
||||
border: 1px solid var(--border-color); border-radius: 50%; color: var(--accent-cyan); font-size: .9em;
|
||||
}
|
||||
.g-howto > summary::-webkit-details-marker { display: none; }
|
||||
.g-howto[open] > span { display: block; margin-top: 6px; color: var(--text-secondary); max-width: 70ch; }
|
||||
.tp-summary-toggle { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; color: inherit; }
|
||||
.tp-summary-bad .tp-summary-toggle { color: var(--red); }
|
||||
.tp-summary-warn .tp-summary-toggle { color: var(--amber); }
|
||||
.tp-summary-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 0; }
|
||||
|
||||
/* ── Phone header: room for the GANDALF name ─────────────────────── */
|
||||
@media (max-width: 767px) {
|
||||
.lt-header-user, .lt-cmd-hint-btn, .lt-header-right [data-action="start-maintenance"] { display: none; }
|
||||
}
|
||||
.g-drawer-action { background: none; border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; }
|
||||
|
||||
+13
-2
@@ -8,6 +8,7 @@ const PER_MM = 1100 / 482.6;
|
||||
const NODE_GAP = 90;
|
||||
const REFRESH_MS = 30000;
|
||||
const FILTER_KEY = 'gandalf.topology.filters';
|
||||
const PROBLEMS_KEY = 'gandalf.topology.problemsOpen';
|
||||
const DEFAULT_FILTERS = { stubs: 'grouped', power: true, traffic: true, mgmt: false, alerts: false };
|
||||
const STUB_MODES = ['grouped', 'all', 'none'];
|
||||
|
||||
@@ -20,6 +21,7 @@ const state = {
|
||||
expanded: new Set(), // switches whose unknown devices are shown one by one
|
||||
selected: null,
|
||||
pinned: null, // the device a touch screen tapped to trace
|
||||
problemsOpen: (() => { try { return localStorage.getItem(PROBLEMS_KEY) === '1'; } catch (_) { return false; } })(),
|
||||
};
|
||||
// Whether the last press was a mouse, pen or finger: touch has no hover, so taps trace instead
|
||||
let lastPointer = 'mouse';
|
||||
@@ -1323,6 +1325,12 @@ function initEvents() {
|
||||
if (e.key === 'Escape') closeOutletEditor();
|
||||
});
|
||||
document.getElementById('tp-summary').addEventListener('click', e => {
|
||||
if (e.target.closest('[data-action="toggle-problems"]')) {
|
||||
state.problemsOpen = !state.problemsOpen;
|
||||
try { localStorage.setItem(PROBLEMS_KEY, state.problemsOpen ? '1' : '0'); } catch (_) { /* private mode */ }
|
||||
renderSummary();
|
||||
return;
|
||||
}
|
||||
const chip = e.target.closest('.tp-problem-chip');
|
||||
if (!chip) return;
|
||||
if (chip.dataset.focusNode) focusOn('node', chip.dataset.focusNode);
|
||||
@@ -1422,8 +1430,11 @@ function renderSummary() {
|
||||
return;
|
||||
}
|
||||
box.className = `tp-summary ${problems.some(p => p.severity === 'bad') ? 'tp-summary-bad' : 'tp-summary-warn'}`;
|
||||
box.innerHTML = `<span class="tp-summary-head">⚠ ${problems.length} to look at</span>
|
||||
${problems.map(p => `<button type="button" class="tp-problem-chip tp-chip-${p.severity}" data-focus-${p.kind}="${esc(p.id)}">${esc(p.text)}</button>`).join('')}`;
|
||||
// One line by default: the dashboard already lists these; open it to jump to each on the map
|
||||
const open = state.problemsOpen;
|
||||
box.innerHTML = `<button type="button" class="tp-summary-head tp-summary-toggle" data-action="toggle-problems" aria-expanded="${open}">⚠ ${problems.length} to look at ${open ? '▾' : '▸'}</button>
|
||||
${open ? '' : `<span class="tp-summary-text">${esc(problems.slice(0, 2).map(p => p.text).join(' · '))}${problems.length > 2 ? ' ...' : ''}</span>`}
|
||||
${!open ? '' : problems.map(p => `<button type="button" class="tp-problem-chip tp-chip-${p.severity}" data-focus-${p.kind}="${esc(p.id)}">${esc(p.text)}</button>`).join('')}`;
|
||||
}
|
||||
|
||||
// Centre the view on a device or cable and show what is wrong with it
|
||||
|
||||
+50
-38
@@ -38,22 +38,26 @@
|
||||
<a href="{{ url_for('index') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'index' %} active{% endif %}"
|
||||
{% if request.endpoint == 'index' %}aria-current="page"{% endif %}>Dashboard</a>
|
||||
<a href="{{ url_for('events_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'events_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'events_page' %}aria-current="page"{% endif %}>History</a>
|
||||
<a href="{{ url_for('cutsheet_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'cutsheet_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'cutsheet_page' %}aria-current="page"{% endif %}>Cutsheet</a>
|
||||
<a href="{{ url_for('rack_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'rack_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'rack_page' %}aria-current="page"{% endif %}>Rack</a>
|
||||
<a href="{{ url_for('topology_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'topology_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'topology_page' %}aria-current="page"{% endif %}>Topology</a>
|
||||
<a href="{{ url_for('rack_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'rack_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'rack_page' %}aria-current="page"{% endif %}>Rack</a>
|
||||
<a href="{{ url_for('cutsheet_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'cutsheet_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'cutsheet_page' %}aria-current="page"{% endif %}>Cutsheet</a>
|
||||
<span class="g-drawer-group">More</span>
|
||||
<a href="{{ url_for('events_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'events_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'events_page' %}aria-current="page"{% endif %}>Alert history</a>
|
||||
{% if user.groups and 'admin' in user.groups %}
|
||||
<a href="{{ url_for('suppressions_page') }}"
|
||||
class="lt-nav-drawer-link{% if request.endpoint == 'suppressions_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'suppressions_page' %}aria-current="page"{% endif %}>Suppressions</a>
|
||||
{% if not maintenance %}
|
||||
<button type="button" class="lt-nav-drawer-link g-drawer-action" data-action="start-maintenance">Start maintenance</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
@@ -85,40 +89,34 @@
|
||||
<span class="lt-brand-subtitle g-brand-expansion" title="GANDALF: Global Advanced Network Detection And Link Facilitator"><b>G</b>lobal <b>A</b>dvanced <b>N</b>etwork<br><b>D</b>etection <b>A</b>nd <b>L</b>ink <b>F</b>acilitator</span>
|
||||
</div>
|
||||
|
||||
<!-- Desktop nav -->
|
||||
<!-- Desktop nav: the four pages used daily, the rest under More -->
|
||||
<nav class="lt-nav" aria-label="Main navigation">
|
||||
<a href="{{ url_for('index') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'index' %} active{% endif %}"
|
||||
{% if request.endpoint == 'index' %}aria-current="page"{% endif %}>
|
||||
Dashboard
|
||||
</a>
|
||||
<a href="{{ url_for('events_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'events_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'events_page' %}aria-current="page"{% endif %}>
|
||||
History
|
||||
</a>
|
||||
<a href="{{ url_for('cutsheet_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'cutsheet_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'cutsheet_page' %}aria-current="page"{% endif %}>
|
||||
Cutsheet
|
||||
</a>
|
||||
<a href="{{ url_for('rack_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'rack_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'rack_page' %}aria-current="page"{% endif %}>
|
||||
Rack
|
||||
</a>
|
||||
{% if request.endpoint == 'index' %}aria-current="page"{% endif %}>Dashboard</a>
|
||||
<a href="{{ url_for('topology_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'topology_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'topology_page' %}aria-current="page"{% endif %}>
|
||||
Topology
|
||||
</a>
|
||||
{% if user.groups and 'admin' in user.groups %}
|
||||
<a href="{{ url_for('suppressions_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'suppressions_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'suppressions_page' %}aria-current="page"{% endif %}>
|
||||
Suppressions
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if request.endpoint == 'topology_page' %}aria-current="page"{% endif %}>Topology</a>
|
||||
<a href="{{ url_for('rack_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'rack_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'rack_page' %}aria-current="page"{% endif %}>Rack</a>
|
||||
<a href="{{ url_for('cutsheet_page') }}"
|
||||
class="lt-nav-link{% if request.endpoint == 'cutsheet_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'cutsheet_page' %}aria-current="page"{% endif %}>Cutsheet</a>
|
||||
{% set _more = request.endpoint in ('events_page', 'suppressions_page') %}
|
||||
<details class="g-nav-more">
|
||||
<summary class="lt-nav-link{% if _more %} active{% endif %}">More ▾</summary>
|
||||
<div class="g-nav-more-menu">
|
||||
<a href="{{ url_for('events_page') }}"
|
||||
class="g-nav-more-link{% if request.endpoint == 'events_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'events_page' %}aria-current="page"{% endif %}>Alert history</a>
|
||||
{% if user.groups and 'admin' in user.groups %}
|
||||
<a href="{{ url_for('suppressions_page') }}"
|
||||
class="g-nav-more-link{% if request.endpoint == 'suppressions_page' %} active{% endif %}"
|
||||
{% if request.endpoint == 'suppressions_page' %}aria-current="page"{% endif %}>Suppressions</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</details>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -419,6 +417,20 @@
|
||||
]);
|
||||
}
|
||||
|
||||
// ── More menu: close on a click elsewhere or Escape ───────────────────
|
||||
document.addEventListener('click', function(e) {
|
||||
document.querySelectorAll('.g-nav-more[open]').forEach(function(d) {
|
||||
if (!d.contains(e.target)) d.removeAttribute('open');
|
||||
});
|
||||
});
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key !== 'Escape') return;
|
||||
document.querySelectorAll('.g-nav-more[open]').forEach(function(d) {
|
||||
d.removeAttribute('open');
|
||||
d.querySelector('summary').focus();
|
||||
});
|
||||
});
|
||||
|
||||
// ── Global footer + key actions ───────────────────────────────────────
|
||||
document.addEventListener('click', function(e) {
|
||||
const btn = e.target.closest('[data-action]');
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="lt-page-header">
|
||||
<div>
|
||||
<h1 class="lt-page-title">Alert History</h1>
|
||||
<p class="g-page-sub">Every alert Gandalf raised, including the ones that cleared on their own. Resolved alerts are kept 90 days.</p>
|
||||
<p class="g-page-sub">Every alert raised, including ones that cleared on their own; kept 90 days.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+25
-119
@@ -38,44 +38,6 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ── Stats summary cards ──────────────────────────────────────────── -->
|
||||
<div class="lt-stats-grid">
|
||||
<div class="lt-stat-card{% if summary.critical %} lt-stat-card--alert{% endif %}"
|
||||
id="stat-critical" role="button" tabindex="0"
|
||||
data-stat-filter="critical" aria-label="{{ summary.critical or 0 }} critical alerts"
|
||||
aria-controls="events-table-wrap">
|
||||
<span class="lt-stat-icon lt-text-red" aria-hidden="true">●</span>
|
||||
<div class="lt-stat-info">
|
||||
<span class="lt-stat-value lt-text-red" id="stat-critical-val">{{ summary.critical or 0 }}</span>
|
||||
<span class="lt-stat-label">Critical</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lt-stat-card"
|
||||
id="stat-warning" role="button" tabindex="0"
|
||||
data-stat-filter="warning" aria-label="{{ summary.warning or 0 }} warning alerts"
|
||||
aria-controls="events-table-wrap">
|
||||
<span class="lt-stat-icon lt-text-amber" aria-hidden="true">●</span>
|
||||
<div class="lt-stat-info">
|
||||
<span class="lt-stat-value lt-text-amber" id="stat-warning-val">{{ summary.warning or 0 }}</span>
|
||||
<span class="lt-stat-label">Warning</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lt-stat-card" id="stat-hosts" aria-label="Monitored hosts">
|
||||
<span class="lt-stat-icon lt-text-cyan" aria-hidden="true">⬡</span>
|
||||
<div class="lt-stat-info">
|
||||
<span class="lt-stat-value lt-text-cyan" id="stat-hosts-val">{{ snapshot.hosts | length }}</span>
|
||||
<span class="lt-stat-label">Hosts</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lt-stat-card" id="stat-resolved" aria-label="{{ recent_resolved | length }} alerts resolved in last 24 hours">
|
||||
<span class="lt-stat-icon lt-text-green" aria-hidden="true">✔</span>
|
||||
<div class="lt-stat-info">
|
||||
<span class="lt-stat-value lt-text-green" id="stat-resolved-val">{{ recent_resolved | length }}</span>
|
||||
<span class="lt-stat-label">Resolved 24h</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Device search ──────────────────────────────────────────────── -->
|
||||
<section class="g-section device-search" id="device-search" role="search">
|
||||
<label class="g-section-title" for="device-search-input">Find a device</label>
|
||||
@@ -244,6 +206,9 @@
|
||||
{% if suppressed or has_global_sup %}
|
||||
<span class="badge-suppressed" title="Suppressed">🔕</span>
|
||||
{% endif %}
|
||||
<button class="lt-btn lt-btn-ghost lt-btn-sm btn-suppress host-suppress"
|
||||
data-sup-type="host" data-sup-name="{{ name }}" data-sup-detail=""
|
||||
title="Suppress alerts for {{ name }}" aria-label="Suppress alerts for {{ name }}">🔕</button>
|
||||
</div>
|
||||
<div class="host-meta">
|
||||
<span class="host-ip">{{ host.ip }}</span>
|
||||
@@ -252,32 +217,21 @@
|
||||
</div>
|
||||
|
||||
{% if host.interfaces %}
|
||||
{% set in_use = host.interfaces | dictsort | rejectattr(1, 'equalto', 'unused') | list %}
|
||||
{% set unused = (host.interfaces | length) - (in_use | length) %}
|
||||
<div class="iface-list">
|
||||
{% for iface, state in host.interfaces.items() | sort %}
|
||||
{% for iface, state in in_use %}
|
||||
<div class="iface-row">
|
||||
<span class="iface-dot dot-{{ state }}"></span>
|
||||
<span class="iface-name">{{ iface }}</span>
|
||||
<span class="iface-state state-{{ state }}">{{ state }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if unused %}<div class="iface-unused">+{{ unused }} unused</div>{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="host-ping-note">{% if host.source == 'ping' %}ping-only / no node_exporter{% else %}no metrics from node_exporter{% endif %}</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="host-actions">
|
||||
<button class="lt-btn lt-btn-ghost lt-btn-sm btn-suppress"
|
||||
data-sup-type="host"
|
||||
data-sup-name="{{ name }}"
|
||||
data-sup-detail=""
|
||||
aria-label="Suppress alerts for {{ name }}">
|
||||
🔕 Suppress
|
||||
</button>
|
||||
<a href="{{ url_for('device_page', name=name) }}"
|
||||
class="lt-btn lt-btn-secondary lt-btn-sm">
|
||||
↗ Details
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="lt-empty-state lt-empty-state--sm">
|
||||
@@ -295,61 +249,30 @@
|
||||
<div class="g-section-header">
|
||||
<h2 class="g-section-title">UniFi Devices</h2>
|
||||
</div>
|
||||
<div class="lt-frame">
|
||||
<span class="lt-frame-bl">╚</span>
|
||||
<span class="lt-frame-br">╝</span>
|
||||
<div class="lt-section-header">Device Inventory</div>
|
||||
<div class="lt-table-wrap">
|
||||
<table class="lt-table" id="unifi-table">
|
||||
<caption class="lt-sr-only">UniFi network devices</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Model</th>
|
||||
<th>IP</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for d in snapshot.unifi %}
|
||||
<tr class="{% if not d.connected %}row-critical{% endif %}">
|
||||
<td>
|
||||
<span class="dot-{{ 'up' if d.connected else 'down' }}"></span>
|
||||
{{ 'ONLINE' if d.connected else 'OFFLINE' }}
|
||||
</td>
|
||||
<td><a class="device-link" href="{{ url_for('device_page', name=d.name) }}"><strong>{{ d.name }}</strong></a></td>
|
||||
<td>{{ d.type }}</td>
|
||||
<td>{{ d.model }}</td>
|
||||
<td>{{ d.ip }}</td>
|
||||
<td>
|
||||
{% if not d.connected %}
|
||||
<button class="lt-btn lt-btn-ghost lt-btn-sm btn-suppress"
|
||||
data-sup-type="unifi_device"
|
||||
data-sup-name="{{ d.name }}"
|
||||
data-sup-detail=""
|
||||
aria-label="Suppress alerts for {{ d.name }}">
|
||||
🔕 Suppress
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="unifi-grid" id="unifi-grid">
|
||||
{% for d in snapshot.unifi %}
|
||||
<li class="unifi-chip{% if not d.connected %} unifi-chip-down{% endif %}">
|
||||
<span class="dot-{{ 'up' if d.connected else 'down' }}" title="{{ 'Online' if d.connected else 'Offline' }}"></span>
|
||||
<a class="device-link unifi-chip-name" href="{{ url_for('device_page', name=d.name) }}">{{ d.name }}</a>
|
||||
<span class="unifi-chip-model">{{ d.model }}</span>
|
||||
{% if not d.connected %}
|
||||
<button class="lt-btn lt-btn-ghost lt-btn-sm btn-suppress" data-sup-type="unifi_device"
|
||||
data-sup-name="{{ d.name }}" data-sup-detail="" title="Suppress alerts for {{ d.name }}"
|
||||
aria-label="Suppress alerts for {{ d.name }}">🔕</button>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
<!-- ── Recently Resolved (last 24h) ───────────────────────────────── -->
|
||||
{% if recent_resolved %}
|
||||
<section class="g-section">
|
||||
<div class="g-section-header">
|
||||
<details class="g-section resolved-fold">
|
||||
<summary class="g-section-header">
|
||||
<h2 class="g-section-title">Recently Resolved</h2>
|
||||
<span class="g-section-badge g-section-badge-resolved">{{ recent_resolved | length }} in last 24h</span>
|
||||
</div>
|
||||
</summary>
|
||||
<div class="lt-timeline">
|
||||
{% for e in recent_resolved %}
|
||||
{%- set dot_cls = 'lt-timeline-item--green' if e.severity == 'info' else 'lt-timeline-item--dim' -%}
|
||||
@@ -369,7 +292,7 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
</details>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -449,22 +372,5 @@
|
||||
.observe(document.getElementById('events-table-wrap'), { childList: true, subtree: true });
|
||||
|
||||
initDeviceSearch();
|
||||
|
||||
// Stat card clicks: filter events table by severity
|
||||
document.querySelectorAll('.lt-stat-card[data-stat-filter]').forEach(card => {
|
||||
card.addEventListener('click', () => {
|
||||
const sev = card.dataset.statFilter;
|
||||
document.querySelectorAll('.sev-pills .pill').forEach(p => {
|
||||
p.classList.remove('active');
|
||||
p.setAttribute('aria-pressed', 'false');
|
||||
});
|
||||
const matchPill = document.querySelector(`.sev-pills .pill[data-sev="${sev}"]`);
|
||||
if (matchPill) { matchPill.classList.add('active'); matchPill.setAttribute('aria-pressed', 'true'); }
|
||||
_filterSev = sev;
|
||||
applyEventsFilter();
|
||||
document.getElementById('events-table-wrap')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
card.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); card.click(); } });
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
<div class="lt-page-header">
|
||||
<div>
|
||||
<h1 class="lt-page-title">Rack</h1>
|
||||
<p class="g-page-sub">The rack front, drawn from the rack units on the cutsheet with live port state. Hover a port to light up every port on the same cable run; click it to open the port or the cable.</p>
|
||||
<div class="g-page-sub">The rack, drawn from the cutsheet with live port state.
|
||||
<details class="g-howto"><summary aria-label="How to use this page">?</summary><span>Hover a port to light up every port on the same cable run; click it to open the port or the cable.</span></details></div>
|
||||
</div>
|
||||
<div class="cs-actions no-print">
|
||||
<button type="button" class="lt-btn lt-btn-secondary lt-btn-sm" data-export="svg">Download SVG</button>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="lt-page-header">
|
||||
<div>
|
||||
<h1 class="lt-page-title">Alert Suppressions</h1>
|
||||
<p class="g-page-sub">Manage maintenance windows and per-target alert suppression rules.</p>
|
||||
<p class="g-page-sub">Maintenance windows and alert suppression rules.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<div class="lt-page-header">
|
||||
<div>
|
||||
<h1 class="lt-page-title">Topology</h1>
|
||||
<p class="g-page-sub">Every device and cable as the switches see them right now. Drag to pan, scroll or pinch to zoom. Hover a device to trace its path to the internet and its power (on a touch screen, tap it once to trace and again to open it); click a cable for its details, or a group of unknown devices to open it.</p>
|
||||
<div class="g-page-sub">Every device and cable, as the switches see them now.
|
||||
<details class="g-howto"><summary aria-label="How to use this page">?</summary><span>Drag to pan; scroll or pinch to zoom. Hover a device to trace its path to the internet and its power (on a touch screen, tap once to trace and again to open it). Click a cable for its details, or a group of unknown devices to open it.</span></details></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+23
-2
@@ -95,10 +95,12 @@ class TestPagesAndNav:
|
||||
def test_home_section_order(self, client):
|
||||
html = client.get('/', headers=AUTH).get_data(as_text=True)
|
||||
order = [html.index(m) for m in (
|
||||
'id="device-search"', 'Alert Queue', 'WAN / Fiber', 'g-section-title">Hosts<',
|
||||
'Device Inventory',
|
||||
'id="attention"', 'id="device-search"', 'Alert Queue', 'WAN / Fiber', 'g-section-title">Hosts<',
|
||||
'id="unifi-grid"',
|
||||
)]
|
||||
assert order == sorted(order)
|
||||
# The needs-attention list replaced the stat cards
|
||||
assert 'lt-stat-card' not in html
|
||||
|
||||
def test_dashboard_topology_moved_to_its_own_page(self, client):
|
||||
html = client.get('/', headers=AUTH).get_data(as_text=True)
|
||||
@@ -822,3 +824,22 @@ class TestAttention:
|
||||
html = client.get('/', headers=AUTH).get_data(as_text=True)
|
||||
assert 'id="attention-body"' in html
|
||||
assert 'Global Advanced Network Detection And Link Facilitator' in html
|
||||
|
||||
|
||||
class TestCalmDashboard:
|
||||
def test_unused_nics_fold_into_one_line(self, client):
|
||||
snap = json.dumps({'hosts': {'large1': {'ip': '10.0.0.2', 'status': 'up', 'source': 'prometheus',
|
||||
'interfaces': {'eth0': 'up', 'eth1': 'unused', 'eth2': 'unused'}}},
|
||||
'unifi': []})
|
||||
state = dict(STATE, network_snapshot=snap)
|
||||
with patch.object(gandalf.db, 'get_state', side_effect=lambda k, d=None: state.get(k, d)):
|
||||
html = client.get('/', headers=AUTH).get_data(as_text=True)
|
||||
assert '>eth0<' in html and '>eth1<' not in html
|
||||
assert '+2 unused' in html
|
||||
|
||||
def test_resolved_alerts_are_folded(self, client):
|
||||
ev = {'target_name': 'large1', 'target_detail': '', 'severity': 'warning', 'event_type': 'host_down',
|
||||
'first_seen': '2026-11-15 01:00:00 UTC', 'resolved_at': '2026-11-15 02:00:00 UTC'}
|
||||
with patch.object(gandalf.db, 'get_recent_resolved', return_value=[ev]):
|
||||
html = client.get('/', headers=AUTH).get_data(as_text=True)
|
||||
assert '<details class="g-section resolved-fold">' in html
|
||||
|
||||
Reference in New Issue
Block a user