diff --git a/app/static/css/app.css b/app/static/css/app.css index 770ded8..6b5ff00 100644 --- a/app/static/css/app.css +++ b/app/static/css/app.css @@ -52,7 +52,7 @@ /* ---------- mesh matrix ---------- */ .matrix th.row-head { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; } -.matrix td { padding: 4px; } +.matrix td { padding: 4px; vertical-align: middle; } .cell { display: grid; gap: 1px; min-width: 92px; padding: 5px 8px; border-radius: var(--radius-control); background: var(--surface-2); color: var(--fg); text-decoration: none; font-size: var(--text-xs); border-left: 4px solid var(--viz-none); } .cell strong { font-size: var(--text-sm); font-variant-numeric: tabular-nums; } .cell.s-ok { border-left-color: var(--viz-ok); } diff --git a/app/static/js/views/health.js b/app/static/js/views/health.js index fc0f4fa..7e1f106 100644 --- a/app/static/js/views/health.js +++ b/app/static/js/views/health.js @@ -1,4 +1,4 @@ -// Network health: the live mesh matrix, status strips over time and the incident list. +// Network health: the live Local (probe to probe) and Internet tables, status strips over time and the incident list. import { el, segmented, store } from '../ui.js'; import { get } from '../api.js'; import { STATUS, statusChip, statusLegend, strip, tipRow, tipTitle, hideTip, showTip } from '../charts.js'; @@ -46,8 +46,10 @@ export function mount(root, ctx) { return; } fill(ui.body, - section('Right now', 'Last 5 minutes, per probe and target. Select a probe for its charts.'), - matrix(mx), + section('Local', 'Probe to probe over the last 5 minutes. Rows test the columns. Select a probe for its charts.'), + localMatrix(mx), + section('Internet', 'Each probe’s gateway, DNS servers and internet checks over the last 5 minutes.'), + internetTable(mx), section('Timeline', `${range} in ${st.buckets} slices of ${dur(st.width)}. A slice is down when half its checks fail, degraded when a fifth are slow or failing.`), statusLegend(), strips(st), @@ -56,12 +58,25 @@ export function mount(root, ctx) { ); } - function matrix(mx) { - if (!mx.targets.length) return el('div.callout', {}, 'No measurements in the last 5 minutes. Probes report every 30 seconds or so; check that they are running.'); + // Node-to-node: every probe is both a row and a column, so the diagonal reads "self". + function localMatrix(mx) { + if (mx.probes.length < 2) return el('div.callout', {}, 'Add a second probe to test the mesh. Probes test each other’s ping, HTTP and download speed.'); + const known = new Map(mx.targets.map((t) => [t.target, t])); + const targets = mx.probes.map((p) => known.get(`probe:${p.id}`) || { target: `probe:${p.id}`, label: p.name, kind: 'lan' }); + return grid(mx, targets, 'From ↓ / to →'); + } + + function internetTable(mx) { + const targets = mx.targets.filter((t) => !t.target.startsWith('probe:')); + if (!targets.length) return el('div.callout', {}, 'No gateway, DNS or internet checks in the last 5 minutes. Probes report every 30 seconds or so; check that they are running.'); + return grid(mx, targets, 'Probe'); + } + + function grid(mx, targets, corner) { const byKey = new Map(mx.cells.map((c) => [`${c.probe_id}|${c.target}`, c])); const rows = mx.probes.map((p) => el('tr', {}, el('th.row-head', {}, el('span.chips', {}, el('a', { href: `/probes/${p.id}` }, p.name), p.online ? null : el('span.chip.danger', {}, 'Offline'))), - ...mx.targets.map((t) => { + ...targets.map((t) => { const c = byKey.get(`${p.id}|${t.target}`); if (!c) return el('td', {}, el('div.cell-empty', {}, t.target === `probe:${p.id}` ? 'self' : '—')); const main = c.methods.icmp || c.methods.http || c.methods.dns; @@ -81,7 +96,7 @@ export function mount(root, ctx) { return el('td', {}, node); }))); return el('div.table-wrap', {}, el('table.table.matrix', {}, - el('thead', {}, el('tr', {}, el('th', {}, 'From ↓ / to →'), ...mx.targets.map((t) => el('th', { title: t.target }, t.label)))), + el('thead', {}, el('tr', {}, el('th', {}, corner), ...targets.map((t) => el('th', { title: t.target }, t.label)))), el('tbody', {}, ...rows))); }