···
let formRef!: HTMLFormElement;
const filteredLabels = createMemo(() => {
84
-
const filterValue = filter().trim().toLowerCase();
84
+
const filterValue = filter().trim();
if (!filterValue) return labels();
86
-
return labels().filter((label) => label.val.toLowerCase().includes(filterValue));
87
+
const filters = filterValue
89
+
.map((f) => f.trim())
90
+
.filter((f) => f.length > 0);
92
+
const exclusions: string[] = [];
93
+
const inclusions: string[] = [];
95
+
filters.forEach((f) => {
96
+
if (f.startsWith("-")) {
97
+
exclusions.push(f.slice(1).toLowerCase());
99
+
inclusions.push(f.toLowerCase());
103
+
return labels().filter((label) => {
104
+
const labelValue = label.val.toLowerCase();
106
+
// Check exclusions (exact match)
107
+
if (exclusions.some((exc) => labelValue === exc)) {
111
+
// If there are inclusions, at least one must match (partial match)
112
+
if (inclusions.length > 0) {
113
+
return inclusions.some((inc) => labelValue.includes(inc));
116
+
// If only exclusions were specified, include everything not excluded
const hasSearched = createMemo(() => Boolean(searchParams.uriPatterns));
···
<div class="flex w-full items-center gap-x-2">
218
-
placeholder="Filter by label value"
250
+
placeholder="Filter labels (space separated, -label to exclude)"
onInput={(e) => setFilter(e.currentTarget.value)}
222
-
class="min-w-0 grow text-sm"
254
+
class="min-w-0 grow text-sm placeholder:text-xs"
<div class="flex shrink-0 items-center gap-x-2 text-sm">
<Show when={labels().length > 0}>