diff --git a/client/src/components/column.tsx b/client/src/components/column.tsx index 7b4ef16..84047a8 100644 --- a/client/src/components/column.tsx +++ b/client/src/components/column.tsx @@ -130,7 +130,7 @@ export function FilteredQueryColumn(props: FilteredQueryColumnProps) { } filters.push({ text: "", - value: "", + value: "", }); const typedFilters = typeFilters(props.tableState.filters); diff --git a/client/src/components/dataProvider.ts b/client/src/components/dataProvider.ts index e532513..c8141b4 100644 --- a/client/src/components/dataProvider.ts +++ b/client/src/components/dataProvider.ts @@ -35,49 +35,22 @@ const dataProvider = ( } if (filters && filters.length > 0) { - // Pre-process the filters and handle the special case where we want to split the filament name into vendor and filament name - if (resource === "spool") { - filters = structuredClone(filters) - - for (let i = 0; i < filters.length; i++) { - const filter = filters[i] - if (("field" in filter) && filter.field === "filament.name") { - const filamentNames: string[] = [] - const vendorNames: string[] = [] - if (Array.isArray(filter.value)) { - filter.value.forEach((value: string) => { - const split = value.split(" - ") - if (split.length === 1) { - filamentNames.push(split[0]) - } else { - vendorNames.push(split[0]) - filamentNames.push(split[1]) - } - }) - } else { - filamentNames.push(filter.value.split(" - ")[1]) - vendorNames.push(filter.value.split(" - ")[0]) - } - filter.value = filamentNames - - filters.push({ - field: "vendor.name", - operator: "in", - value: vendorNames, - }) - break - } - } - } - filters.forEach(filter => { if (!("field" in filter)) { throw Error("Filter must be a LogicalFilter.") } const field = filter.field - const fieldValue = Array.isArray(filter.value) ? filter.value.join(",") : filter.value - if (fieldValue.length > 0) { - queryParams[field] = fieldValue + if (filter.value.length > 0) { + const filterValueArray = Array.isArray(filter.value) ? filter.value : [filter.value] + + const filterValue = filterValueArray.map((value) => { + if (value === "") { + return "" + } + return value + }).join(",") + + queryParams[field] = filterValue } }); }