diff --git a/frontend/src/component/common/FilterItem/FilterItem.test.tsx b/frontend/src/component/common/FilterItem/FilterItem.test.tsx index 3169762b1c..8cc55e993c 100644 --- a/frontend/src/component/common/FilterItem/FilterItem.test.tsx +++ b/frontend/src/component/common/FilterItem/FilterItem.test.tsx @@ -88,12 +88,12 @@ describe('FilterItem Component', () => { const operatorsElement = await screen.findByText('is any of'); operatorsElement.click(); - const newOperator = await screen.findByText('is not any of'); + const newOperator = await screen.findByText('is none of'); newOperator.click(); expect(recordedChanges).toEqual([ - { operator: 'IS_NOT_ANY_OF', values: ['1', '3'] }, + { operator: 'IS_NONE_OF', values: ['1', '3'] }, ]); }); diff --git a/frontend/src/component/feature/FeatureToggleList/FeatureToggleFilters/FeatureToggleFilters.tsx b/frontend/src/component/feature/FeatureToggleList/FeatureToggleFilters/FeatureToggleFilters.tsx index 1c3035d6d2..bd3eb5ac8c 100644 --- a/frontend/src/component/feature/FeatureToggleList/FeatureToggleFilters/FeatureToggleFilters.tsx +++ b/frontend/src/component/feature/FeatureToggleList/FeatureToggleFilters/FeatureToggleFilters.tsx @@ -47,15 +47,8 @@ export const FeatureToggleFilters: VFC = ({ value: 'stale', }, ]; - const defaultFilterItems: IFilterItem[] = [ - { - label: 'State', - options: stateOptions, - filterKey: 'state', - }, - ]; - const [availableFilters, setAvailableFilters] = - useState(defaultFilterItems); + + const [availableFilters, setAvailableFilters] = useState([]); const removeFilter = (label: string) => { const filters = availableFilters.map((filter) => filter.label === label @@ -74,17 +67,24 @@ export const FeatureToggleFilters: VFC = ({ value: project.id, })); - const newFilterItems = [ - ...defaultFilterItems, + const newFilterItems: IFilterItem[] = [ + { + label: 'State', + options: stateOptions, + filterKey: 'state', + enabled: Boolean(state.state), + }, { label: 'Project', options: projectsOptions, filterKey: 'project', + enabled: Boolean(state.project), } as const, ]; setAvailableFilters(newFilterItems); - }, [JSON.stringify(projects)]); + }, [JSON.stringify(projects), JSON.stringify(state)]); + return ( {availableFilters.map(