Commit a5dbc6e
committed
Edit K8s endpoint aggregators as the stored YAML
Motivation:
The aggregator editor was a structured form that modeled only part of the schema, which
created a whole class of problems: fields the form did not model were silently dropped on
save, then preserved through an overlay mechanism, then rendered read-only so the
preservation was at least visible - three commits of machinery to keep a projection honest.
Every other xDS resource is already edited as the stored YAML itself, which has none of
these problems: what is on screen is exactly what is saved.
Modifications:
- Rewrite the editor to edit the stored YAML directly, following the ResourceEditor
precedent: a Monaco editor with the file content verbatim, Edit/Cancel/Save with a commit
summary, YAML syntax validation before save and preview, a Definition/History tab pair,
and a create flow with a commented template. The form, the overlay, the managed-key
bookkeeping, and the preserved-field displays are all deleted.
- Keep the optimistic locking: the revision the content was loaded at rides with the
update, a 409 surfaces as an update conflict while keeping the edit and the entered
text, and the next save is based on the revision the server reported for the previous
one. Cancel restores the last loaded or saved content - never the possibly stale cache
entry, which would let the next save silently roll back a successful one - and a refetch
that resolves late with a revision older than one a save already confirmed is ignored
instead of rolling the editor back. Saving without a known revision fails closed, and the
update API now requires the revision so no webapp caller can opt out of conflict
detection.
- A 404 renders an inline "Aggregator not found" alert (the ResourceEditor pattern)
instead of the generic error page, e.g. after following a link to a deleted aggregator.
- Tests rewritten at the text seam: the stored YAML renders verbatim and read-only (typing
is a no-op), the exact edited text and revision go on the wire, invalid YAML blocks both
save and preview, a 409 keeps the edit, consecutive saves chain revisions, Cancel after
a successful save restores the saved content, and an unknown revision refuses to save.
Result:
The aggregator editor shows and saves the stored document itself - no projection, nothing
dropped, kept, or ignored invisibly - at about a third of the code, and concurrent changes
still surface as conflicts instead of silent overwrites.1 parent 7c004c2 commit a5dbc6e
4 files changed
Lines changed: 510 additions & 1702 deletions
File tree
- webapp
- src/dogma/features/xds
- tests/dogma/features/xds
0 commit comments