Archived
dashboard: move the JSON export to the Requests header as a download icon
The history summary row had grown crowded -- the figures, then a "json" button and a "clear" button -- and the operator asked for the export to live in the Requests panel header instead, top-left by the title, as a download icon with a "Download JSON file" tooltip. The Requests header already carries running/waiting on the right, so the export sits opposite it on the left rather than lumped in with the history figures. The button is an inline SVG download glyph (a <button>, so it is keyboard-focusable and announced), in a new .pleft group so the space-between header keeps it on the left with the title. The handler now saves a file rather than copying to the clipboard: a Blob of the stored rows, an anchor with a download name, clicked and removed, the object URL revoked after the click. The old #hjson clipboard button is gone. This also fixes a clipping bug the previous commit introduced. Making each category a nowrap span and the separator a padded element removed every whitespace text node between categories, so the summary line became one unbreakable run: a long line overflowed the row and clipped the buttons after it -- the "json" the operator saw cut off at the panel edge. A zero-width space between groups restores a break opportunity: the line can now wrap between categories, while each category still stays atomic. The break point sits between groups, never inside one, where nowrap would make it inert. tests/js/download.test.js, 27 checks, drives the shipped handler against stubs: the button is in the Requests header on the left of the aside, exactly one of them (a duplicate id would bind only the first and leave a dead control), tooltip and aria-label present, an icon not a text label; the handler builds one anchor, names it radiance-history.json, types the blob application/json, clicks it, attaches it to the document (Firefox needs that), removes it, and revokes the object URL only after the click. The payload round-trips through JSON.parse. history.test.js gained the break-point checks: three zero-width spaces between four categories, each immediately before its group, none buried inside a nowrap group. Verified by mutation: dropping the download attribute, never clicking, never revoking, a wrong blob type, changed tooltip text, and moving the button to the right of the aside each fail the suite. extremes 27, poll_spark 35, history 29, download 27, dashboard_test 241 over 8 cases, sched_test 62646 over 184, no failures. Not deployed. Goes to review with the separator commits. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
1 parent
1554b451e1
commit
c36d04d99c
3 files changed
+139
-6
No files matched your search
@@ -75,9 +75,25 @@ new Function("el", "document", "$", "hRows", "tps", "cnt3", "dur", BLOCK)(
|
||||
el, doc, () => hsum, rows,
|
||||
(v) => Math.round(v) + " t/s", (v) => String(Math.round(v)), (v) => v + " ms");
|
||||
|
||||
const groups = hsum.kids;
|
||||
/* #hsum now holds the four category groups AND the zero-width-space break points between them,
|
||||
so select by class rather than assuming every child is a group. */
|
||||
const groups = hsum.kids.filter((k) => k.cls === "hgrp");
|
||||
const zwsps = hsum.kids.filter((k) => k.tag === "#text" && k.txt === "\u200b");
|
||||
eq(groups.length, 4, "four categories: count, tok/s, prefill, ttft");
|
||||
ok(groups.every((g) => g.cls === "hgrp"), "every category is a .hgrp (the nowrap unit)");
|
||||
console.log("== the line has a break point, so a long summary wraps instead of clipping ==");
|
||||
/* The groups are nowrap; without a break opportunity between them the whole line is one
|
||||
* unbreakable run that overflows the row and clips whatever follows it. */
|
||||
eq(zwsps.length, 3, "a zero-width break point between each pair of categories");
|
||||
ok(hsum.kids.every((k) => k.cls === "hgrp" || (k.tag === "#text" && k.txt === "\u200b")),
|
||||
"#hsum holds only groups and break points, nothing else");
|
||||
/* The break point must sit BETWEEN groups, not inside one: a ZWSP inside a nowrap span cannot
|
||||
* break, so it would buy nothing. */
|
||||
for (let i = 1; i < groups.length; i++) {
|
||||
const first = hsum.kids.indexOf(groups[i]);
|
||||
eq(hsum.kids[first - 1].txt, "\u200b", "break point immediately precedes category " + i);
|
||||
}
|
||||
ok(!JSON.stringify(groups.map((g) => g.kids)).includes("\u200b"),
|
||||
"no break point buried inside a nowrap group, where it could not act");
|
||||
console.log("== the dot introduces its category and travels with it ==");
|
||||
eq(groups[0].kids.filter((k) => k.cls === "hsep").length, 0, "the first category carries no leading dot");
|
||||
[1, 2, 3].forEach((i) => {
|
||||
|
||||
Reference in new issue
Block a user