diff --git a/frontend/src/component/menu/Header/Header.tsx b/frontend/src/component/menu/Header/Header.tsx index ff9ef06fd4..64ab853fe4 100644 --- a/frontend/src/component/menu/Header/Header.tsx +++ b/frontend/src/component/menu/Header/Header.tsx @@ -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('/*', ''), diff --git a/frontend/src/component/menu/routes.ts b/frontend/src/component/menu/routes.ts index 9d5597f26b..13d53cdca2 100644 --- a/frontend/src/component/menu/routes.ts +++ b/frontend/src/component/menu/routes.ts @@ -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'] }, }, ]; diff --git a/frontend/src/interfaces/route.ts b/frontend/src/interfaces/route.ts index 0843b9527d..a860eb8c67 100644 --- a/frontend/src/interfaces/route.ts +++ b/frontend/src/interfaces/route.ts @@ -28,5 +28,5 @@ interface IRouteMenu { mobile?: boolean; advanced?: boolean; adminSettings?: boolean; - isEnterprise?: boolean; + mode?: Array<'pro' | 'enterprise'>; }