diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-09 18:18:49 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-09 18:18:49 +0100 |
| commit | 03e2adab3fb58532ba1e32c2f01a9ec14f11e484 (patch) | |
| tree | 6d6bdea6ad2a2b942c4ba3d15c6f2cf726ecc876 /static/modules | |
| parent | f4411cf679b8ec7557233490601f3c1875a32113 (diff) | |
| download | deck-it-03e2adab3fb58532ba1e32c2f01a9ec14f11e484.tar.gz deck-it-03e2adab3fb58532ba1e32c2f01a9ec14f11e484.zip | |
feat: sb-builder status panel
Diffstat (limited to 'static/modules')
| -rw-r--r-- | static/modules/sbbuilder.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/static/modules/sbbuilder.js b/static/modules/sbbuilder.js new file mode 100644 index 0000000..16745cb --- /dev/null +++ b/static/modules/sbbuilder.js @@ -0,0 +1,43 @@ +function chipClass(status) { + if (status === "ok") return "good"; + if (status === "failed" || status === "lost" || status === "killed") return "bad"; + if (status === "running" || status === "busy" || status === "starting") return "warn"; + return "muted"; +} + +export default { + title: "Builds", + interval: 5, + + mount(el) { + const box = document.createElement("div"); + box.className = "sbb"; + el.append(box); + }, + + update(state, el) { + const box = el.querySelector(".sbb"); + box.textContent = ""; + if (state.offline) { + box.textContent = "build VM unreachable"; + return; + } + const jobs = state.jobs ?? []; + if (!jobs.length) { + box.textContent = "No jobs"; + return; + } + for (const job of jobs.slice(0, 8)) { + const row = document.createElement("div"); + row.className = "row"; + const id = document.createElement("span"); + id.className = "num id"; + id.textContent = job.id; + const status = document.createElement("span"); + status.className = chipClass(job.status); + status.textContent = job.status; + row.append(id, status); + box.append(row); + } + }, +}; |
