aboutsummaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/deck.css1
-rw-r--r--static/modules/sbbuilder.js24
2 files changed, 21 insertions, 4 deletions
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) {
<span class="meta"><span></span></span>
<div class="bar busy"><i></i></div>`;
}
+ // 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)}%` : "";
}