From e7253b7ca62e3b139485898c0e4821e6d4a0656d Mon Sep 17 00:00:00 2001 From: Siddhant Parekh Date: Tue, 4 Jan 2022 13:40:03 +0530 Subject: [PATCH] fix(FE) Removed refresh time filter from trace-detail page --- frontend/src/container/Header/index.tsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/src/container/Header/index.tsx b/frontend/src/container/Header/index.tsx index 967ddbea74..8884b2231b 100644 --- a/frontend/src/container/Header/index.tsx +++ b/frontend/src/container/Header/index.tsx @@ -2,14 +2,17 @@ import { Col } from 'antd'; import ROUTES from 'constants/routes'; import history from 'lib/history'; import React from 'react'; -import { useLocation } from 'react-router-dom'; +import { useLocation, matchPath } from 'react-router-dom'; import ShowBreadcrumbs from './Breadcrumbs'; import DateTimeSelector from './DateTimeSelection'; import { Container } from './styles'; -const routesToSkip = [ROUTES.SETTINGS, ROUTES.LIST_ALL_ALERT]; - +const routesToSkip = [ + ROUTES.SETTINGS, + ROUTES.LIST_ALL_ALERT, + ROUTES.TRACE_GRAPH, +]; const TopNav = (): JSX.Element | null => { const { pathname } = useLocation(); @@ -18,13 +21,24 @@ const TopNav = (): JSX.Element | null => { return null; } + const checkRouteExists = (currentPath: string) => { + for (let i = 0; i < routesToSkip.length; ++i) { + if ( + matchPath(currentPath, { path: routesToSkip[i], exact: true, strict: true }) + ) { + return true; + } + } + return false; + }; + return ( - {!routesToSkip.includes(pathname) && ( + {!checkRouteExists(pathname) && (