···
let formRef!: HTMLFormElement;
const filteredLabels = createMemo(() => {
+
const filterValue = filter().trim();
if (!filterValue) return labels();
+
const filters = filterValue
+
.filter((f) => f.length > 0);
+
const exclusions: string[] = [];
+
const inclusions: string[] = [];
+
filters.forEach((f) => {
+
if (f.startsWith("-")) {
+
exclusions.push(f.slice(1).toLowerCase());
+
inclusions.push(f.toLowerCase());
+
return labels().filter((label) => {
+
const labelValue = label.val.toLowerCase();
+
// Check exclusions (exact match)
+
if (exclusions.some((exc) => labelValue === exc)) {
+
// If there are inclusions, at least one must match (partial match)
+
if (inclusions.length > 0) {
+
return inclusions.some((inc) => labelValue.includes(inc));
+
// 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">
+
placeholder="Filter labels (space separated, -label to exclude)"
onInput={(e) => setFilter(e.currentTarget.value)}
+
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}>