swarm-ui: make agent creation a five-step dialog with a fixed header and footer
The create dialog was one tall form that scrolled as a whole, so its header and button moved out of view. It is now steps you go through in order: identity, instructions (AGENTS.md in a box of its own), permissions, resources and inference, then a summary of what will be sent and what the agent creation queues, where create is. The header, step tabs and footer stay put and only the step's own fields scroll. A refused AGENTS.md text sends the dialog back to its step. The request is unchanged.
This commit is contained in:
parent
f0a80c9812
commit
339da0aebe
1 changed files with 662 additions and 246 deletions
|
|
@ -1,75 +1,127 @@
|
|||
/* <CreateAgentForm> — the create-agent form, rendered inside a `Dialog`
|
||||
from `AgentsPage` (see that component's file-top comment for why).
|
||||
Input/button chrome comes from the shared `ui/` form kit
|
||||
(`TextField`/`SelectField`/`Button`); this file only owns this
|
||||
component's own layout + copy. Column,
|
||||
not row inside the form itself: 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.
|
||||
/* <CreateAgentForm> — the create-agent dialog, a stepper rendered inside a
|
||||
`Dialog` from `AgentsPage`. Input/button chrome comes from the shared `ui/`
|
||||
form kit; this file owns the layout: a header, the step tabs and a footer
|
||||
that stay put while only the step's own fields scroll.
|
||||
|
||||
This layout dropped an explicit page `max-width` after a few rounds:
|
||||
first added so bare `Panel` (no width opinion of its own) wouldn't
|
||||
fill `.shell-body`'s full 60em column behind a narrow form (the
|
||||
original "weird empty space" complaint), then widened for two panels
|
||||
side by side — but once both were equal-width flex children that cap
|
||||
itself became "doesn't fill the space" (mara: "the cards are neither
|
||||
centered nor fill the space tho"). Removing it lets the row fill
|
||||
`.shell-body`'s own width like most pages — nothing sits off-center
|
||||
once nothing is narrower than the row.
|
||||
|
||||
`.create-agent-form-col`/`.create-agent-info-col` are equal-sized
|
||||
(`flex: 1 1 0` — zero basis so the 1.5em `gap` splits the row evenly,
|
||||
not each column keeping its natural content width) per mara's "both
|
||||
cards should be equal sized". `min-width` is the wrap threshold below
|
||||
which the row goes single-column instead (info card moving under the
|
||||
form) — no separate media query needed. Inputs fill their whole
|
||||
column now too ("inputs should fill full card width") — the kit's
|
||||
`.ui-form-control`/`.ui-form-field` dropped their old 16em cap for
|
||||
exactly this (../ui/form-field/FormField.css). */
|
||||
.create-agent-layout {
|
||||
`.create-agent-panel` is a column no taller than the dialog (85vh, the
|
||||
dialog's own cap), and its body hands all that height to the step. */
|
||||
.create-agent-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
width: min(90vw, 44em);
|
||||
max-height: 85vh;
|
||||
}
|
||||
.create-agent-panel > .ui-panel-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.create-agent-wizard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
gap: 0.75em;
|
||||
}
|
||||
.create-agent-steps {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
gap: 1.5em;
|
||||
gap: 0.35em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.create-agent-form-col,
|
||||
.create-agent-info-col {
|
||||
flex: 1 1 0;
|
||||
min-width: 16em;
|
||||
.create-agent-step-tab {
|
||||
padding: 0.3em 0.7em;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
background: var(--bg);
|
||||
color: var(--muted);
|
||||
font: inherit;
|
||||
font-size: 0.85em;
|
||||
cursor: pointer;
|
||||
}
|
||||
.create-agent-step-tab:disabled {
|
||||
cursor: default;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.create-agent-step-current {
|
||||
border-color: var(--purple);
|
||||
color: var(--fg);
|
||||
}
|
||||
/* The one part that scrolls. A floor keeps the dialog from changing height
|
||||
as the steps change. */
|
||||
.create-agent-step {
|
||||
flex: 1 1 auto;
|
||||
min-height: 18em;
|
||||
overflow-y: auto;
|
||||
}
|
||||
/* On a short window the floor gives way, so the footer stays on screen. */
|
||||
@media (max-height: 45em) {
|
||||
.create-agent-step {
|
||||
min-height: 8em;
|
||||
}
|
||||
}
|
||||
.create-agent-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0.75em;
|
||||
}
|
||||
.create-agent-intro {
|
||||
margin: 0 0 1.5em;
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
.create-agent-form {
|
||||
.create-agent-heading {
|
||||
margin: 0.5em 0 0;
|
||||
font-size: 1em;
|
||||
}
|
||||
.create-agent-footer {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
padding-top: 0.75em;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
/* Back on the left, then why next waits, then next (or create) on the right. */
|
||||
.create-agent-footer > :last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
.create-agent-hint {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
margin-left: 0.25em;
|
||||
color: var(--muted);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.create-agent-summary {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.75em;
|
||||
gap: 0.35em;
|
||||
margin: 0;
|
||||
}
|
||||
/* Optional settings, collapsed so the plain name-and-hive form stays short. */
|
||||
.create-agent-section {
|
||||
align-self: stretch;
|
||||
.create-agent-summary-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25em 1em;
|
||||
}
|
||||
.create-agent-section > summary {
|
||||
cursor: pointer;
|
||||
.create-agent-summary-row dt {
|
||||
flex: 0 0 9em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.create-agent-section-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.75em;
|
||||
margin-top: 0.75em;
|
||||
}
|
||||
.create-agent-result {
|
||||
margin-top: 1em;
|
||||
.create-agent-summary-row dd {
|
||||
flex: 1 1 12em;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.create-agent-result-ok {
|
||||
color: var(--green);
|
||||
}
|
||||
/* The controller's refusal of the AGENTS.md text, under its section. */
|
||||
/* The controller's refusal of the AGENTS.md text, under its box. */
|
||||
.create-agent-field-error {
|
||||
margin: 0;
|
||||
color: var(--red);
|
||||
|
|
|
|||
Loading…
Reference in a new issue