2021-09-07 19:29:36 -07:00
|
|
|
import styled from 'styled-components';
|
|
|
|
|
import * as React from 'react';
|
2022-01-27 22:02:41 -08:00
|
|
|
import {
|
|
|
|
|
ApiOutlined,
|
|
|
|
|
BarChartOutlined,
|
2022-05-30 00:26:07 -04:00
|
|
|
BookOutlined,
|
2022-01-27 22:02:41 -08:00
|
|
|
SettingOutlined,
|
|
|
|
|
FolderOutlined,
|
2022-06-03 07:47:39 -07:00
|
|
|
SolutionOutlined,
|
2022-05-30 00:26:07 -04:00
|
|
|
DownOutlined,
|
2022-01-27 22:02:41 -08:00
|
|
|
} from '@ant-design/icons';
|
2021-09-07 19:29:36 -07:00
|
|
|
import { Link } from 'react-router-dom';
|
2022-05-30 00:26:07 -04:00
|
|
|
import { Button, Dropdown, Menu } from 'antd';
|
2021-09-07 19:29:36 -07:00
|
|
|
import { useAppConfig } from '../../useAppConfig';
|
|
|
|
|
import { useGetAuthenticatedUser } from '../../useGetAuthenticatedUser';
|
|
|
|
|
|
2022-07-27 17:55:27 -04:00
|
|
|
const LinkWrapper = styled.span`
|
2022-06-03 07:47:39 -07:00
|
|
|
margin-right: 0px;
|
2021-09-07 19:29:36 -07:00
|
|
|
`;
|
|
|
|
|
|
2022-05-23 17:21:30 -04:00
|
|
|
const LinksWrapper = styled.div<{ areLinksHidden?: boolean }>`
|
|
|
|
|
opacity: 1;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
transition: opacity 0.5s;
|
|
|
|
|
|
|
|
|
|
${(props) =>
|
|
|
|
|
props.areLinksHidden &&
|
|
|
|
|
`
|
|
|
|
|
opacity: 0;
|
|
|
|
|
width: 0;
|
|
|
|
|
`}
|
|
|
|
|
`;
|
|
|
|
|
|
2022-05-30 00:26:07 -04:00
|
|
|
const MenuItem = styled(Menu.Item)`
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
`;
|
|
|
|
|
|
2022-05-23 17:21:30 -04:00
|
|
|
interface Props {
|
|
|
|
|
areLinksHidden?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-27 17:55:27 -04:00
|
|
|
export function HeaderLinks(props: Props) {
|
2022-05-23 17:21:30 -04:00
|
|
|
const { areLinksHidden } = props;
|
2021-09-07 19:29:36 -07:00
|
|
|
const me = useGetAuthenticatedUser();
|
|
|
|
|
const { config } = useAppConfig();
|
|
|
|
|
|
|
|
|
|
const isAnalyticsEnabled = config?.analyticsConfig.enabled;
|
2022-01-27 10:33:12 -08:00
|
|
|
const isIngestionEnabled = config?.managedIngestionConfig.enabled;
|
2021-09-07 19:29:36 -07:00
|
|
|
|
|
|
|
|
const showAnalytics = (isAnalyticsEnabled && me && me.platformPrivileges.viewAnalytics) || false;
|
2021-11-22 16:33:14 -08:00
|
|
|
const showSettings = true;
|
2022-01-27 10:33:12 -08:00
|
|
|
const showIngestion =
|
|
|
|
|
isIngestionEnabled && me && me.platformPrivileges.manageIngestion && me.platformPrivileges.manageSecrets;
|
2021-09-07 19:29:36 -07:00
|
|
|
|
|
|
|
|
return (
|
2022-05-23 17:21:30 -04:00
|
|
|
<LinksWrapper areLinksHidden={areLinksHidden}>
|
2021-09-07 19:29:36 -07:00
|
|
|
{showAnalytics && (
|
2022-07-27 17:55:27 -04:00
|
|
|
<LinkWrapper>
|
2021-09-07 19:29:36 -07:00
|
|
|
<Link to="/analytics">
|
|
|
|
|
<Button type="text">
|
|
|
|
|
<BarChartOutlined /> Analytics
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2022-07-27 17:55:27 -04:00
|
|
|
</LinkWrapper>
|
2021-09-07 19:29:36 -07:00
|
|
|
)}
|
2022-01-27 10:33:12 -08:00
|
|
|
{showIngestion && (
|
2022-07-27 17:55:27 -04:00
|
|
|
<LinkWrapper>
|
2022-01-27 10:33:12 -08:00
|
|
|
<Link to="/ingestion">
|
|
|
|
|
<Button type="text">
|
|
|
|
|
<ApiOutlined /> Ingestion
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2022-07-27 17:55:27 -04:00
|
|
|
</LinkWrapper>
|
2022-05-30 00:26:07 -04:00
|
|
|
)}
|
2022-07-27 17:55:27 -04:00
|
|
|
<Dropdown
|
|
|
|
|
trigger={['click']}
|
|
|
|
|
overlay={
|
|
|
|
|
<Menu>
|
|
|
|
|
<MenuItem key="0">
|
|
|
|
|
<Link to="/glossary">
|
|
|
|
|
<BookOutlined style={{ fontSize: '14px', fontWeight: 'bold' }} /> Glossary
|
|
|
|
|
</Link>
|
|
|
|
|
</MenuItem>
|
|
|
|
|
<MenuItem key="1">
|
|
|
|
|
<Link to="/domains">
|
|
|
|
|
<FolderOutlined style={{ fontSize: '14px', fontWeight: 'bold' }} /> Domains
|
|
|
|
|
</Link>
|
|
|
|
|
</MenuItem>
|
|
|
|
|
</Menu>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<LinkWrapper>
|
|
|
|
|
<Button type="text">
|
|
|
|
|
<SolutionOutlined /> Govern <DownOutlined style={{ fontSize: '6px' }} />
|
|
|
|
|
</Button>
|
|
|
|
|
</LinkWrapper>
|
|
|
|
|
</Dropdown>
|
2022-03-04 12:19:37 -08:00
|
|
|
{showSettings && (
|
2022-07-27 17:55:27 -04:00
|
|
|
<LinkWrapper style={{ marginRight: 12 }}>
|
2021-11-22 16:33:14 -08:00
|
|
|
<Link to="/settings">
|
|
|
|
|
<Button type="text">
|
2022-03-04 12:19:37 -08:00
|
|
|
<SettingOutlined />
|
2021-11-22 16:33:14 -08:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2022-07-27 17:55:27 -04:00
|
|
|
</LinkWrapper>
|
2021-11-22 16:33:14 -08:00
|
|
|
)}
|
2022-05-23 17:21:30 -04:00
|
|
|
</LinksWrapper>
|
2021-09-07 19:29:36 -07:00
|
|
|
);
|
|
|
|
|
}
|