fix(FE) Removed refresh time filter from trace-detail page

This commit is contained in:
Siddhant Parekh 2022-01-04 13:40:03 +05:30
parent 6f8b78bd97
commit e7253b7ca6

View File

@ -2,14 +2,17 @@ import { Col } from 'antd';
import ROUTES from 'constants/routes'; import ROUTES from 'constants/routes';
import history from 'lib/history'; import history from 'lib/history';
import React from 'react'; import React from 'react';
import { useLocation } from 'react-router-dom'; import { useLocation, matchPath } from 'react-router-dom';
import ShowBreadcrumbs from './Breadcrumbs'; import ShowBreadcrumbs from './Breadcrumbs';
import DateTimeSelector from './DateTimeSelection'; import DateTimeSelector from './DateTimeSelection';
import { Container } from './styles'; 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 TopNav = (): JSX.Element | null => {
const { pathname } = useLocation(); const { pathname } = useLocation();
@ -18,13 +21,24 @@ const TopNav = (): JSX.Element | null => {
return 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 ( return (
<Container> <Container>
<Col span={16}> <Col span={16}>
<ShowBreadcrumbs /> <ShowBreadcrumbs />
</Col> </Col>
{!routesToSkip.includes(pathname) && ( {!checkRouteExists(pathname) && (
<Col span={8}> <Col span={8}>
<DateTimeSelector /> <DateTimeSelector />
</Col> </Col>