mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-03 15:00:36 +08:00

* feat👔 : getLatestVersion api is added * chore: VERSION page is added * feat: ✨ version page is added * chore: all string is grabbed from locale * chore: warning is removed * chore: translation json is added * chore: feedback about version is added * chore: made two different functions * unused import is removed * feat: version changes are updated * chore: if current version is present then it is displayed
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { Breadcrumb } from 'antd';
|
|
import ROUTES from 'constants/routes';
|
|
import React from 'react';
|
|
import { Link, RouteComponentProps, withRouter } from 'react-router-dom';
|
|
|
|
const breadcrumbNameMap = {
|
|
[ROUTES.APPLICATION]: 'Application',
|
|
[ROUTES.TRACE]: 'Traces',
|
|
[ROUTES.SERVICE_MAP]: 'Service Map',
|
|
[ROUTES.USAGE_EXPLORER]: 'Usage Explorer',
|
|
[ROUTES.INSTRUMENTATION]: 'Add instrumentation',
|
|
[ROUTES.SETTINGS]: 'Settings',
|
|
[ROUTES.DASHBOARD]: 'Dashboard',
|
|
[ROUTES.VERSION]: 'Status',
|
|
};
|
|
|
|
function ShowBreadcrumbs(props: RouteComponentProps): JSX.Element {
|
|
const { location } = props;
|
|
|
|
const pathArray = location.pathname.split('/').filter((i) => i);
|
|
|
|
const extraBreadcrumbItems = pathArray.map((_, index) => {
|
|
const url = `/${pathArray.slice(0, index + 1).join('/')}`;
|
|
|
|
if (breadcrumbNameMap[url] === undefined) {
|
|
return (
|
|
<Breadcrumb.Item key={url}>
|
|
<Link to={url}>{url.split('/').slice(-1)[0]}</Link>
|
|
</Breadcrumb.Item>
|
|
);
|
|
}
|
|
return (
|
|
<Breadcrumb.Item key={url}>
|
|
<Link to={url}>{breadcrumbNameMap[url]}</Link>
|
|
</Breadcrumb.Item>
|
|
);
|
|
});
|
|
|
|
const breadcrumbItems = [
|
|
<Breadcrumb.Item key="home">
|
|
<Link to="/">Home</Link>
|
|
</Breadcrumb.Item>,
|
|
].concat(extraBreadcrumbItems);
|
|
|
|
return <Breadcrumb>{breadcrumbItems}</Breadcrumb>;
|
|
}
|
|
|
|
export default withRouter(ShowBreadcrumbs);
|