From 4fa5ff9319b768f68b83c69a53a5ec995e4a5382 Mon Sep 17 00:00:00 2001 From: Palash gupta Date: Tue, 10 May 2022 14:02:05 +0530 Subject: [PATCH] fix: error is now handled and displayed as antd notification message --- frontend/src/pages/Metrics/index.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/Metrics/index.tsx b/frontend/src/pages/Metrics/index.tsx index 879414ec4b..a47229ad5c 100644 --- a/frontend/src/pages/Metrics/index.tsx +++ b/frontend/src/pages/Metrics/index.tsx @@ -1,3 +1,4 @@ +import { notification } from 'antd'; import getLocalStorageKey from 'api/browser/localstorage/get'; import Spinner from 'components/Spinner'; import { SKIP_ONBOARDING } from 'constants/onboarding'; @@ -20,10 +21,20 @@ function Metrics({ getService }: MetricsProps): JSX.Element { AppState, GlobalReducer >((state) => state.globalTime); - const { services, resourceAttributeQueries } = useSelector< - AppState, - MetricReducer - >((state) => state.metrics); + const { + services, + resourceAttributeQueries, + error, + errorMessage, + } = useSelector((state) => state.metrics); + + useEffect(() => { + if (error) { + notification.error({ + message: errorMessage, + }); + } + }, [error, errorMessage]); const selectedTags = useMemo( () =>