Summary reads --/-- after an interval change, not 0/26 in red (closes #140)
check / check (push) Waiting to run
check / check (push) Waiting to run
The interval menu resets every host to pending and updates the summary, which counted the WAN hosts with a latency recorded, none, and showed 0/26 in red until the second round after the change ended. While every WAN host still waits for its first check, the Reachable slot now reads --/-- in white, as at page load. updateSummary is exported for a unit test that resets the hosts as the interval menu does; a second test checks that the slot still reads 0/26 in red once every check failed. Model: opus-5-5
This commit was merged in pull request #164.
This commit is contained in:
+15
-8
@@ -995,7 +995,7 @@ function updateHostRow(host, index) {
|
||||
SparklineRenderer.draw(canvas, host.history);
|
||||
}
|
||||
|
||||
function updateSummary(state) {
|
||||
export function updateSummary(state) {
|
||||
const stats = state.wanStats();
|
||||
const hstats = state.wanHistoryStats();
|
||||
|
||||
@@ -1014,13 +1014,20 @@ function updateSummary(state) {
|
||||
const hmaxUnitEl = document.getElementById("summary-hmax-unit");
|
||||
if (!reachableEl) return;
|
||||
|
||||
reachableEl.textContent = `${stats.reachable}/${stats.total}`;
|
||||
reachableEl.className =
|
||||
stats.reachable === stats.total
|
||||
? "text-green-400"
|
||||
: stats.reachable === 0
|
||||
? "text-red-400"
|
||||
: "text-yellow-400";
|
||||
// Before any WAN host's check is recorded, as after an interval change,
|
||||
// no host has answered or failed, so the slot reads as at page load.
|
||||
if (state.wan.every((h) => h.status === "pending")) {
|
||||
reachableEl.textContent = "--/--";
|
||||
reachableEl.className = "text-white";
|
||||
} else {
|
||||
reachableEl.textContent = `${stats.reachable}/${stats.total}`;
|
||||
reachableEl.className =
|
||||
stats.reachable === stats.total
|
||||
? "text-green-400"
|
||||
: stats.reachable === 0
|
||||
? "text-red-400"
|
||||
: "text-yellow-400";
|
||||
}
|
||||
|
||||
if (stats.min !== null) {
|
||||
minEl.textContent = `${stats.min}`;
|
||||
|
||||
Reference in New Issue
Block a user