aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/dashboard/dashboard.html
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/dashboard/dashboard.html')
-rw-r--r--src/api/dashboard/dashboard.html8
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);