swarm-ui: one badge+dropdown for wanted state, not multiple buttons
mara, hyperhive#4079: "agent wanted state is multiple buttons insteaf of a badge with dropdown ... same pattern as agent term badges with dropdowns". The wanted column used to be a toggle badge plus a separate quiet destroy badge, stacking under each other in the narrow column. Replaced both with one WantedMenu badge that opens a Dropdown with the three explicit states (up/offline/destroy) -- the exact badge-triggers-a-dropdown shape the per-agent terminals StatusChips already uses (and swarm-uis own ComponentsPage already demos with sample data), built from the same shared Badge/Dropdown components. "up" still declares straight away with no confirmation; "offline" and "destroy" still go through the existing ConfirmDialog modals unchanged -- only the trigger moved, the confirm behavior for the two directions that already had one is untouched. Explicit dropdown options also fix a real bug the old toggle had: mara also asked "when no state is declared, i want to set it to online" -- the old toggle inferred a target as the opposite of snapshot.running for an undeclared row, so a click on an undeclared-but-running agent silently declared it offline rather than making its actual state explicit. The dropdown just lets "up" be picked directly regardless of any inference, which is what she is asking for -- flagging this reading explicitly in case an actual one-time migration (auto-declaring every currently-undeclared agent up) was intended instead, which this does not do. Added a shared .ui-dropdown-anchor utility class to Dropdown.css -- this is the third near-identical "position: relative wrapper for a badge that opens a Dropdown" (after agents own StatusChips.css and swarm-uis ComponentsPage.css), so a new caller should not reinvent a fourth copy. Left the two existing ones alone rather than migrating them as a drive-by. Verified with a local esbuild build + a throwaway mock /api/agents/status server, screenshotted headlessly: the wanted column now shows exactly one badge per row instead of stacked badges.
This commit is contained in:
parent
c18aee8f74
commit
6f57b1f57c
2 changed files with 113 additions and 84 deletions
|
|
@ -3,6 +3,19 @@
|
|||
comment) so it hangs directly under the badge that opened it.
|
||||
`--bg-elev` is the same elevated-surface slot the badge uses when
|
||||
open (../badge/Badge.css), so the pair reads as one continuous panel. */
|
||||
/* Reusable wrapper for the "badge that opens a `Dropdown` right
|
||||
underneath itself" shape: `position: relative` is what lets
|
||||
`.ui-dropdown`'s `position: absolute` above anchor to this box
|
||||
instead of the page. A couple of callers predate this and declare
|
||||
their own page-scoped copy of the same two rules (agent's
|
||||
`StatusChips.css` `.status-chip-anchor`, swarm-ui's
|
||||
`ComponentsPage.css` `.components-badge-anchor`) — left alone here
|
||||
rather than migrated as a drive-by, but a *new* caller should reach
|
||||
for this instead of reinventing a third one. */
|
||||
.ui-dropdown-anchor {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.ui-dropdown {
|
||||
position: absolute;
|
||||
top: calc(100% + 0.25em);
|
||||
|
|
|
|||
Loading…
Reference in a new issue