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:
+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
|
||||
|
||||
Reference in New Issue
Block a user