diff --git a/README.md b/README.md
index 45ee9aa..c92be71 100644
--- a/README.md
+++ b/README.md
@@ -301,7 +301,10 @@ first `start` with this recipe, kill the old process groups (`kill -s TERM -- -<
- **Runners column.** Every runner the forges report, plus any seen in job data, and a line for this
device's gitlab-runner when `runner_metrics` is set.
- **Phone health.** Battery, plugged state, temperature, CPU (Termux's own processes on a phone, the whole system on a Linux host) and memory, plus a 24 h
- battery and temperature chart. A new failure on main or staging vibrates the phone once.
+ chart: battery, CPU and memory on a 0-100% scale, temperature on its own scale, and a band for each job
+ this device ran (a red tick on top for a failed one, dashed edges for a GitLab busy span, which is only
+ known to the poll interval). A host without a battery gets the same chart as "This host", without battery
+ and temperature. A new failure on main or staging vibrates the phone once.
| Waiting, stalled queue | On hold (manual) |
|---|---|
diff --git a/board/index.html b/board/index.html
index 7b0090e..f3e26ac 100644
--- a/board/index.html
+++ b/board/index.html
@@ -22,6 +22,12 @@
--queue: #f29a3a;
--hold: #7cb7e8;
--off: #3a3f46;
+ /* 24 h chart series: three line hues validated as a set on --board-deep (lightness band, CVD and
+ normal-vision separation, 3:1 contrast); battery is an area wash, so its form tells it apart */
+ --s-temp: #d28e05;
+ --s-cpu: #338ced;
+ --s-mem: #e24d8b;
+ --s-batt: #0aac23;
--sans: "Roboto Condensed", sans-serif-condensed, "Arial Narrow", sans-serif;
--mono: "Roboto Mono", "Droid Sans Mono", "DejaVu Sans Mono", monospace;
}
@@ -129,12 +135,29 @@
.side > .chart { flex: 1 1 auto; display: flex; flex-direction: column; }
.chart .plot { position: relative; flex: 1 1 0; min-height: 14vh; }
.chart svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
-/* scale marks: battery on the left edge, temperature on the right; both scales share the three lines */
-.chart .tick { position: absolute; font-size: 1.7vh; line-height: 1; color: var(--dim); opacity: .8; padding: .3vh .4vw; pointer-events: none; }
+/* scale marks: 0-100 % (battery, CPU, memory) on the left edge, temperature on the right; the scales share
+ the three lines */
+/* a halo in the surface colour keeps them readable where a line or a band passes under them (14vh minimum) */
+.chart .tick { position: absolute; font-size: 1.7vh; line-height: 1; color: var(--dim); padding: .3vh .4vw; pointer-events: none;
+ text-shadow: 0 0 .3vh var(--board-deep), 0 0 .3vh var(--board-deep), 0 0 .3vh var(--board-deep), 0 0 .6vh var(--board-deep); }
.chart .tick.l { left: 0; } .chart .tick.r { right: 0; }
.chart .tick.y0 { top: 0; } .chart .tick.y1 { top: 50%; transform: translateY(-100%); } .chart .tick.y2 { bottom: 0; }
-.legend { display: flex; gap: 1.4vw; font-size: 2.2vh; color: var(--dim); margin-top: .5vh; }
-.legend i { display: inline-block; width: 1.8vh; height: .5vh; vertical-align: middle; margin-right: .3vw; }
+/* the jobs this device ran, behind the series: neutral bands; a failed job adds a red tick along the top,
+ an approximate span (busy between two polls) is fainter with dashed edges */
+.chart .run rect { fill: var(--text); fill-opacity: .11; }
+.chart .run.fail rect { fill: var(--fail); fill-opacity: .2; }
+.chart .run.approx rect { fill-opacity: .06; }
+.chart .run .cap { stroke: var(--fail); stroke-width: 6px; }
+.chart .run .edge { stroke: var(--dim); stroke-width: 1px; stroke-dasharray: 3 3; stroke-opacity: .8; }
+.chart .series { fill: none; stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
+.legend { display: flex; flex-wrap: wrap; column-gap: 1.4vw; row-gap: .3vh; font-size: 2.2vh; color: var(--dim); margin-top: .5vh; }
+.legend span { white-space: nowrap; }
+.legend i { display: inline-block; width: 1.8vh; height: .5vh; vertical-align: middle; margin-right: .3vw; background: var(--k); }
+.legend i.dash { height: 0; background: none; border-top: .3vh dashed var(--k); }
+.legend i.area { height: 1.4vh; opacity: .45; }
+.legend i.band { width: 1.4vh; height: 1.4vh; background: color-mix(in srgb, var(--text) 16%, transparent); }
+.legend i.band.fail { background: color-mix(in srgb, var(--fail) 26%, transparent); border-top: .4vh solid var(--fail); }
+.legend i.band.approx { background: color-mix(in srgb, var(--text) 8%, transparent); border: 1px dashed var(--dim); border-top: 0; border-bottom: 0; }
footer { grid-column: 1 / -1; display: flex; gap: 2vw; padding: .9vh 2.4vw; font-size: 2.2vh; color: var(--dim); background: var(--board-deep); }
footer .err { color: var(--fail); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@@ -456,26 +479,96 @@
};
$("fleet").innerHTML = fleet.length || lr ? `
`; return; }
- const W = 400, H = 100, now = Date.now() / 1000, x = t => W * (1 - (now - t) / 86400);
+// The 24 h chart. Left scale 0-100 %: battery (area wash), CPU and memory (lines); right scale 20-50°:
+// temperature, with the 40° warning line. Behind them, one band per job this device ran (device_runs), from
+// start to end (to now while it runs): a failed job adds a tick along the top, an approximate span (a busy
+// count seen between two polls, without project, job or result) is fainter with dashed edges. A series with
+// no data is left out with its scale, line and legend entry: a host without a battery shows CPU, memory and
+// its runs under "This host". A missing value or a gap in the samples breaks a line instead of bridging it.
+const hhmm = t => new Date(t * 1000).toLocaleTimeString("en-GB", {hour: "2-digit", minute: "2-digit"});
+function chartPaths(h, key, x, y, area, H) {
+ // consecutive samples with a value, split where one is missing or the gap is over 2.5 sample spacings
+ // (never under 15 min); a lone sample still draws as a dot (round cap)
+ const gaps = h.slice(1).map((s, i) => s.t - h[i].t).sort((p, q) => p - q);
+ const maxGap = Math.max(900, 2.5 * (gaps[gaps.length >> 1] || 0));
+ const segs = [];
+ let cur = null, prev = null;
+ for (const s of h) {
+ const v = s[key];
+ if (typeof v !== "number" || !Number.isFinite(v)) { cur = null; continue; }
+ if (!cur || s.t - prev > maxGap) segs.push(cur = []);
+ cur.push([x(s.t).toFixed(1), y(v).toFixed(1)]);
+ prev = s.t;
+ }
+ return segs.map(g => area
+ ? `M${g[0][0]},${H} ${g.map(([px, py]) => `L${px},${py}`).join(" ")} L${g.at(-1)[0]},${H}Z`
+ : `M${g[0][0]},${g[0][1]} ${(g.length > 1 ? g.slice(1) : g).map(([px, py]) => `L${px},${py}`).join(" ")}`).join(" ");
+}
+function runBands(runs, now, x, W, H) {
+ const from = now - 86400;
+ const unit = W / Math.max(1, $("chart").clientWidth); // viewBox units per CSS pixel
+ const shown = runs.filter(r => Number.isFinite(r.start) && r.start <= now && (r.end ?? now) >= from);
+ const svg = shown.map(r => {
+ let a = x(Math.max(r.start, from)), b = x(Math.min(r.end ?? now, now));
+ const fail = r.result === "failed", min = (fail ? 4 : 2) * unit; // a short job stays 2 px wide, a failed one 4 px
+ if (b - a < min) { const m = (a + b) / 2; a = m - min / 2; b = m + min / 2; }
+ const when = `${hhmm(r.start)}–${r.end == null ? "now" : hhmm(r.end)}`;
+ const what = r.approx ? `${r.forge || "runner"} busy (approximate)` : [short(r.project), r.job, r.result || (r.end == null ? "running" : "")].filter(Boolean).join(" · ");
+ const [x0, w] = [a.toFixed(2), (b - a).toFixed(2)];
+ return `${esc(`${what}, ${when}`)}${
+ fail ? `` : ""}${
+ r.approx ? [a, b].map(e => ``).join("") : ""}`;
+ }).join("");
+ return {svg, n: shown.length, failed: shown.filter(r => r.result === "failed").length,
+ approx: shown.filter(r => r.approx).length, open: shown.filter(r => r.end == null).length};
+}
+function renderChart(h, runs, device) {
+ const has = k => h.some(s => typeof s[k] === "number");
+ const battery = has("battery") || device.battery != null;
+ const title = `
${battery ? "Phone" : "This host"}, last 24 h
`;
+ const now = Date.now() / 1000;
+ if (h.length < 2 && !runs.some(r => (r.end ?? now) >= now - 86400)) {
+ $("chart").innerHTML = `${title}
The chart shows up after 10 minutes of samples.
`; return;
+ }
+ const W = 400, H = 100, x = t => W * (1 - (now - t) / 86400);
const yT = v => H - H * Math.min(1, Math.max(0, (v - 20) / 30)); // 20° to 50°
- const yB = v => H - H * v / 100;
- const temp = h.filter(s => s.temp != null).map(s => `${x(s.t).toFixed(1)},${yT(s.temp).toFixed(1)}`).join(" ");
- const bat = h.filter(s => s.battery != null);
- const area = bat.length ? `M${x(bat[0].t).toFixed(1)},${H} ` + bat.map(s => `L${x(s.t).toFixed(1)},${yB(s.battery).toFixed(1)}`).join(" ") + ` L${x(bat.at(-1).t).toFixed(1)},${H}Z` : "";
- $("chart").innerHTML = `