From 4e0d0312a591fd55e3dabbf5fa6dd9f00408c045 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 21:12:50 +0100 Subject: links report down --- src/api/dashboard/dashboard.html | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src/api/dashboard/dashboard.html') diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index f45ded3..d2935f6 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -404,7 +404,7 @@ function renderLegend(measured) { el("span", { class: "other" }, "other transport"), el("span", { class: "direct" }, "direct"), el("span", { class: "relayed" }, "relayed"), - el("span", { class: "dormant" }, "dormant"), + el("span", { class: "dormant" }, "dormant or down"), el("span", { class: "silent" }, "an end reports no links")); document.getElementById("legend").replaceChildren(...items); } @@ -427,15 +427,19 @@ function edges() { if (!known || (timed && !knownTimed) || (timed === knownTimed && report.secsAgo < known.secsAgo)) { measured.set(key, { a, b: link.peer, link, secsAgo: report.secsAgo, - dormant: link.dormant || (known && known.dormant) }); - } else if (link.dormant) { - known.dormant = true; + dormant: link.dormant || (known && known.dormant), + down: link.down || (known && known.down) }); + } else { + if (link.dormant) known.dormant = true; + if (link.down) known.down = true; } } } - // Dormant if either end holds the other so, whichever report is drawn. + // Dormant, or down, if either end says so, whichever report is drawn. for (const edge of measured.values()) { - if (edge.dormant && !edge.link.dormant) edge.link = { ...edge.link, dormant: true }; + if ((edge.dormant && !edge.link.dormant) || (edge.down && !edge.link.down)) { + edge.link = { ...edge.link, dormant: !!edge.dormant, down: !!edge.down }; + } } return { intended, measured }; } @@ -615,8 +619,10 @@ function renderGraph() { const nx = -(q.y - p.y) / length, ny = (q.x - p.x) / length; // An end that reports no links (any more): what's drawn may be out of date. const silent = !(a in state.graph.measured) || !(b in state.graph.measured); - // Dormant: a red underlay as wide as the lines, as a dormant node's red outline. - if (link.dormant) { + // Dormant, or down (no path answers, whatever its connection was): a red underlay + // as wide as the lines, as a dormant node's red outline. + const broken = link.dormant || link.down; + if (broken) { children.push(drawing("underlay " + key, "line", { x1: p.x, y1: p.y, x2: q.x, y2: q.y, stroke: "var(--bad)", "stroke-opacity": .5, "stroke-width": width + 4, "stroke-linecap": "round" })); @@ -627,8 +633,8 @@ function renderGraph() { const ox = nx * side, oy = ny * side; const attrs = { x1: p.x + ox, y1: p.y + oy, x2: q.x + ox, y2: q.y + oy, stroke: colourOf(line.transport), - // Narrow where dormant (over its underlay). - "stroke-width": link.dormant ? (line.used ? 1.5 : 0.8) : line.used ? 3 : 1.2 }; + // Narrow where dormant or down (over its underlay). + "stroke-width": broken ? (line.used ? 1.5 : 0.8) : line.used ? 3 : 1.2 }; // Dotted where an end reports nothing, dashed where relayed, solid where direct. if (silent) { attrs["stroke-dasharray"] = line.used ? "1 5" : "1 3"; @@ -640,6 +646,7 @@ function renderGraph() { const description = name(a) + " – " + name(b) + (line.transport ? " via " + line.transport : "") + (line.used ? " (in use)" : "") + ((line.used ? link.relayed : line.relayed) ? ", relayed" : "") + (link.dormant ? ", dormant" : "") + + (line.used && link.down ? ", down" : "") + (silent ? ", one end reports no links" : "") + (typeof line.rttMs === "number" ? ", " + line.rttMs.toFixed(1) + " ms" : "") + ", measured " + age(secsAgo + elapsed()) + " ago"; -- cgit v1.3.1