Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/swarm-ui/src/pages/schedules/agent-options.ts
iris 8c67ac01fe swarm-ui: show, sort and filter the hive domain by one value, say when the roster is empty, keep the schedule agent picker current
The domain column showed a dash unless a hive had a dashboard but sorted
and filtered on the domain alone, so rows looked mis-sorted. It now shows
the domain as text when there is no dashboard to link. An empty hive
roster says so. The schedule form's agent names reload with the schedules
and the form says when that load failed.
2026-10-21 23:22:22 +02:00

18 lines
657 B
TypeScript

// The agent names a schedule form offers.
/** Sorted names from the agent roster; none while it has not loaded. */
export function agentNamesFrom(
rows: readonly { name: string }[] | null,
): string[] {
return (rows ?? []).map((a) => a.name).sort();
}
/** The roster names plus the schedule's own agents, sorted without repeats. A
* schedule can still target an agent that has since left the roster, so an
* edit keeps those pickable and can drop them. */
export function agentOptionsFor(
names: readonly string[],
schedule?: { agents: readonly string[] },
): string[] {
return [...new Set([...names, ...(schedule?.agents ?? [])])].sort();
}