diff --git a/core/server/dashboard.cpp b/core/server/dashboard.cpp index cbc5a7c6..1933279a 100644 --- a/core/server/dashboard.cpp +++ b/core/server/dashboard.cpp @@ -587,6 +587,13 @@ h1 { margin:0; font-size:13.5px; font-weight:600; letter-spacing:-.005em; } .cap { font-size:10.5px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--dim); } .aside { font-family:var(--mono); font-size:11.5px; color:var(--dim); } +/* A panel header's left side can hold a title plus a control; the header itself is + * space-between, so without this group the control would land in the middle. */ +.pleft { display:flex; align-items:baseline; gap:9px; } +.pbtn { background:none; border:0; padding:0; margin:0; color:var(--faint); cursor:pointer; + display:inline-flex; align-items:center; } +.pbtn:hover { color:var(--fg); } +.pbtn:focus-visible { outline:1px solid var(--edge); outline-offset:3px; } .pbody { padding:14px 16px 16px; } /* The control vector's switch: a checkbox row with its explanation under it. The two need a gap @@ -1227,7 +1234,14 @@ nav button.on { color:var(--fg); background:var(--track); }
-
Requests +
Requests +
@@ -1240,7 +1254,6 @@ nav button.on { color:var(--fg); background:var(--track); }
history - json clear
@@ -2265,6 +2278,10 @@ function histRender(missed) { const hsum = $("hsum"); hsum.textContent = ""; parts.forEach((p, i) => { + /* The zero-width space is the line's ONLY break opportunity. The groups are nowrap so they + * cannot split, and with no break point here a long summary overflows the row and clips + * whatever follows it -- which is what the padded separators did to this line. */ + if (i) hsum.appendChild(document.createTextNode("\u200b")); const g = el("span", "hgrp"); /* The dot travels WITH the category it introduces: as a sibling it could be left stranded * at the end of a line when the category wrapped, which is the orphan this avoids. */ @@ -2308,8 +2325,13 @@ $("hclr").addEventListener("click", () => { lsSet(HK, "[]"); lsSet(HKN, "0"); lsSet(HKC, String(Date.now())); hDrawn = null; histRender(0); }); -$("hjson").addEventListener("click", () => { - try { navigator.clipboard.writeText(JSON.stringify(hRows)); } catch (e) {} +$("reqjson").addEventListener("click", () => { + const url = URL.createObjectURL(new Blob([JSON.stringify(hRows, null, 2)], + { type: "application/json" })); + const a = el("a"); + a.href = url; a.download = "radiance-history.json"; + document.body.appendChild(a); a.click(); a.remove(); + setTimeout(() => URL.revokeObjectURL(url), 1000); }); histLoad(); histRender(0); diff --git a/tests/js/download.test.js b/tests/js/download.test.js new file mode 100644 index 00000000..fd7906e9 --- /dev/null +++ b/tests/js/download.test.js @@ -0,0 +1,95 @@ +/* The Requests-header JSON export. It used to be a "json" text button in the history row that + * copied to the clipboard; it is now a download icon that saves a file. A button that looks + * clickable and silently does nothing is the failure this guards: so drive the SHIPPED handler + * against stubs and assert it actually builds a file, names it, clicks it, and cleans up. */ +const fs = require("fs"); +const path = require("path"); +const src = require("./page.js"); // the