From c75b6f1ff69d944bb07b9395880a63620a0a8a00 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 19:53:32 +0100 Subject: feat(dashboard): one fixed screen for the tablet The Dashboard tab drops the draggable card grid for a fixed layout: a top band of system, Claude and tablet chips with trend and fill backgrounds, music and spending always on, a row of one to three busy modules (printer, build VM, OBS) that scroll long lines, and the action icons in Hyprland's rotating border. The stats, tablet and llm panels and the vendored Gridstack go. Co-Authored-By: Claude Opus 5.5 --- static/modules/sbbuilder.js | 95 ++++++++++----------------------------------- 1 file changed, 21 insertions(+), 74 deletions(-) (limited to 'static/modules/sbbuilder.js') diff --git a/static/modules/sbbuilder.js b/static/modules/sbbuilder.js index 6285dd5..357133f 100644 --- a/static/modules/sbbuilder.js +++ b/static/modules/sbbuilder.js @@ -1,4 +1,4 @@ -// deck-it - sbbuilder panel +// deck-it - the build VM's running slot // Copyright (C) 2026 Danilo M. // // This program is free software; you can redistribute it and/or modify @@ -14,80 +14,27 @@ // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import { offline } from "../offline.js"; +// The build VM has no tab: on the Dashboard it is a running slot while a job +// is active, and nothing otherwise. -const gib = (b) => (b == null ? "?" : (b / 1073741824).toFixed(1)); -const pct = (n) => (n == null ? "?" : `${Math.round(n)}%`); -const ago = (ts) => { - if (!ts) return "—"; - const d = Math.max(0, Math.floor(Date.now() / 1000 - ts)); - if (d < 3600) return `${Math.floor(d / 60)}m`; - if (d < 86400) return `${Math.floor(d / 3600)}h`; - return `${Math.floor(d / 86400)}d`; -}; +export const interval = 10; // each poll is an ssh round trip const ACTIVE = ["running", "busy", "starting"]; - -function tile(label, value, sub) { - const d = document.createElement("div"); - d.className = "mtile"; - const l = document.createElement("span"); - l.className = "mlabel"; - l.textContent = label; - const v = document.createElement("span"); - v.className = "mvalue num"; - v.textContent = value; - const s = document.createElement("span"); - s.className = "msub"; - s.textContent = sub || ""; - d.append(l, v, s); - return d; +const active = (st) => (st.jobs ?? []).filter((j) => ACTIVE.includes(j.status)); + +export const busy = (st) => !st.offline && active(st).length > 0; + +export function slot(st, el) { + if (!el.firstChild) { + el.innerHTML = ` + + +
`; + } + const jobs = active(st); + 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(" · "); } - -export default { - title: "Build VM", - interval: 10, - - mount(el) { - el.innerHTML = `
`; - }, - - update(state, el) { - const box = el.querySelector(".sbb"); - if (state.offline) { - offline(box, { - icon: "/icons/virt-manager.svg", - title: "Build VM is off", - detail: "Start the VM and its jobs and package counts appear here.", - }); - return; - } - box.textContent = ""; - const s = state.stats ?? {}; - const p = s.packages ?? {}; - const sr = s.slackrepo ?? {}; - const results = sr.results ?? {}; - const jobs = state.jobs ?? []; - const running = jobs.find((j) => ACTIVE.includes(j.status)); - - const now = document.createElement("div"); - now.className = "sbb-now"; - now.textContent = running ? `● ${running.kind || "job"}` : "idle"; - now.classList.toggle("warn", Boolean(running)); - box.append(now); - - const overlays = Object.entries(p).filter(([k]) => k !== "total" && k !== "shadowed"); - box.append( - tile("Packages", String(p.total ?? "?"), overlays.map(([k, v]) => `${k} ${v}`).join(" · ")), - tile("Failed", String(results.failed ?? 0), `${sr.built ?? "?"} built`), - tile("Disk free", `${gib(s.disk?.free)}`, `of ${gib(s.disk?.total)} GiB`), - tile("CPU", pct(s.cpu), `load ${s.load ? s.load[0].toFixed(2) : "?"}`), - ); - - const foot = document.createElement("div"); - foot.className = "mfoot"; - foot.textContent = `orphans ${s.orphans ?? "?"} · ${ - Object.entries(s.sync ?? {}).map(([k, v]) => `${k} ${ago(v)}`).join(" · ") || "no pulls"}`; - box.append(foot); - }, -}; -- cgit v1.2.3