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:
abrown38andClaude Opus 5.5 committed 2026-10-08 11:52:10 +00:00
1 parent 785b0006f9
commit 5cb8602a7f
5 files changed
+104 -6

No files matched your search

+8 -2
View File
@@ -1080,7 +1080,7 @@ type Status struct {
Drift []DriftEntry `json:"drift"`
Deployed bool `json:"deployed"`
LastApplied *model.Changeset `json:"last_applied,omitempty"`
OpenChangesets int `json:"open_changesets"`
OpenChangesets int `json:"open_changesets"` // with at least one operation
Problems []validate.Problem `json:"problems"`
Counts map[string]int `json:"counts"`
Paths render.Paths `json:"paths"`
@@ -1121,8 +1121,14 @@ func (e *Engine) Status(ctx context.Context) (*Status, error) {
s.LastApplied = list[0]
s.LastApplied.Ops = RedactOps(s.LastApplied.Ops)
}
// Only changesets with something in them: an empty one (a web UI draft
// whose edit was rejected, say) has nothing to review.
if list, err := e.store.ListChangesets(ctx, store.ChangesetFilter{Status: model.ChangesetOpen, Limit: 1000}); err == nil {
s.OpenChangesets = len(list)
for _, cs := range list {
if len(cs.Ops) > 0 {
s.OpenChangesets++
}
}
}
s.Problems = nonNilProblems(e.validate(st))
s.Counts = map[string]int{"views": len(st.Views), "zones": len(st.Zones), "records": len(st.Records), "acls": len(st.ACLs), "tsig_keys": len(st.Keys), "options": len(st.Options)}