Health: split the live matrix into Local (probe to probe) and Internet tables
Local is a square probe-by-probe matrix with a self diagonal. Internet holds the gateway, LAN and public DNS, web checks and the VPS per probe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
03604c8367
commit
462525b1e2
2 changed files with 23 additions and 8 deletions
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue