aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--static/deck.css2
-rw-r--r--static/modules/sbbuilder.js43
-rw-r--r--tests/test_frontend.py3
3 files changed, 48 insertions, 0 deletions
diff --git a/static/deck.css b/static/deck.css
index e4728a5..abc4566 100644
--- a/static/deck.css
+++ b/static/deck.css
@@ -77,6 +77,8 @@ select {
padding: 8px;
}
+.sbb .id { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+
.llm .meter { height: 6px; background: var(--udt-surface1); border-radius: 3px; overflow: hidden; margin: 2px 0 8px; }
.llm .meter > i { display: block; height: 100%; background: var(--udt-accent); }
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);
+ }
+ },
+};
diff --git a/tests/test_frontend.py b/tests/test_frontend.py
index fb4df7e..7af672e 100644
--- a/tests/test_frontend.py
+++ b/tests/test_frontend.py
@@ -73,6 +73,9 @@ class Frontend(unittest.TestCase):
def test_llm_panel_served(self):
self.assert_panel("llm")
+ def test_sbbuilder_panel_served(self):
+ self.assert_panel("sbbuilder")
+
if __name__ == "__main__":
unittest.main()