swarm-ui: use multiselect for every enum-shaped table filter
This commit is contained in:
parent
516716fa93
commit
74cb0c2793
3 changed files with 29 additions and 24 deletions
|
|
@ -318,11 +318,13 @@ export function AgentsPage() {
|
||||||
header: "hive",
|
header: "hive",
|
||||||
render: (a) => a.hive ?? "—",
|
render: (a) => a.hive ?? "—",
|
||||||
sortBy: (a) => a.hive ?? "",
|
sortBy: (a) => a.hive ?? "",
|
||||||
// "—" (not "") so the missing-hive option in the filter dropdown
|
// "—" (not "") so the missing-hive option in the filter list reads
|
||||||
// reads the same as the cell itself, rather than showing a blank
|
// the same as the cell itself, rather than showing a blank choice.
|
||||||
// choice.
|
// Multiselect, not single-value `"select"` — an operator narrowing
|
||||||
filterValue: (a) => a.hive ?? "—",
|
// to a handful of hives at once shouldn't need to filter one at a
|
||||||
filterMode: "select",
|
// time.
|
||||||
|
filterValues: (a) => [a.hive ?? "—"],
|
||||||
|
filterMode: "multiselect",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "status",
|
key: "status",
|
||||||
|
|
@ -333,8 +335,9 @@ export function AgentsPage() {
|
||||||
// label and blew the row out (mara: "looks messy"). That string
|
// label and blew the row out (mara: "looks messy"). That string
|
||||||
// now lives in its own "message" column below.
|
// now lives in its own "message" column below.
|
||||||
sortBy: (a) => FRESHNESS[a.freshness].label,
|
sortBy: (a) => FRESHNESS[a.freshness].label,
|
||||||
filterValue: (a) => FRESHNESS[a.freshness].label,
|
// Multiselect, same reasoning as the hive column above.
|
||||||
filterMode: "select",
|
filterValues: (a) => [FRESHNESS[a.freshness].label],
|
||||||
|
filterMode: "multiselect",
|
||||||
render: (a) => {
|
render: (a) => {
|
||||||
const { tone, label } = FRESHNESS[a.freshness];
|
const { tone, label } = FRESHNESS[a.freshness];
|
||||||
return (
|
return (
|
||||||
|
|
@ -379,8 +382,9 @@ export function AgentsPage() {
|
||||||
// real per-badge logic lives there, this column just wires its
|
// real per-badge logic lives there, this column just wires its
|
||||||
// callbacks to the page's own state/handlers.
|
// callbacks to the page's own state/handlers.
|
||||||
sortBy: (a) => a.wanted ?? "",
|
sortBy: (a) => a.wanted ?? "",
|
||||||
filterValue: (a) => a.wanted ?? "no declaration",
|
// Multiselect, same reasoning as the hive column above.
|
||||||
filterMode: "select",
|
filterValues: (a) => [a.wanted ?? "no declaration"],
|
||||||
|
filterMode: "multiselect",
|
||||||
render: (a) => {
|
render: (a) => {
|
||||||
const err = actionErrors.get(a.name);
|
const err = actionErrors.get(a.name);
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,11 @@ const COLUMNS: TableColumn<HiveStatus>[] = [
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
sortBy: (h) => FRESHNESS[h.freshness].label,
|
sortBy: (h) => FRESHNESS[h.freshness].label,
|
||||||
filterValue: (h) => FRESHNESS[h.freshness].label,
|
// Multiselect (not the single-value `"select"` mode) so the operator
|
||||||
filterMode: "select",
|
// can filter for e.g. "stale or offline" in one pass rather than one
|
||||||
|
// freshness state at a time.
|
||||||
|
filterValues: (h) => [FRESHNESS[h.freshness].label],
|
||||||
|
filterMode: "multiselect",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,14 +312,12 @@ export function IssueReportPage() {
|
||||||
),
|
),
|
||||||
ariaSort: ariaSortFor("assignees"),
|
ariaSort: ariaSortFor("assignees"),
|
||||||
render: (r) => (r.assignees.length ? r.assignees.join(", ") : "—"),
|
render: (r) => (r.assignees.length ? r.assignees.join(", ") : "—"),
|
||||||
// Text, not `"select"` — a row can carry more than one assignee,
|
// Multiselect, same machinery the "labels" column above already
|
||||||
// and `Table`'s select mode matches one whole string per row
|
// uses — `r.assignees` is already the per-row array this mode
|
||||||
// exactly, so a real per-assignee dropdown would need `Table`
|
// wants, so there's no reason to fall back to a joined-string
|
||||||
// itself to grow multi-value filtering. Substring search over
|
// substring search here.
|
||||||
// the joined string still finds "iris" inside "damocles, iris"
|
filterValues: (r) => r.assignees,
|
||||||
// correctly, which covers the actual gap (no way to filter by
|
filterMode: "multiselect",
|
||||||
// assignee at all today).
|
|
||||||
filterValue: (r) => r.assignees.join(", "),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "blocked",
|
key: "blocked",
|
||||||
|
|
@ -337,11 +335,11 @@ export function IssueReportPage() {
|
||||||
r.blocked ? <Badge tone="warning" value="blocked" /> : "—",
|
r.blocked ? <Badge tone="warning" value="blocked" /> : "—",
|
||||||
// A distinct gap from the existing "hide blocked" toggle above:
|
// A distinct gap from the existing "hide blocked" toggle above:
|
||||||
// that one only *hides* blocked issues, there was no way to see
|
// that one only *hides* blocked issues, there was no way to see
|
||||||
// *only* the blocked ones. Synthesized two-value string (not the
|
// *only* the blocked ones. Synthesized two-value set (not the raw
|
||||||
// raw boolean) — `Table`'s select mode needs a string to match,
|
// boolean) — multiselect, same as every other enum-shaped column,
|
||||||
// same as `AgentsPage`'s `wanted ?? "no declaration"` pattern.
|
// rather than the single-value `"select"` mode.
|
||||||
filterValue: (r) => (r.blocked ? "blocked" : "not blocked"),
|
filterValues: (r) => [r.blocked ? "blocked" : "not blocked"],
|
||||||
filterMode: "select",
|
filterMode: "multiselect",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "depended_on_by_count",
|
key: "depended_on_by_count",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue