From 0ccb54b25eae5bd6ac3f775b2f989112644dd694 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 22 Aug 2022 16:05:21 +0200 Subject: [PATCH] feat(ui) - url filter fix metadata --- frontend/app/Router.js | 18 +++++------ frontend/app/components/Header/Header.js | 2 +- .../SessionSearchQueryParamHandler.tsx | 8 ++++- frontend/app/svg/slack-help.svg | 31 +++++++++++++++++++ 4 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 frontend/app/svg/slack-help.svg diff --git a/frontend/app/Router.js b/frontend/app/Router.js index e8fa64eab..a92cdb5ee 100644 --- a/frontend/app/Router.js +++ b/frontend/app/Router.js @@ -89,13 +89,14 @@ const ONBOARDING_REDIRECT_PATH = routes.onboarding(OB_DEFAULT_TAB); const jwt = state.get('jwt'); const changePassword = state.getIn(['user', 'account', 'changePassword']); const userInfoLoading = state.getIn(['user', 'fetchUserInfoRequest', 'loading']); + const metaLoading = state.getIn(['customFields', 'fetchRequest', 'loading']); return { jwt, siteId, changePassword, sites: state.getIn(['site', 'list']), isLoggedIn: jwt !== null && !changePassword, - loading: siteId === null || userInfoLoading, + loading: siteId === null || userInfoLoading || metaLoading, email: state.getIn(['user', 'account', 'email']), account: state.getIn(['user', 'account']), organisation: state.getIn(['user', 'account', 'name']), @@ -125,15 +126,12 @@ class Router extends React.Component { } } - fetchInitialData = () => { - Promise.all([ - this.props.fetchUserInfo().then(() => { - this.props.fetchSiteList().then(() => { - const { mstore } = this.props; - mstore.initClient(); - }); - }), - ]); + fetchInitialData = async () => { + await this.props.fetchUserInfo(), + await this.props.fetchSiteList() + const { mstore } = this.props; + mstore.initClient(); + await this.props.fetchMetadata(); }; componentDidMount() { diff --git a/frontend/app/components/Header/Header.js b/frontend/app/components/Header/Header.js index d5240261f..8b08d48f5 100644 --- a/frontend/app/components/Header/Header.js +++ b/frontend/app/components/Header/Header.js @@ -57,7 +57,7 @@ const Header = (props) => { Promise.all([ userStore.fetchLimits(), notificationStore.fetchNotificationsCount(), - props.fetchMetadata(), + // props.fetchMetadata(), ]).then(() => { userStore.updateKey('initialDataFetched', true); }); diff --git a/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx b/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx index 2752c6ea3..66de1a0e9 100644 --- a/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx +++ b/frontend/app/components/shared/SessionSearchQueryParamHandler/SessionSearchQueryParamHandler.tsx @@ -3,6 +3,7 @@ import { useHistory } from 'react-router'; import { connect } from 'react-redux'; import { addFilterByKeyAndValue, addFilter } from 'Duck/search'; import { getFilterKeyTypeByKey, setQueryParamKeyFromFilterkey } from 'Types/filter/filterType'; +import { filtersMap } from 'App/types/filter/newFilter'; interface Props { appliedFilter: any; @@ -46,7 +47,12 @@ const SessionSearchQueryParamHandler = React.memo((props: Props) => { if (filterKey) { props.addFilterByKeyAndValue(filterKey, valueArr, operator, sourceOperator, sourceArr); } else { - console.warn(`Filter key ${key} not found`); + const _filters: any = { ...filtersMap }; + const _filter = _filters[key]; + _filter.value = valueArr; + _filter.operator = operator; + _filter.source = sourceArr; + props.addFilter(_filter); } } }; diff --git a/frontend/app/svg/slack-help.svg b/frontend/app/svg/slack-help.svg new file mode 100644 index 000000000..772410879 --- /dev/null +++ b/frontend/app/svg/slack-help.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +