mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
fix: hide pro routes (#3409)
This commit is contained in:
parent
214a3e6e5b
commit
39acf9f104
@ -120,7 +120,7 @@ const Header: VFC = () => {
|
||||
|
||||
const [admin, setAdmin] = useState(false);
|
||||
const { permissions } = useAuthPermissions();
|
||||
const { uiConfig, isOss } = useUiConfig();
|
||||
const { uiConfig, isOss, isPro, isEnterprise } = useUiConfig();
|
||||
const smallScreen = useMediaQuery(theme.breakpoints.down('md'));
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
|
||||
@ -140,8 +140,13 @@ const Header: VFC = () => {
|
||||
|
||||
const routes = getRoutes();
|
||||
|
||||
const filterByEnterprise = (route: INavigationMenuItem): boolean => {
|
||||
return !route.menu.isEnterprise || !isOss();
|
||||
const filterByMode = (route: INavigationMenuItem): boolean => {
|
||||
const { mode } = route.menu;
|
||||
return (
|
||||
!mode ||
|
||||
(mode.includes('pro') && isPro()) ||
|
||||
(mode.includes('enterprise') && isEnterprise())
|
||||
);
|
||||
};
|
||||
|
||||
const filteredMainRoutes = {
|
||||
@ -159,7 +164,7 @@ const Header: VFC = () => {
|
||||
),
|
||||
adminRoutes: adminMenuRoutes
|
||||
.filter(filterByConfig(uiConfig))
|
||||
.filter(filterByEnterprise)
|
||||
.filter(filterByMode)
|
||||
.map(route => ({
|
||||
...route,
|
||||
path: route.path.replace('/*', ''),
|
||||
|
@ -461,7 +461,7 @@ export const adminMenuRoutes: INavigationMenuItem[] = [
|
||||
{
|
||||
path: '/admin/groups',
|
||||
title: 'Groups',
|
||||
menu: { adminSettings: true },
|
||||
menu: { adminSettings: true, mode: ['enterprise'] },
|
||||
flag: UG,
|
||||
},
|
||||
{
|
||||
@ -483,12 +483,12 @@ export const adminMenuRoutes: INavigationMenuItem[] = [
|
||||
{
|
||||
path: '/admin/service-accounts',
|
||||
title: 'Service accounts',
|
||||
menu: { adminSettings: true, isEnterprise: true },
|
||||
menu: { adminSettings: true, mode: ['enterprise'] },
|
||||
},
|
||||
{
|
||||
path: '/admin/network/*',
|
||||
title: 'Network',
|
||||
menu: { adminSettings: true },
|
||||
menu: { adminSettings: true, mode: ['pro', 'enterprise'] },
|
||||
configFlag: 'networkViewEnabled',
|
||||
},
|
||||
{
|
||||
@ -505,7 +505,7 @@ export const adminMenuRoutes: INavigationMenuItem[] = [
|
||||
{
|
||||
path: '/admin/admin-invoices',
|
||||
title: 'Billing & invoices',
|
||||
menu: { adminSettings: true, isEnterprise: true },
|
||||
menu: { adminSettings: true, mode: ['pro'] },
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -28,5 +28,5 @@ interface IRouteMenu {
|
||||
mobile?: boolean;
|
||||
advanced?: boolean;
|
||||
adminSettings?: boolean;
|
||||
isEnterprise?: boolean;
|
||||
mode?: Array<'pro' | 'enterprise'>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user