Fix the dashboard's pending-changes count; explain zones in the docs
The dashboard counted every open changeset, including empty ones and other users', so "Pending changes (1 open)" led to an empty Changes page. It now counts the user's own changesets that contain changes, the status API's open_changesets skips empty ones, and in review mode a draft created for an edit the server rejects is discarded instead of left open. docs/concepts.md: zone types, a new zone's name servers and glue, reverse zones for any network, and dynamic updates versus API tokens and TSIG keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
785b0006f9
commit
5cb8602a7f
5 files changed
+104
-6
No files matched your search
@@ -2,8 +2,10 @@ import { h, mount, time, problemsList, badge, plural } from "../ui.js";
|
||||
import { get, state } from "../api.js";
|
||||
|
||||
export async function render(el) {
|
||||
const st = await get("/status");
|
||||
const [st, mine] = await Promise.all([get("/status"), get("/changesets", { status: "open", mine: 1, limit: 50 }).catch(() => [])]);
|
||||
const s = st.engine || {};
|
||||
// The user's own changesets with something in them: what the Changes page shows.
|
||||
const pending = mine.filter((c) => (c.ops || []).length).length;
|
||||
const n = s.named;
|
||||
const cards = h("div", { class: "cards" },
|
||||
card("named", n ? (n.running ? badge("running", "ok") : badge("unknown", "warn")) : badge(s.named_error ? "unreachable" : "not checked", s.named_error ? "err" : ""),
|
||||
@@ -18,7 +20,7 @@ export async function render(el) {
|
||||
h("div", { class: "grow" }, h("h1", null, "Dashboard"), h("div", { class: "muted" }, "Signed in as " + state.me.user.username + " · " + (state.me.permissions || []).join(", "))),
|
||||
h("div", { class: "actions" },
|
||||
h("a", { class: "button primary", href: "#/zones?new=1" }, "New zone"),
|
||||
h("a", { class: "button", href: "#/changes" }, "Pending changes" + (s.open_changesets ? " (" + s.open_changesets + " open)" : "")))),
|
||||
h("a", { class: "button", href: "#/changes" }, "Pending changes" + (pending ? " (" + pending + " open)" : "")))),
|
||||
cards];
|
||||
if (s.drift && s.drift.length) {
|
||||
parts.push(h("div", { class: "msg warn" },
|
||||
|
||||
Reference in new issue
Block a user