Show in-flight request count + activity spark on In-Flight Monitor key

The key now renders the live request count (large) when a model is active,
plus a 1Hz count-trend sparkline of the last 60s in a bottom strip. IDLE/
LOADING/OFF/OFFLINE states unchanged. History lives in per-key state with
a sampler cleared on disappear.
This commit is contained in:
2026-08-14 11:20:51 -06:00
parent 5a6ad54b08
commit a805195c49
3 changed files with 75 additions and 8 deletions
+23 -2
View File
@@ -14,10 +14,31 @@ test("renderInflight: ready + count renders IDLE in green", () => {
assert.doesNotMatch(svg, /ACTIVE/);
});
test("renderInflight: ready + count>0 renders ACTIVE in red", () => {
test("renderInflight: ready + count>0 renders the count number on red", () => {
const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 2, offline: false, pulse: false });
assert.match(svg, /ACTIVE/);
assert.match(svg, /2/);
assert.match(svg, /#8b2626/);
assert.doesNotMatch(svg, /ACTIVE/);
assert.doesNotMatch(svg, /IDLE/);
});
test("renderInflight: idle state does not show a count number", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 0, offline: false, pulse: false });
assert.match(svg, /IDLE/);
assert.doesNotMatch(svg, /font-size="24"/);
});
test("renderInflight: draws a count-trend spark when history has 2+ samples", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false, history: [0, 1, 2, 1] });
assert.match(svg, /<polyline/);
assert.match(svg, /<path/);
});
test("renderInflight: no spark with fewer than 2 history samples", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false, history: [1] });
assert.doesNotMatch(svg, /<polyline/);
const none = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false });
assert.doesNotMatch(none, /<polyline/);
});
test("renderInflight: pulse toggles opacity while active", () => {