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