swarm-ui: the schedule form picks agents from the same card grid as the broadcast
The grid becomes a shared AgentPicker; the broadcast composer uses it too.
This commit is contained in:
parent
175019607c
commit
79b1fc35c5
2 changed files with 128 additions and 102 deletions
|
|
@ -11,15 +11,6 @@
|
|||
flex-direction: column;
|
||||
gap: 0.3em;
|
||||
}
|
||||
/* The picker's own list is a scrolling column sized for a filter popover; in
|
||||
a form the agents read better as a wrapping row, all visible at once. */
|
||||
.ui-schedule-form-agents .ui-multiselect-filter-options {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.3em 1.2em;
|
||||
max-height: none;
|
||||
overflow-y: visible;
|
||||
}
|
||||
.ui-schedule-form-hint {
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,12 @@
|
|||
import { useState } from "preact/hooks";
|
||||
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
|
||||
import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
|
||||
import { AgentPicker } from "../../agent/picker/AgentPicker.js";
|
||||
import { ActionRow } from "../../ui/action-row/ActionRow.js";
|
||||
import { Button } from "../../ui/button/Button.js";
|
||||
import { FieldGrid } from "../../ui/field-grid/FieldGrid.js";
|
||||
import { Card } from "../../ui/card/Card.js";
|
||||
import { Hint } from "../../ui/hint/Hint.js";
|
||||
import {
|
||||
MultiselectFilterOptions,
|
||||
type MultiselectFilterState,
|
||||
} from "../../ui/multiselect-filter/MultiselectFilter.js";
|
||||
import { SelectField } from "../../ui/select-field/SelectField.js";
|
||||
import { TextAreaField } from "../../ui/text-area-field/TextAreaField.js";
|
||||
import { TextField } from "../../ui/text-field/TextField.js";
|
||||
|
|
@ -101,7 +98,6 @@ export function ScheduleForm({
|
|||
const cadenceValid =
|
||||
startUnix !== null && (!repeat || intervalSeconds !== null);
|
||||
|
||||
const picked: MultiselectFilterState = { values: agents, negate: false };
|
||||
const toggleAgent = (a: string) =>
|
||||
setAgents((cur) =>
|
||||
cur.includes(a) ? cur.filter((x) => x !== a) : [...cur, a],
|
||||
|
|
@ -199,9 +195,9 @@ export function ScheduleForm({
|
|||
: "no agents to pick from"}
|
||||
</Hint>
|
||||
) : (
|
||||
<MultiselectFilterOptions
|
||||
options={agentOptions}
|
||||
filter={picked}
|
||||
<AgentPicker
|
||||
options={agentOptions.map((name) => ({ name }))}
|
||||
selected={agents}
|
||||
onToggle={toggleAgent}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue