diff options
| author | tv <tv@krebsco.de> | 2026-11-17 16:32:23 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 17:36:18 +0100 |
| commit | 393fb4d70fc6bf88debc4ca13d644ea7de9602f5 (patch) | |
| tree | d0df529c52d5b726e6be91124f2eadf2187e8183 /src | |
| parent | 1bbb45bfe7c9c437373aefa08a6a985bc260f520 (diff) | |
In a swarm holding a store, the snapshot names the node's party, and the
document box shows what counts as the node reads it, read every 5 s: the
current version, the parties with their keys and nodes, the rules, the
values at places as a tree with who writes there, the proposals on the
version with where each stands, who voted what and what its version
changes, and what the node refused. `document` beside `remake…` shows the
document underneath.
Where the node votes for its party by itself, a proposal that can still
pass has a vote of each kind, cast through the node on a second click.
The page writes no values: a party signs its writes with its key.
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/dashboard/check.js | 52 | ||||
| -rw-r--r-- | src/api/dashboard/dashboard.html | 383 | ||||
| -rw-r--r-- | src/api/dashboard/mod.rs | 10 |
3 files changed, 436 insertions, 9 deletions
diff --git a/src/api/dashboard/check.js b/src/api/dashboard/check.js index 95f805a..4292e7d 100644 --- a/src/api/dashboard/check.js +++ b/src/api/dashboard/check.js @@ -2,8 +2,9 @@ // dashboard_in_a_browser -- --ignored`, which serves this the page as the node does): the // page loads without errors; the peers table has a row per peer, and an update changes // cells without making the rows anew (`morphChildren`); the map draws a node per member; -// and with 300 members, laid out by round trip, the first drawing doesn't hold the page up -// for long (`LAYOUT_FOR_MS`). +// with 300 members, laid out by round trip, the first drawing doesn't hold the page up +// for long (`LAYOUT_FOR_MS`); and in a swarm holding a store, the document box shows the +// federation: who writes at a place, what a proposal changes, and the votes. // // Needs Node.js, Playwright's library (`playwright-core`) and its Chromium; `check.nix` // gives all three from nixpkgs. @@ -77,6 +78,53 @@ const check = (ok, what) => { check(map.ms < budget, `${n} members drawn in ${map.ms.toFixed(0)} ms (under ${budget})`); } + // The federation, as the node would answer (`GET /events`, `/events/counts`, …). + const federated = await tab.evaluate(() => { + const rules = [{ path: "home/{party}/**", writer: "{party}" }, + { path: "names/*", writer: "tv" }, { path: "names/**", writer: false }]; + const writers = ["home/tv/motd", "home/tv", "home/makefu/motd", "names/r", "names/r/s"] + .map(path => writerAt(rules, ["tv", "lass"], path)); + const version = { federation: 1, number: 0, changes: null, + keys: { tv: { since: 0, keys: ["ssh-ed25519 AAAA1"] }, + lass: { since: 0, keys: ["ssh-ed25519 AAAA2"] } }, + nodes: { tv: { since: 0, nodes: ["continuum:a"] }, lass: { since: 0, nodes: [] } }, + rules }; + const next = { ...version, number: 1, changes: "11", + keys: { ...version.keys, lass: { since: 1, keys: ["ssh-ed25519 AAAA3"] } } }; + state = { node: { id: "continuum:a", alias: "a", party: "tv" }, stats: {}, + peers: { localReaches: [], peers: {} }, graph: { members: {}, intended: {}, measured: {} } }; + federationTimer = 1; + federation.summary = { store: "aa", checkpoint: "aa", heads: ["bb"], taken: 3, + party: "tv", votesByItself: true }; + federation.heads = "bb"; + federation.counts = { version: { number: 0, hash: "11", version }, + parties: { tv: { keys: ["ssh-ed25519 AAAA1"], nodes: ["continuum:a"] }, + lass: { keys: ["ssh-ed25519 AAAA2"], nodes: [] } }, + values: { "home/tv/motd": "hello", "home/tv/hosts/laptop": { ip6: "42::1" } }, + members: [["continuum:a", "tv"]], + proposals: { "22": { proposals: ["cc"], votes: ["dd"], yes: ["tv"], no: [], + passed: false, dead: false } } }; + federation.refused = { own: [], dropped: [], refused: [] }; + federation.versions.set("22", next); + showFederation(); + renderFederation(true); + const tree = document.getElementById("federation"); + return { writers, title: document.getElementById("document-title").textContent, + shown: !document.getElementById("federation-scroll").hidden + && document.getElementById("document-scroll").hidden, + text: tree.textContent, votes: tree.querySelectorAll(".votes button").length }; + }); + check(JSON.stringify(federated.writers) === JSON.stringify(["tv", null, null, "tv", null]), + "who writes at a place is the first rule matching it: " + JSON.stringify(federated.writers)); + check(federated.title === "Federation" && federated.shown, + "in a swarm holding a store, the document box shows the federation"); + check(federated.text.includes("motd: \"hello\" by tv"), "a value, with who writes there"); + check(federated.text.includes("can still pass") && federated.text.includes("number: 0 -> 1") + && federated.text.includes('keys.lass: {"keys":["ssh-ed25519 AAAA2"],"since":0} -> ' + + '{"keys":["ssh-ed25519 AAAA3"],"since":1}'), + "a proposal: where it stands, and what its version changes, party by party"); + check(federated.votes === 2, "a proposal that can still pass has a vote of each kind"); + await tab.waitForTimeout(500); check(errors.length === 0, "no errors on the page" + (errors.length ? ": " + errors : "")); await browser.close(); diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index a20e64c..a918532 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -328,6 +328,15 @@ .tree details[open] > summary::before { content: "▾"; } .tree details > .note { padding-left: 1.1em; } .key { color: var(--muted); } + /* The federation (`#federation`): where a proposal stands, its votes, the filter. */ + #federation .standing { font-weight: 600; } + #federation .standing.passed { color: var(--ok); } + #federation .standing.dead { color: var(--bad); } + #federation .leaf { overflow-wrap: anywhere; } + #federation input.filter { width: 100%; box-sizing: border-box; font: inherit; + color: var(--fg); background: var(--bg); border: 1px solid var(--line); + border-radius: 4px; padding: 2px 4px; margin: 2px 0 4px; } + #federation .votes button.toggle { float: none; margin: 2px 6px 2px 0; } /* What a value or key means, after it (`gloss`): an alias, a time, a size. */ .gloss { color: var(--muted); } </style> @@ -387,8 +396,9 @@ <div class="scroll"><div id="stats" class="tree"></div></div> </section> <section id="document-box"> - <h2>Document<span id="document-head" class="count"></span><button id="remake-toggle" class="toggle" aria-expanded="false" - title="Propose a remake of the document: compacted, replaced by JSON, or imported from an Automerge document (docs/remakes.md)">remake…</button></h2> + <h2><span id="document-title">Document</span><span id="document-head" class="count"></span><button id="remake-toggle" class="toggle" aria-expanded="false" + title="Propose a remake of the document: compacted, replaced by JSON, or imported from an Automerge document (docs/remakes.md)">remake…</button><button + id="federation-toggle" class="toggle" hidden>document</button></h2> <form id="remake" class="popdown" hidden> <label>kind <select id="remake-kind"> <option value="compact">compact</option> @@ -430,7 +440,8 @@ <button type="button" id="remake-cancel" class="toggle">cancel</button></div> <p id="remake-result" class="note" hidden></p> </form> - <div class="scroll"><div id="document" class="tree"></div></div> + <div class="scroll" id="document-scroll"><div id="document" class="tree"></div></div> + <div class="scroll" id="federation-scroll" hidden><div id="federation" class="tree"></div></div> </section> <div id="column-hint" class="note">Drag the space left of these boxes to the right to hide the column.</div> @@ -2260,8 +2271,10 @@ documentRoot.classList.add("root"); documentRoot.open = true; document.getElementById("document-head").append( ...[...documentRoot.querySelector(":scope > summary").childNodes].slice(1)); -// The title stands for the root: its menu adds a key at the top level. -withMenu(document.querySelector("#document-box > h2"), documentRoot.menuItems); +// The title stands for the root: its menu adds a key at the top level (none while the +// box shows the federation). +withMenu(document.querySelector("#document-box > h2"), + () => federating() ? [] : documentRoot.menuItems()); document.getElementById("document").replaceChildren(documentRoot); // A box is busy while text in it is selected: drawing it anew would lose the selection, @@ -2287,6 +2300,7 @@ function render(ages = false) { document.getElementById("clock-warning").textContent = skew && skew.off ? "clock " + seconds(skew.offsetMs) + " off its peers'" : ""; held = false; + showFederation(); const boxes = [["peers-box", renderPeers], ["figures-box", renderStats]]; // Its ages are in tooltips only: drawn on events, not every second. if (!ages) boxes.push(["map", renderGraph]); @@ -2297,6 +2311,7 @@ function render(ages = false) { // What waited for a box to be free: drawn, or applied, now. function release() { if (held) render(); + if (federationHeld) renderFederation(true); if (documentPending !== null && !busy(document.getElementById("document-box"))) { const change = documentPending; documentPending = null; @@ -4231,6 +4246,364 @@ function connect() { } }); } +// --- The federation: in a swarm holding a store (the snapshot names the node's party), +// the box shows what counts as this node reads it (`GET /events`, `/events/counts`, +// `/events/refused`; docs/guides/federation/) instead of the document, until `document` +// says otherwise: the current version, the parties, the rules, the values at places (each +// with who writes there), the proposals on the version (where each stands, who voted +// what, and what its version changes) and what the node refused. A vote goes through +// this node (`POST /admin/events/vote`), which casts it only where it votes for its party +// by itself (`votesByItself`). Read every 5 s while shown, what counts anew where the +// store's heads changed. Writing values takes a key of the party, which the page has +// none of: `continuum-party write`. --- +const federation = { summary: undefined, counts: null, refused: null, heads: null, + versions: new Map(), document: false, filter: "", error: null, answers: new Map(), + drawn: null }; +const federationOpen = new Set(["values", "proposals"]), federationClosed = new Set(); +let federationHeld = false, federationTimer = null; +try { federation.document = localStorage.getItem("continuum-federation") === "document"; } +catch (_) { /* not kept: the federation */ } +// Whether the box shows the federation: this node holds a store, and `document` isn't on. +const federating = () => !!(state && state.node.party) && !federation.document; +async function federationRead(url, init) { + const response = await fetch(url, withToken(Object.assign({ cache: "no-store" }, init))); + const answer = await response.json().catch(() => ({})); + if (!response.ok) throw refused(response.status, answer.error || response.statusText); + return answer; +} +async function readFederation() { + try { + // 404: no store held (yet). + const summary = await federationRead("../events").catch(error => { + if (error.status === 404) return null; + throw error; + }); + federation.summary = summary; + if (summary && summary.heads.join(" ") !== federation.heads) { + const [counts, refusedEvents] = await Promise.all([ + federationRead("../events/counts"), federationRead("../events/refused")]); + // Each proposal's version, from the first event proposing it. + for (const [hash, proposal] of Object.entries(counts.proposals)) { + if (federation.versions.has(hash) || !proposal.proposals.length) continue; + const event = await federationRead("../events/" + proposal.proposals[0]); + federation.versions.set(hash, event.proposal); + } + federation.counts = counts; + federation.refused = refusedEvents; + federation.heads = summary.heads.join(" "); + } + federation.error = null; + } catch (error) { + federation.error = error.message; + } + renderFederation(); +} +function pollFederation() { + clearTimeout(federationTimer); + federationTimer = null; + if (!federating()) return; + if (!document.hidden && !hidden(document.getElementById("document-box"))) readFederation(); + federationTimer = setTimeout(pollFederation, 5000); +} +// The box as the snapshot says: the toggle where the node holds a store, and the +// federation or the document in it. +function showFederation() { + const shown = federating(); + const toggle = document.getElementById("federation-toggle"); + toggle.hidden = !(state && state.node.party); + toggle.textContent = shown ? "document" : "federation"; + toggle.title = shown + ? "Show the document underneath: the events at _continuum/events, and each node's protocol data" + : "Show the federation: what counts, the proposals and the votes"; + document.getElementById("document-title").textContent = shown ? "Federation" : "Document"; + document.getElementById("document-head").hidden = shown; + document.getElementById("document-scroll").hidden = shown; + document.getElementById("federation-scroll").hidden = !shown; + if (shown && federationTimer === null) pollFederation(); +} +document.getElementById("federation-toggle").addEventListener("click", () => { + federation.document = !federation.document; + try { + localStorage.setItem("continuum-federation", federation.document ? "document" : "federation"); + } catch (_) { /* not kept */ } + showFederation(); + renderFederation(true); +}); +// Who writes at `path` by `rules`, the current version's, `parties` its parties: the +// first rule whose path matches (`Version::writer`); null for nobody. +function writerAt(rules, parties, path) { + const given = path.split("/"); + for (const rule of rules) { + const segments = rule.path.split("/"); + const rest = segments[segments.length - 1] === "**"; + const fixed = rest ? segments.length - 1 : segments.length; + if (rest ? given.length <= fixed : given.length !== fixed) continue; + let named = null, matched = true; + for (let i = 0; i < fixed && matched; i++) { + if (segments[i] === "{party}") { + if (parties.includes(given[i])) named = given[i]; else matched = false; + } else if (segments[i] !== "*" && segments[i] !== given[i]) matched = false; + } + if (!matched) continue; + return rule.writer === false ? null : rule.writer === "{party}" ? named : rule.writer; + } + return null; +} +const isObject = value => value !== null && typeof value === "object" && !Array.isArray(value); +// JSON with object members sorted: two values alike are spelled alike. +function canonical(value) { + if (Array.isArray(value)) return "[" + value.map(canonical).join(",") + "]"; + if (isObject(value)) { + return "{" + Object.keys(value).sort() + .map(key => JSON.stringify(key) + ":" + canonical(value[key])).join(",") + "}"; + } + return JSON.stringify(value); +} +// What the version `proposed` changes of `current`, a line each, as `continuum-party +// proposals` says it (`client::changes`): each field whose value differs, and of `keys` +// and `nodes` each party's, `-` where a version lacks it. +function versionChanges(current, proposed) { + const text = value => value === undefined ? "-" : canonical(value); + const union = (a, b) => [...new Set([...Object.keys(a), ...Object.keys(b)])].sort(); + const lines = []; + for (const name of union(current, proposed)) { + const before = current[name], after = proposed[name]; + if (text(before) === text(after)) continue; + if (!((name === "keys" || name === "nodes") && isObject(before) && isObject(after))) { + lines.push(name + ": " + text(before) + " -> " + text(after)); + continue; + } + for (const party of union(before, after)) { + if (text(before[party]) !== text(after[party])) { + lines.push(name + "." + party + ": " + text(before[party]) + " -> " + text(after[party])); + } + } + } + return lines; +} +// A branch of the federation's tree, open as it was left (`openByDefault` until then). +function federationBranch(key, title, children, openByDefault = false) { + const details = el("details", {}, el("summary", {}, ...[].concat(title))); + details.open = federationOpen.has(key) || (openByDefault && !federationClosed.has(key)); + details.addEventListener("toggle", () => { + if (details.open) { federationOpen.add(key); federationClosed.delete(key); } + else { federationOpen.delete(key); federationClosed.add(key); } + }); + details.append(...children()); + return details; +} +function federationLeaf(text, more, title) { + const leaf = el("div", { class: "leaf" }, text); + if (more) leaf.append(" ", el("span", { class: "gloss" }, more)); + if (title) leaf.title = title; + return leaf; +} +// The values at places, as a tree by their paths' segments, each with who writes there, +// those whose path holds the filter's text only. +function federationValues(counts) { + const rules = counts.version.version.rules || []; + const parties = Object.keys(counts.parties); + const places = Object.keys(counts.values).sort(); + // A place's value, inline where it's no object or array, and who writes there. + const value = place => { + const held = counts.values[place]; + const writer = el("span", { class: "gloss" }, "by " + (writerAt(rules, parties, place) || "nobody")); + return held !== null && typeof held === "object" + ? [" ", writer, el("pre", {}, JSON.stringify(held, null, 2))] + : [": " + JSON.stringify(held) + " ", writer]; + }; + const tree = () => { + const shown = places.filter(place => place.includes(federation.filter)); + if (!shown.length) { + return [el("div", { class: "note" }, + places.length ? "No place's path holds that." : "No place holds a value.")]; + } + const nest = {}; + for (const place of shown) { + let at = nest; + const segments = place.split("/"); + segments.forEach((segment, i) => { + at[segment] = at[segment] || { children: {}, place: null }; + if (i === segments.length - 1) at[segment].place = place; + at = at[segment].children; + }); + } + const draw = (level, prefix) => Object.keys(level).sort().map(segment => { + const node = level[segment]; + const path = prefix ? prefix + "/" + segment : segment; + const children = draw(node.children, path); + if (node.place !== null && !children.length) { + const leaf = el("div", { class: "leaf" }, el("span", { class: "key" }, segment), + ...value(node.place)); + leaf.title = node.place; + return leaf; + } + return federationBranch("place " + path, el("span", { class: "key" }, segment), + () => [...(node.place !== null ? [federationLeaf("", null, node.place)] : []), ...children], + federation.filter !== ""); + }); + return draw(nest, ""); + }; + return federationBranch("values", ["values ", el("span", { class: "gloss" }, places.length)], + () => { + const filter = el("input", { type: "text", class: "filter", + placeholder: "only places whose path holds this" }); + filter.value = federation.filter; + const list = el("div", {}, ...tree()); + filter.addEventListener("input", () => { + federation.filter = filter.value; + list.replaceChildren(...tree()); + }); + return [filter, list]; + }); +} +async function federationVote(hash, yes) { + try { + const answer = await federationRead("events/vote", { method: "POST", + headers: { "Content-Type": "application/json" }, body: JSON.stringify({ proposal: hash, yes }) }); + federation.answers.set(hash, { ok: true, text: "voted " + yes + ": " + short(answer.id) }); + } catch (error) { + federation.answers.set(hash, { ok: false, text: error.message }); + } + federation.heads = null; + readFederation(); +} +// Casts a vote on a second click within 3 s of the first: a vote isn't taken back. +function federationVoteButton(hash, yes) { + const label = "vote " + yes; + const button = el("button", { type: "button", class: "toggle", + title: "Vote " + yes + " on this proposal for this node's party, through this node: " + + "a vote isn't taken back, so a second click casts it" }, label); + let sure = null; + button.addEventListener("click", () => { + if (sure === null) { + button.textContent = label + ": sure?"; + sure = setTimeout(() => { sure = null; button.textContent = label; }, 3000); + return; + } + clearTimeout(sure); + sure = null; + button.disabled = true; + federationVote(hash, yes); + }); + return button; +} +function federationProposals(counts, summary) { + const proposals = Object.entries(counts.proposals); + const title = ["proposals on version " + counts.version.number + " ", + el("span", { class: "gloss" }, proposals.length)]; + return federationBranch("proposals", title, () => { + if (!proposals.length) { + return [el("div", { class: "note" }, "None: a party proposes a version with " + + "continuum-party propose (docs/guides/federation/proposing-and-voting.md).")]; + } + return proposals.map(([hash, proposal]) => { + const standing = proposal.passed ? "passed" : proposal.dead ? "dead" : "can still pass"; + const head = [el("span", { class: "id" }, short(hash)), " ", + el("span", { class: "standing " + standing.split(" ")[0] }, standing), " ", + el("span", { class: "gloss" }, "true: " + (proposal.yes.join(", ") || "nobody") + + " · false: " + (proposal.no.join(", ") || "nobody"))]; + return federationBranch("proposal " + hash, head, () => { + const count = (n, one) => n + " " + one + (n === 1 ? "" : "s"); + const parts = [federationLeaf("proposed by " + count(proposal.proposals.length, "event") + + " · " + count(proposal.votes.length, "vote"), null, + [...proposal.proposals, ...proposal.votes].join("\n"))]; + const proposed = federation.versions.get(hash); + if (proposed === undefined) { + parts.push(el("div", { class: "note" }, "Its version isn't read yet.")); + } else { + parts.push(...versionChanges(counts.version.version, proposed) + .map(line => federationLeaf(line))); + } + if (!proposal.passed && !proposal.dead) { + if (summary.votesByItself) { + const answer = federation.answers.get(hash); + parts.push(el("div", { class: "leaf votes" }, federationVoteButton(hash, true), + federationVoteButton(hash, false), + ...(answer ? [el("span", { class: answer.ok ? "note" : "error" }, answer.text)] : []))); + } else { + parts.push(el("div", { class: "note" }, "This node doesn't vote for its party by " + + "itself, so it casts no vote by hand: continuum-party vote " + hash + " yes|no")); + } + } + return parts; + }, true); + }); + }); +} +function federationRefused(refusedEvents) { + const own = refusedEvents.own || [], dropped = refusedEvents.dropped || []; + const rest = refusedEvents.refused || []; + const title = ["refused ", el("span", { class: own.length ? "error" : "gloss" }, + own.length + " by what this node took before"), + el("span", { class: "gloss" }, " · " + dropped.length + " dropped · " + rest.length + + " as every node refuses them")]; + return federationBranch("refused", title, () => [ + ...own.map(id => federationLeaf(short(id), "by what this node took before: keys voted " + + "twice, tell its party (docs/guides/federation/when-things-go-wrong.md)", id)), + ...dropped.map(id => federationLeaf(short(id), "dropped as this node's operator says", id)), + ...rest.map(entry => federationLeaf(short(entry.id), entry.kind + ": " + entry.why, entry.id))]); +} +// Draws the federation, where something changed since it was drawn (or `force`), unless +// the box is busy (`federationHeld` until it isn't); the filter keeps its focus. +function renderFederation(force = false) { + if (!federating()) return; + const box = document.getElementById("document-box"); + const drawn = JSON.stringify([federation.summary, federation.heads, federation.error, + [...federation.answers], federation.versions.size]); + if (!force && drawn === federation.drawn) return; + if (busy(box)) { federationHeld = true; return; } + federationHeld = false; + federation.drawn = drawn; + const parts = []; + if (federation.error) parts.push(el("div", { class: "error" }, federation.error)); + const summary = federation.summary, counts = federation.counts; + if (summary === null) { + parts.push(el("div", { class: "note" }, + "This node holds no store yet: it is still reading it from its document, or joining.")); + } else if (!summary || !counts) { + parts.push(el("div", { class: "note" }, "Reading…")); + } else { + const version = counts.version; + const parties = Object.keys(counts.parties); + const rules = version.version.rules || []; + parts.push( + federationLeaf("version " + version.number, short(version.hash), version.hash), + federationLeaf("store " + short(summary.store), "checkpoint " + (summary.checkpoint === summary.store + ? "the root" : short(summary.checkpoint)) + " · " + summary.taken + " events taken after it", + summary.store), + federationLeaf("this node", "of " + summary.party + (summary.votesByItself + ? ", voting for it by itself" : ", not voting for it by itself")), + federationBranch("parties", ["parties ", el("span", { class: "gloss" }, parties.length)], + () => parties.map(party => { + const keys = counts.parties[party].keys, nodes = counts.parties[party].nodes; + return federationBranch("party " + party, [party, " ", el("span", { class: "gloss" }, + keys.length + (keys.length === 1 ? " key · " : " keys · ") + nodes.length + + (nodes.length === 1 ? " node" : " nodes"))], + () => [...keys.map(key => federationLeaf(key)), + ...nodes.map(node => federationLeaf(node, [aliasOf(node), + counts.members.some(([id]) => id === node) ? "member" : "not a member"] + .filter(Boolean).join(" · ")))]); + })), + federationBranch("rules", ["rules ", el("span", { class: "gloss" }, rules.length)], + () => rules.map(rule => federationLeaf(rule.path + " -> " + + (rule.writer === false ? "nobody" : rule.writer)))), + federationValues(counts), + federationProposals(counts, summary), + federationRefused(federation.refused)); + } + const at = document.activeElement; + const typing = at && at.matches("#federation input.filter") + ? [at.selectionStart, at.selectionEnd] : null; + const tree = document.getElementById("federation"); + tree.replaceChildren(...parts); + const filter = tree.querySelector("input.filter"); + if (typing && filter) { + filter.focus(); + filter.setSelectionRange(...typing); + } +} + // --- Remakes: proposed from here (`POST /admin/remakes`, `docs/remakes.md`): compact, // replace by JSON (typed, or from a file), import an Automerge document (uploaded as // it is). This node coordinates it and votes for it; the map shows it as it goes. --- diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index 9cf88a1..15b8cf9 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -395,8 +395,13 @@ async fn build(state: &AppState, graph: &Graph) -> JsonValue { "dashboard": dashboards.get(member) }), ); } + // In a swarm holding a store, the party this node is of: the page shows the store. + #[cfg(feature = "federation")] + let party = state.holding.party(); + #[cfg(not(feature = "federation"))] + let party: Option<&str> = None; json!({ - "node": { "id": local, "alias": state.alias }, + "node": { "id": local, "alias": state.alias, "party": party }, "page": page().0, "stats": stats, "peers": peers, @@ -900,7 +905,8 @@ mod tests { } /// The page in a browser (`check.js`): it loads without errors, the peers table and - /// the map draw what the state says, and a large map doesn't hold the page up. + /// the map draw what the state says, a large map doesn't hold the page up, and the + /// federation shows who writes where, what a proposal changes, and the votes. /// Needs Node.js with Playwright's library and its Chromium (`check.nix` gives them), /// so only when asked: `cargo test --features dashboard dashboard_in_a_browser -- /// --ignored`. |
