mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 09:29:04 +08:00
feat: navigation to new explorer from old page are updated (#3093)
This commit is contained in:
parent
ed200e50c8
commit
652bd52ea7
27
frontend/src/components/ExplorerCard/index.tsx
Normal file
27
frontend/src/components/ExplorerCard/index.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { Card, Space, Typography } from 'antd';
|
||||||
|
import TextToolTip from 'components/TextToolTip';
|
||||||
|
|
||||||
|
function ExplorerCard({ children }: Props): JSX.Element {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
size="small"
|
||||||
|
title={
|
||||||
|
<Space>
|
||||||
|
<Typography>Query Builder</Typography>
|
||||||
|
<TextToolTip
|
||||||
|
url="https://signoz.io/docs/userguide/query-builder/?utm_source=product&utm_medium=new-query-builder"
|
||||||
|
text="More details on how to use query builder"
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ExplorerCard;
|
@ -1 +1 @@
|
|||||||
export const style = { fontSize: '1.3125rem' };
|
export const style = { fontSize: '1rem' };
|
||||||
|
3
frontend/src/container/TopNav/NewExplorerCTA/config.ts
Normal file
3
frontend/src/container/TopNav/NewExplorerCTA/config.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export const RIBBON_STYLES = {
|
||||||
|
top: '-0.75rem',
|
||||||
|
};
|
50
frontend/src/container/TopNav/NewExplorerCTA/index.tsx
Normal file
50
frontend/src/container/TopNav/NewExplorerCTA/index.tsx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import { CompassOutlined } from '@ant-design/icons';
|
||||||
|
import { Badge, Button } from 'antd';
|
||||||
|
import ROUTES from 'constants/routes';
|
||||||
|
import history from 'lib/history';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { RIBBON_STYLES } from './config';
|
||||||
|
|
||||||
|
function NewExplorerCTA(): JSX.Element | null {
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
const isTraceOrLogsExplorerPage = useMemo(
|
||||||
|
() => location.pathname === ROUTES.LOGS || location.pathname === ROUTES.TRACE,
|
||||||
|
[location.pathname],
|
||||||
|
);
|
||||||
|
|
||||||
|
const onClickHandler = (): void => {
|
||||||
|
if (location.pathname === ROUTES.LOGS) {
|
||||||
|
history.push(ROUTES.LOGS_EXPLORER);
|
||||||
|
} else if (location.pathname === ROUTES.TRACE) {
|
||||||
|
history.push(ROUTES.TRACES_EXPLORER);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const buttonText = useMemo(
|
||||||
|
() =>
|
||||||
|
`Try new ${ROUTES.LOGS === location.pathname ? 'Logs' : 'Traces'} Explorer`,
|
||||||
|
[location.pathname],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isTraceOrLogsExplorerPage) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Badge.Ribbon style={RIBBON_STYLES} text="New">
|
||||||
|
<Button
|
||||||
|
icon={<CompassOutlined />}
|
||||||
|
onClick={onClickHandler}
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
{buttonText}
|
||||||
|
</Button>
|
||||||
|
</Badge.Ribbon>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NewExplorerCTA;
|
@ -1,4 +1,4 @@
|
|||||||
import { Col } from 'antd';
|
import { Col, Row, Space } from 'antd';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { matchPath, useHistory } from 'react-router-dom';
|
import { matchPath, useHistory } from 'react-router-dom';
|
||||||
@ -6,6 +6,7 @@ import { matchPath, useHistory } from 'react-router-dom';
|
|||||||
import ShowBreadcrumbs from './Breadcrumbs';
|
import ShowBreadcrumbs from './Breadcrumbs';
|
||||||
import DateTimeSelector from './DateTimeSelection';
|
import DateTimeSelector from './DateTimeSelection';
|
||||||
import { routesToSkip } from './DateTimeSelection/config';
|
import { routesToSkip } from './DateTimeSelection/config';
|
||||||
|
import NewExplorerCTA from './NewExplorerCTA';
|
||||||
import { Container } from './styles';
|
import { Container } from './styles';
|
||||||
|
|
||||||
function TopNav(): JSX.Element | null {
|
function TopNav(): JSX.Element | null {
|
||||||
@ -36,7 +37,15 @@ function TopNav(): JSX.Element | null {
|
|||||||
|
|
||||||
{!isRouteToSkip && (
|
{!isRouteToSkip && (
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<DateTimeSelector />
|
<Row justify="end">
|
||||||
|
<Space align="start" size={60} direction="horizontal">
|
||||||
|
<NewExplorerCTA />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<DateTimeSelector />
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Col, Row } from 'antd';
|
import { Col, Row } from 'antd';
|
||||||
|
import ExplorerCard from 'components/ExplorerCard';
|
||||||
import LogExplorerQuerySection from 'container/LogExplorerQuerySection';
|
import LogExplorerQuerySection from 'container/LogExplorerQuerySection';
|
||||||
import LogsExplorerViews from 'container/LogsExplorerViews';
|
import LogsExplorerViews from 'container/LogsExplorerViews';
|
||||||
|
|
||||||
@ -10,7 +11,9 @@ function LogsExplorer(): JSX.Element {
|
|||||||
<WrapperStyled>
|
<WrapperStyled>
|
||||||
<Row gutter={[0, 16]}>
|
<Row gutter={[0, 16]}>
|
||||||
<Col xs={24}>
|
<Col xs={24}>
|
||||||
<LogExplorerQuerySection />
|
<ExplorerCard>
|
||||||
|
<LogExplorerQuerySection />
|
||||||
|
</ExplorerCard>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={24}>
|
<Col xs={24}>
|
||||||
<LogsExplorerViews />
|
<LogsExplorerViews />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Tabs } from 'antd';
|
import { Tabs } from 'antd';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import ExplorerCard from 'components/ExplorerCard';
|
||||||
import { QueryParams } from 'constants/query';
|
import { QueryParams } from 'constants/query';
|
||||||
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
import { queryParamNamesMap } from 'constants/queryBuilderQueryNames';
|
import { queryParamNamesMap } from 'constants/queryBuilderQueryNames';
|
||||||
@ -177,7 +178,9 @@ function TracesExplorer(): JSX.Element {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<QuerySection />
|
<ExplorerCard>
|
||||||
|
<QuerySection />
|
||||||
|
</ExplorerCard>
|
||||||
|
|
||||||
<Container>
|
<Container>
|
||||||
<ActionsWrapper>
|
<ActionsWrapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user