swarm-ui: add required hive dropdown to CreateAgentPage

Closes #3434.

Agent creation had no way to record which hive an agent runs on.
POST /api/agents now requires a hive, so the roster fetched off
GET /api/hives backs a required SelectField here rather than a
free-text field. Single-hive swarms auto-select their only hive;
multi-hive swarms show a disabled placeholder and force an explicit
choice.

Rebuilt on top of the #3448 form kit (merged after this branch was
originally opened): reuses TextField/SelectField/Button instead of
page-scoped input chrome, and SelectField gains an optional disabled
placeholder option (needed for the loading/empty/multi-hive states
here, generalizes cleanly for future callers). Form goes back to a
column layout per mara's earlier visual feedback on this same page
(two fields of different natural width no longer line up in a row).
This commit is contained in:
iris 2026-08-18 20:34:27 +02:00 committed by mara
commit 5fdbf0b452
3 changed files with 86 additions and 12 deletions

View file

@ -1,16 +1,19 @@
/* <CreateAgentPage> the create-agent form. Input/button chrome now
comes from the shared `ui/` form kit (`TextField`/`Button`); this
file only owns the page's own layout + copy. Reuses the same base16
slots (../theme.css) every other component draws from. */
comes from the shared `ui/` form kit (`TextField`/`SelectField`/
`Button`); this file only owns the page's own layout + copy. Column,
not row: with a second field (hive) added, a row layout put fields of
different natural widths on one baseline and looked misaligned
mara: "make it a col". Reuses the same base16 slots (../theme.css)
every other component draws from. */
.create-agent-intro {
margin: 0 0 1.5em;
color: var(--muted);
}
.create-agent-form {
display: flex;
align-items: flex-end;
flex-direction: column;
align-items: flex-start;
gap: 0.75em;
flex-wrap: wrap;
}
.create-agent-result {
margin-top: 1em;