Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: add a destroy trigger to the agents page

Closes #4067. Backend half (Wanted::Destroyed + reconcile) shipped in
#4065 with no swarm-controller API changes needed -- SetAgentStateRequest
already accepted {"state": "destroyed"}, it just had nothing in swarm-ui
sending it.

Destroy is a separate `quiet`-variant badge next to the existing
start/stop toggle (#3988's "wanted" column), not a third state folded
into that same click target -- one wrong click on a shared toggle
would be irreversible, where a dedicated badge only fires from its own
confirm dialog. That confirm is a real `Dialog`, not the native
`window.confirm` the reversible stop direction uses -- the wanted
column's own comment called this out as the case that would justify
one when it was first written.

Shared the PUT-declare/pending/error/patch-rows logic between the
existing toggleWanted and the new destroyAgent (declareState) rather
than duplicating it -- confirmation and target-state selection are the
only parts that differ between a toggle and a one-way declaration.

Verified: `tsc --noEmit` clean, `nix fmt` reports the expected
formatting-only diff, wire shapes (state string "destroyed",
AgentDeclaration response) checked against swarm-queue-client's
AgentState::as_str and swarm-controller's actual handler rather than
assumed from the issue description.
This commit is contained in:
iris 2026-09-07 18:53:35 +02:00
commit becc025f13
2 changed files with 112 additions and 27 deletions

View file

@ -0,0 +1,17 @@
/* <AgentsPage> — the destroy-confirm dialog's own layout. Everything
else on this page (the table, the wanted/destroy badges) draws chrome
from the shared `ui/` kit and needs nothing page-scoped; this file
exists only because the confirm dialog's copy + button row needed
somewhere to live, same reasoning as CreateAgentForm.css owning its
own layout next to the shared form-kit chrome it wraps. */
.agents-destroy-confirm {
display: flex;
flex-direction: column;
gap: 1em;
max-width: 28em;
}
.agents-destroy-confirm-actions {
display: flex;
justify-content: flex-end;
gap: 0.75em;
}