diff options
| author | tv <tv@krebsco.de> | 2026-10-30 19:31:38 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-30 19:31:38 +0100 |
| commit | 2b1fc907d24234109cfd2f93d916063036d0401a (patch) | |
| tree | c0a2d4600e92e008a37d3c8dd95a4b9fc6de851c /src/api/dashboard | |
| parent | 94c857eaf7197d1dc6caa3cb295c73a959095192 (diff) | |
dashboard: start with document open on first level
Diffstat (limited to 'src/api/dashboard')
| -rw-r--r-- | src/api/dashboard/dashboard.html | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index f6f6693..53a8282 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -539,8 +539,9 @@ function renderGraph() { } // --- Document: read a level at a time (`/store?shallow=true`) as it is opened --- -// What is open, by path (as JSON), kept across reloads of the tree. -const documentOpen = new Set(); +// What is open, by path (as JSON), kept across reloads of the tree: the first level +// to begin with. +const documentOpen = new Set([JSON.stringify([])]); function storeUrl(path, shallow) { const where = path.length ? "../store/" + path.map(encodeURIComponent).join("/") : "../store"; return where + (shallow ? "?shallow=true" : ""); @@ -579,6 +580,8 @@ function documentEntry(key, summary, path) { try { if (summary.type === "map") { const shallow = await readStore(path, true); + // As it is now (the root's is unknown until read). + details.querySelector("summary").lastChild.textContent = describe(shallow); const entries = Object.entries(shallow.entries || {}); if (!entries.length) details.append(el("div", { class: "note" }, "empty")); for (const [k, child] of entries) details.append(documentEntry(k, child, [...path, k])); @@ -599,7 +602,6 @@ function documentEntry(key, summary, path) { } function renderDocument() { const root = documentEntry("store", { type: "map", size: "…" }, []); - root.querySelector("summary").lastChild.textContent = "(open to read)"; document.getElementById("document").replaceChildren(root); } document.getElementById("document-reload").addEventListener("click", renderDocument); |
