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.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html
index 7feb8c3..d0d637d 100644
--- a/src/api/dashboard/dashboard.html
+++ b/src/api/dashboard/dashboard.html
@@ -243,6 +243,11 @@ function renderPeers() {
// --- Figures: a tree, its open branches kept across renders ---
const open = new Set(["stats", "peer", "links", "from", "to"]);
function tree(key, value, path) {
+ // Empty: nothing to open.
+ if (value !== null && typeof value === "object" && Object.keys(value).length === 0) {
+ return el("div", { class: "leaf" }, el("span", { class: "key" }, key + ": "),
+ Array.isArray(value) ? "[]" : "{}");
+ }
if (value !== null && typeof value === "object") {
const details = el("details", {});
if (open.has(path)) details.open = true;
@@ -570,7 +575,13 @@ async function readStore(path, shallow) {
}
// One entry: a short scalar as it is; anything else a branch read when opened. A
// branch's entries are kept across reads, so what's open inside stays open.
+// An empty map, list or text: shown as it is, nothing to open.
+const EMPTY = { map: "{}", list: "[]", text: "\"\"" };
function documentEntry(key, summary, path) {
+ if (summary.size === 0 && summary.type in EMPTY) {
+ return el("div", { class: "leaf" }, el("span", { class: "key" }, key + ": "),
+ EMPTY[summary.type]);
+ }
if ("value" in summary) {
return el("div", { class: "leaf" }, el("span", { class: "key" }, key + ": "),
JSON.stringify(summary.value));