diff --git a/src/components/sectionList/listView/types.ts b/src/components/sectionList/listView/types.ts index 49b4a1e4..10e0b5b2 100644 --- a/src/components/sectionList/listView/types.ts +++ b/src/components/sectionList/listView/types.ts @@ -1,11 +1,11 @@ import { SectionName } from '../../../lib' -import type { ModelPropertyDescriptor } from '../../../lib' +import type { FilterDescriptor, ModelPropertyDescriptor } from '../../../lib' export interface ModelListView { name: string sectionModel: string columns: ReadonlyArray - filters: ReadonlyArray + filters: ReadonlyArray } export type ModelListViews = { diff --git a/src/components/sectionList/listView/useModelListView.tsx b/src/components/sectionList/listView/useModelListView.tsx index 474eee69..ddca5cd9 100644 --- a/src/components/sectionList/listView/useModelListView.tsx +++ b/src/components/sectionList/listView/useModelListView.tsx @@ -78,8 +78,8 @@ const parseViewToModelListView = ( return columnConfig as NonNullable }) - const filters = viewConfig.filters.available.filter((col) => - parsedView.filters.includes(col.path) + const filters = viewConfig.filters.available.filter((filterDescriptor) => + parsedView.filters.includes(filterDescriptor.filterKey) ) return { @@ -95,7 +95,7 @@ const formatViewToDataStore = ( const savedView = { ...view, columns: view.columns.map((c) => c.path), - filters: view.filters.map((f) => f.path), + filters: view.filters.map((f) => f.filterKey), } return savedView diff --git a/src/lib/sectionList/filters/filterConfig.tsx b/src/lib/sectionList/filters/filterConfig.tsx index 2ae89dc3..0fae40c3 100644 --- a/src/lib/sectionList/filters/filterConfig.tsx +++ b/src/lib/sectionList/filters/filterConfig.tsx @@ -12,9 +12,10 @@ export const filterParamsSchema = z .object({ [IDENTIFIABLE_KEY]: z.string(), aggregationType: z.array(z.nativeEnum(DataElement.aggregationType)), + categoryCombo: zodArrayIds, + dataSet: zodArrayIds, domainType: z.array(z.nativeEnum(DataElement.domainType)), valueType: z.array(z.string()), - dataSet: zodArrayIds, }) .partial() @@ -26,6 +27,7 @@ export const filterQueryParamType = { domainType: CustomDelimitedArrayParam, valueType: CustomDelimitedArrayParam, dataSet: CustomDelimitedArrayParam, + categoryCombo: CustomDelimitedArrayParam, } as const satisfies QueryParamsConfigMap export const validFilterKeys = Object.keys(filterQueryParamType) diff --git a/src/lib/sectionList/filters/useFilterQueryParams.ts b/src/lib/sectionList/filters/useFilterQueryParams.ts index d49cb6d3..54e6f105 100644 --- a/src/lib/sectionList/filters/useFilterQueryParams.ts +++ b/src/lib/sectionList/filters/useFilterQueryParams.ts @@ -1,9 +1,5 @@ import { useMemo } from 'react' -import { - useModelSectionHandleOrThrow, - useSectionHandle, -} from './../../routeUtils/useSectionHandle' -import { ParsedFilterParams } from './filtersQueryParamSimple' +import { useSectionHandle } from './../../routeUtils/useSectionHandle' import { parseFiltersToQueryParams } from './parseFiltersToQueryParams' import { useSectionListFilters } from './useSectionListFilters' diff --git a/src/pages/dataElements/List.tsx b/src/pages/dataElements/List.tsx index a369353b..fcaf2b3f 100644 --- a/src/pages/dataElements/List.tsx +++ b/src/pages/dataElements/List.tsx @@ -4,7 +4,6 @@ import { SectionListWrapper, DomainTypeSelectionFilter, ValueTypeSelectionFilter, - useQueryParamsForModelGist, } from '../../components' import { useModelListView } from '../../components/sectionList/listView' import { useSchemaFromHandle, useParamsForDataQuery } from '../../lib/'