2022-12-07 12:52:17 +01:00
|
|
|
import { useLocation } from 'react-router-dom';
|
2023-01-02 14:40:37 +01:00
|
|
|
import { Paper, styled, Tab, Tabs } from '@mui/material';
|
2022-03-28 10:49:59 +02:00
|
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
2022-05-25 23:26:05 +02:00
|
|
|
import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
|
2022-12-07 12:52:17 +01:00
|
|
|
import { CenteredNavLink } from './CenteredNavLink';
|
2022-05-05 13:42:18 +02:00
|
|
|
|
2023-01-02 14:40:37 +01:00
|
|
|
const StyledPaper = styled(Paper)(({ theme }) => ({
|
|
|
|
marginBottom: '1rem',
|
|
|
|
borderRadius: '12.5px',
|
|
|
|
boxShadow: 'none',
|
|
|
|
padding: '0 2rem',
|
|
|
|
}));
|
|
|
|
|
2022-02-08 11:44:41 +01:00
|
|
|
function AdminMenu() {
|
2023-02-08 11:59:24 +01:00
|
|
|
const { uiConfig, isEnterprise } = useUiConfig();
|
2022-02-08 11:44:41 +01:00
|
|
|
const { pathname } = useLocation();
|
2022-05-25 23:26:05 +02:00
|
|
|
const { isBilling } = useInstanceStatus();
|
2023-02-15 16:24:57 +01:00
|
|
|
const { flags, networkViewEnabled } = uiConfig;
|
2021-12-14 10:36:19 +01:00
|
|
|
|
2022-12-16 15:12:36 +01:00
|
|
|
const activeTab = pathname.split('/')[2];
|
|
|
|
|
2021-02-24 11:03:18 +01:00
|
|
|
return (
|
2023-01-02 14:40:37 +01:00
|
|
|
<StyledPaper>
|
2022-09-06 14:32:42 +02:00
|
|
|
<Tabs
|
2022-12-16 15:12:36 +01:00
|
|
|
value={activeTab}
|
2022-09-06 14:32:42 +02:00
|
|
|
variant="scrollable"
|
|
|
|
scrollButtons="auto"
|
|
|
|
allowScrollButtonsMobile
|
|
|
|
>
|
2021-05-18 12:59:48 +02:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="users"
|
2021-05-18 12:59:48 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/users">
|
2021-04-16 11:31:47 +02:00
|
|
|
<span>Users</span>
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2021-05-18 12:59:48 +02:00
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2023-02-08 11:59:24 +01:00
|
|
|
{isEnterprise() && (
|
2023-01-05 09:11:28 +01:00
|
|
|
<Tab
|
|
|
|
value="service-accounts"
|
|
|
|
label={
|
|
|
|
<CenteredNavLink to="/admin/service-accounts">
|
|
|
|
<span>Service accounts</span>
|
|
|
|
</CenteredNavLink>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2022-07-22 09:31:08 +02:00
|
|
|
{flags.UG && (
|
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="groups"
|
2022-07-22 09:31:08 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/groups">
|
2022-07-22 09:31:08 +02:00
|
|
|
<span>Groups</span>
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2022-07-22 09:31:08 +02:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2022-01-14 15:50:02 +01:00
|
|
|
{flags.RE && (
|
2021-12-14 10:36:19 +01:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="roles"
|
2021-12-14 10:36:19 +01:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/roles">
|
2022-05-26 16:27:20 +02:00
|
|
|
<span>Project roles</span>
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2021-12-14 10:36:19 +01:00
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2021-12-14 10:36:19 +01:00
|
|
|
)}
|
2021-05-18 12:59:48 +02:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="api"
|
2021-05-18 12:59:48 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/api">
|
2022-05-26 16:27:20 +02:00
|
|
|
API access
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2021-05-18 12:59:48 +02:00
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2022-08-26 15:16:29 +02:00
|
|
|
{uiConfig.flags.embedProxyFrontend && (
|
2022-08-23 14:04:09 +02:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="cors"
|
2022-08-23 14:04:09 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/cors">
|
2022-08-23 14:04:09 +02:00
|
|
|
CORS origins
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2022-08-23 14:04:09 +02:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2021-05-18 12:59:48 +02:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="auth"
|
2021-05-18 12:59:48 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/auth">
|
2022-05-26 16:27:20 +02:00
|
|
|
Single sign-on
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2021-04-16 11:31:47 +02:00
|
|
|
}
|
2022-02-08 11:44:41 +01:00
|
|
|
/>
|
2022-10-25 13:10:27 +02:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="instance"
|
2022-10-25 13:10:27 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/instance">
|
2022-10-25 13:10:27 +02:00
|
|
|
Instance stats
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2022-10-25 13:10:27 +02:00
|
|
|
}
|
|
|
|
/>
|
2023-02-15 16:24:57 +01:00
|
|
|
{networkViewEnabled && (
|
2022-12-15 09:47:07 +01:00
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="network"
|
2022-12-15 09:47:07 +01:00
|
|
|
label={
|
2022-12-16 15:12:36 +01:00
|
|
|
<CenteredNavLink to="/admin/network">
|
|
|
|
Network
|
2022-12-15 09:47:07 +01:00
|
|
|
</CenteredNavLink>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2023-02-27 14:36:56 +01:00
|
|
|
|
|
|
|
<Tab
|
|
|
|
value="maintenance"
|
|
|
|
label={
|
|
|
|
<CenteredNavLink to="/admin/maintenance">
|
|
|
|
Maintenance
|
|
|
|
</CenteredNavLink>
|
|
|
|
}
|
|
|
|
/>
|
2022-12-21 12:23:44 +01:00
|
|
|
|
2022-05-25 23:26:05 +02:00
|
|
|
{isBilling && (
|
|
|
|
<Tab
|
2022-12-16 15:12:36 +01:00
|
|
|
value="billing"
|
2022-05-25 23:26:05 +02:00
|
|
|
label={
|
2022-12-07 12:52:17 +01:00
|
|
|
<CenteredNavLink to="/admin/billing">
|
2022-05-25 23:26:05 +02:00
|
|
|
Billing
|
2022-12-07 12:52:17 +01:00
|
|
|
</CenteredNavLink>
|
2022-05-25 23:26:05 +02:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
)}
|
2021-04-16 11:31:47 +02:00
|
|
|
</Tabs>
|
2023-01-02 14:40:37 +01:00
|
|
|
</StyledPaper>
|
2021-02-24 11:03:18 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default AdminMenu;
|