Dashboard: one Needs attention list from every page; say what GANDALF stands for

attention.build gathers alerts, power faults, cutsheet mismatches, UniFi port names,
undocumented links, labels to print and rack overlaps into Broken now and Tidy up,
each linking to where it is fixed. /api/attention serves it; the dashboard renders it
and refreshes it with everything else. The header, help dialog, footer and page
description spell out Global Advanced Network Detection And Link Facilitator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 14:56:13 -05:00
co-authored by Claude Opus 5.5
parent a90ce44c80
commit c535bfd9fb
9 changed files with 383 additions and 3 deletions
+35
View File
@@ -43,6 +43,7 @@ async function refreshAll() {
lt.api.get('/api/network'),
lt.api.get('/api/status'),
refreshModem(),
refreshAttention(),
]);
if (netResult.status === 'fulfilled') {
const net = netResult.value;
@@ -68,6 +69,40 @@ async function refreshAll() {
}
}
// ── Needs attention ───────────────────────────────────────────────────
const ATTENTION_GROUPS = [
{ key: 'broken', title: 'Broken now', clear: 'Nothing broken' },
{ key: 'tidy', title: 'Tidy up', clear: 'Records match the network' },
];
async function refreshAttention() {
const body = document.getElementById('attention-body');
if (!body) return;
try {
renderAttention(body, await lt.api.get('/api/attention'));
} catch (e) {
body.innerHTML = `<p class="attention-empty">Couldn't gather the list: ${lt.escHtml(e.message || e)}</p>`;
}
}
function renderAttention(body, data) {
const esc = lt.escHtml;
body.innerHTML = ATTENTION_GROUPS.map(g => {
const rows = data[g.key] || [];
const list = rows.length
? `<ul class="attention-list">${rows.map(r => `
<li class="attention-item attention-${esc(r.severity)}">
<a class="attention-link" href="${esc(r.href)}">${esc(r.text)}</a>
${r.detail ? `<span class="attention-detail">${esc(r.detail)}</span>` : ''}
</li>`).join('')}</ul>`
: `<p class="attention-clear">✓ ${g.clear}</p>`;
return `<div class="attention-group attention-group-${g.key}">
<h3 class="attention-group-title">${g.title}${rows.length ? ` <span class="attention-count">${rows.length}</span>` : ''}</h3>
${list}
</div>`;
}).join('');
}
// Active alerts flagged stale or with a closed ticket, plus tickets left open after clearing
function followUpCount(events, staleTickets) {
const flagged = events.filter(e => e.severity !== 'info' &&
+2
View File
@@ -757,6 +757,8 @@ function openFromQuery() {
document.getElementById('cs-filter').addEventListener('input', () => _cs && renderCables());
document.getElementById('cs-status-filter').addEventListener('change', () => _cs && renderCables());
document.getElementById('cs-problems-only').addEventListener('change', () => _cs && renderCables());
// The dashboard's "Needs attention" list links here with ?problems=1
if (new URLSearchParams(window.location.search).get('problems')) document.getElementById('cs-problems-only').checked = true;
if (CS_CAN_EDIT) {
document.getElementById('cs-cable-form').addEventListener('submit', saveCable);
document.getElementById('cs-item-form').addEventListener('submit', saveItem);
+67
View File
@@ -1680,3 +1680,70 @@ body.fp-marks-off .fp-svg .fp-mark { display: none; }
.tp-pop select { width: 100%; }
.tp-pop-hint { color: var(--text-muted); font-size: .9em; margin: 6px 0 8px; }
.tp-pop-actions { display: flex; justify-content: flex-end; gap: 6px; }
/* ── Needs attention (dashboard) ─────────────────────────────────── */
.attention-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.attention-group {
background: var(--bg-card);
border: 1px solid var(--border-color);
padding: 10px 14px 12px;
min-width: 0;
}
.attention-group-title {
font-size: .78em;
font-weight: bold;
letter-spacing: .08em;
text-transform: uppercase;
color: var(--text-secondary);
margin: 0 0 8px;
}
.attention-group-broken .attention-group-title { color: var(--accent-red); }
.attention-count {
display: inline-block;
min-width: 1.6em;
padding: 0 5px;
margin-left: 4px;
border: 1px solid currentColor;
text-align: center;
font-size: .9em;
}
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-item {
position: relative;
padding: 5px 0 5px 16px;
border-top: 1px solid var(--border-color);
font-size: .86em;
}
.attention-item:first-child { border-top: 0; }
.attention-item::before {
content: '';
position: absolute;
left: 2px;
top: .85em;
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--text-muted);
}
.attention-bad::before { background: var(--accent-red); }
.attention-warn::before { background: var(--accent-amber); }
.attention-info::before { background: var(--accent-cyan); }
.attention-link { color: var(--text-primary); text-decoration: none; }
.attention-link:hover, .attention-link:focus-visible { color: var(--accent-cyan); text-decoration: underline; }
.attention-detail {
display: block;
color: var(--text-muted);
font-size: .9em;
overflow-wrap: anywhere;
}
.attention-clear { color: var(--accent-green); font-size: .86em; margin: 0; }
.attention-empty { color: var(--text-muted); font-size: .86em; margin: 0; }
@media (max-width: 768px) {
.attention-groups { grid-template-columns: 1fr; }
}
/* ── Brand: what GANDALF stands for ──────────────────────────────── */
.g-brand-expansion { letter-spacing: .08em; line-height: 1.35; }
.g-brand-expansion b { color: var(--accent-cyan); font-weight: 700; }
.g-help-about { font-size: .86em; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.5; }
.g-help-about b { color: var(--accent-cyan); }