From 3164dc8397850beeb27da405507d330834159181 Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Tue, 23 Jan 2024 14:41:30 +0100 Subject: [PATCH 1/2] events planning filter --- client/api/ui/list.ts | 3 ++- client/components/Main/FiltersBox.tsx | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/api/ui/list.ts b/client/api/ui/list.ts index 9a7d2b48d..fce2f1593 100644 --- a/client/api/ui/list.ts +++ b/client/api/ui/list.ts @@ -102,8 +102,9 @@ function changeFilterId(id: ISearchFilter['_id'], params: ICombinedEventOrPlanni type: EVENTS_PLANNING.ACTIONS.SELECT_EVENTS_PLANNING_FILTER, payload: id, }); - urlParams.setString('eventsPlanningFilter', id); } + urlParams.setString('eventsPlanningFilter', id); + return reloadList(params); } diff --git a/client/components/Main/FiltersBox.tsx b/client/components/Main/FiltersBox.tsx index 98eeadaea..3f2cb1adc 100644 --- a/client/components/Main/FiltersBox.tsx +++ b/client/components/Main/FiltersBox.tsx @@ -7,20 +7,28 @@ import {StretchBar} from '../UI/SubNav'; import {PLANNING_VIEW} from '../../interfaces'; import {activeFilter as getCurrentView} from '../../selectors/main'; -import {planningApi} from '../../superdeskApi'; +import {planningApi, superdeskApi} from '../../superdeskApi'; import {PRIVILEGES} from '../../constants'; +import * as selectors from '../../selectors'; interface IProps { showFilters?: boolean; // defaults to true currentView: PLANNING_VIEW; privileges: {[key: string]: number}; + currentFilterId?: any; } const mapStateToProps = (state) => ({ currentView: getCurrentView(state), + currentFilterId: selectors.main.currentSearchFilterId(state), }); class FiltersBoxComponent extends React.PureComponent { + componentDidUpdate(prevProps: Readonly, prevState: Readonly<{}>, snapshot?: any): void { + const {urlParams} = superdeskApi.browser.location; + urlParams.setString('eventsPlanningFilter', this.props.currentFilterId); + } + render() { const privileges = this.props.privileges; let filter_items = []; From 3ec6b7e722b2682ec5341febc51f8b02b749958c Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Tue, 23 Jan 2024 14:51:24 +0100 Subject: [PATCH 2/2] fix lint --- client/components/Main/FiltersBox.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/components/Main/FiltersBox.tsx b/client/components/Main/FiltersBox.tsx index 3f2cb1adc..a21719f51 100644 --- a/client/components/Main/FiltersBox.tsx +++ b/client/components/Main/FiltersBox.tsx @@ -24,8 +24,9 @@ const mapStateToProps = (state) => ({ }); class FiltersBoxComponent extends React.PureComponent { - componentDidUpdate(prevProps: Readonly, prevState: Readonly<{}>, snapshot?: any): void { + componentDidUpdate(): void { const {urlParams} = superdeskApi.browser.location; + urlParams.setString('eventsPlanningFilter', this.props.currentFilterId); }