swarm-ui: bounded-domain table filters become dropdowns

Table columns whose value only ever comes from a small closed set
(freshness, wanted, hive) get a <select> in their filter-row cell
instead of a free-text input, populated from the distinct values
present in the currently-loaded rows plus an "any" option, matched by
exact equality instead of substring. Free-text columns (name, the
agent's own status message, config PR, hive domain) are unchanged.
This commit is contained in:
iris 2026-09-08 00:23:07 +02:00 committed by mara
commit 4544c458eb
4 changed files with 63 additions and 8 deletions

View file

@ -310,7 +310,11 @@ export function AgentsPage() {
header: "hive",
render: (a) => a.hive ?? "—",
sortBy: (a) => a.hive ?? "",
filterValue: (a) => a.hive ?? "",
// "—" (not "") so the missing-hive option in the filter dropdown
// reads the same as the cell itself, rather than showing a blank
// choice.
filterValue: (a) => a.hive ?? "—",
filterMode: "select",
},
{
key: "status",
@ -322,6 +326,7 @@ export function AgentsPage() {
// now lives in its own "message" column below.
sortBy: (a) => FRESHNESS[a.freshness].label,
filterValue: (a) => FRESHNESS[a.freshness].label,
filterMode: "select",
render: (a) => {
const { tone, label } = FRESHNESS[a.freshness];
return (
@ -367,6 +372,7 @@ export function AgentsPage() {
// callbacks to the page's own state/handlers.
sortBy: (a) => a.wanted ?? "",
filterValue: (a) => a.wanted ?? "no declaration",
filterMode: "select",
render: (a) => {
const err = actionErrors.get(a.name);
return (

View file

@ -92,6 +92,7 @@ const COLUMNS: TableColumn<HiveStatus>[] = [
},
sortBy: (h) => FRESHNESS[h.freshness].label,
filterValue: (h) => FRESHNESS[h.freshness].label,
filterMode: "select",
},
];