From b9410a1c40f6d4e871f68c5f397000d64769a41b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 12 Nov 2026 18:32:30 +0100 Subject: feat(dashboard): show build progress in the build VM slot The build VM slot showed a busy bar and the job kind. It now reads `sbb-remote jobs --active` (sb-builder 0.13.0), whose running build carries progress: the package being built on the first line, done of total (dependencies included, from the preview's plan) on the right, the op, the package's ETA, the estimated end and failures on the second line, and a bar that fills as packages finish. Other jobs keep the busy bar. Polling only active jobs also stops pulling the whole job history over ssh every 10s. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 4 ++++ deckit/modules/sbbuilder.py | 7 ++++--- static/deck.css | 1 + static/modules/sbbuilder.js | 24 ++++++++++++++++++++---- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 00628aa..0e45a4f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -65,6 +65,10 @@ Keep the server dependency-free apart from that one package. is the emergency stop, a press-and-hold button on the tab. While the printer is off it backs off 10s between tries. The camera snapshot and the slicer thumbnail are loaded by the tablet straight from the printer. +- `sbbuilder` has no tab, only a running slot. It reads `sbb-remote jobs + --active` (sb-builder 0.13.0+); a running build's `progress` (done of + total with dependencies, the package building, its ETA, the estimated end, + failures) replaces the busy bar. - `tablet` reads the tablet's battery (`dumpsys battery`) and Wi-Fi (`cmd wifi status`, Android 11+) over adb, from the device whose reverse carries the dashboard socket; reads are cached 10s. diff --git a/deckit/modules/sbbuilder.py b/deckit/modules/sbbuilder.py index cefe2a3..d9f3cb0 100644 --- a/deckit/modules/sbbuilder.py +++ b/deckit/modules/sbbuilder.py @@ -17,8 +17,9 @@ """sb-builder build state, read-only over ssh. `sbb-remote stats` carries the dashboard: VM load, uptime, memory, disk, package -counts, orphans, slackrepo results and overlay pulls. `jobs` adds the recent -build list. Both run over one ssh connection and arrive as two JSON objects. +counts, orphans, slackrepo results and overlay pulls. `jobs --active` adds the +running job, with its `progress` while it is a build (sbb-remote 0.13.0). Both +run over one ssh connection and arrive as two JSON objects. """ import json @@ -41,7 +42,7 @@ def make(cfg: dict) -> Module: def state(): try: out = run(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=4", - host, "sbb-remote stats; sbb-remote jobs"]).lstrip() + host, "sbb-remote stats; sbb-remote jobs --active"]).lstrip() except OSError: return {"offline": True} try: diff --git a/static/deck.css b/static/deck.css index 471aa07..328d201 100644 --- a/static/deck.css +++ b/static/deck.css @@ -749,6 +749,7 @@ select { .dash .slot .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--udt-border-1), var(--udt-border-2), var(--udt-border-3)); } .dash .slot .bar.busy i { width: 30%; animation: slot-busy 1.6s ease-in-out infinite alternate; } +.dash .slot .bar:not(.busy) i { transition: width 0.6s ease; } @keyframes slot-busy { from { margin-left: 0; } to { margin-left: 70%; } } .dash .slot .sthumb { display: none; } @container slot (min-width: 700px) { diff --git a/static/modules/sbbuilder.js b/static/modules/sbbuilder.js index 357133f..e183132 100644 --- a/static/modules/sbbuilder.js +++ b/static/modules/sbbuilder.js @@ -31,10 +31,26 @@ export function slot(st, el) {
`; } + // A running build carries sbb-remote's progress: the package on line 1, done + // of total (dependencies included) on the right, op, its ETA, the estimated + // end and failures on line 2, and a real bar. Every slot width works the + // same: the lines slide when they do not fit. const jobs = active(st); + const p = jobs[0]?.progress; const load = st.stats?.load; - el.querySelector(".what > span").textContent = `Build VM · ${jobs[0]?.kind || "job"}`; - el.querySelector(".pct").textContent = jobs.length > 1 ? `${jobs.length} jobs` : ""; - el.querySelector(".meta > span").textContent = - [jobs[0]?.status, load ? `load ${load[0].toFixed(2)}` : null].filter(Boolean).join(" · "); + const hm = (t) => new Date(t * 1000).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); + el.querySelector(".what > span").textContent = + p?.current?.split("/").pop() || `Build VM · ${jobs[0]?.kind || "job"}`; + el.querySelector(".pct").textContent = + p?.total ? `${p.done}/${p.total}` : jobs.length > 1 ? `${jobs.length} jobs` : ""; + el.querySelector(".meta > span").textContent = [ + p ? p.op : jobs[0]?.status, + p?.eta && `ETA ${p.eta}`, + p?.end && `ends ~${hm(p.end)}`, + p?.failed && `${p.failed} failed`, + load && `load ${load[0].toFixed(2)}`, + ].filter(Boolean).join(" · "); + const bar = el.querySelector(".bar"); + bar.classList.toggle("busy", !p?.total); + bar.firstChild.style.width = p?.total ? `${Math.min(100, (100 * p.done) / p.total)}%` : ""; } -- cgit v1.2.3