From 178940ce7f415357eb9b88f9a5b811ed67337d75 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:45:02 +0200 Subject: [PATCH] fix: environments route should be hidden from menu for open-source (#8397) --- frontend/src/component/common/util.ts | 5 +++++ frontend/src/component/menu/routes.ts | 1 + .../ProjectEnvironment/ProjectEnvironment.tsx | 12 ++++++++---- frontend/src/interfaces/route.ts | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/common/util.ts b/frontend/src/component/common/util.ts index ade09a4131..56da44e8d1 100644 --- a/frontend/src/component/common/util.ts +++ b/frontend/src/component/common/util.ts @@ -28,6 +28,11 @@ export const filterByConfig = return Boolean(config[r.configFlag]); } + const isOss = !config?.versionInfo?.current?.enterprise; + if (isOss && r.enterprise) { + return false; + } + return true; }; diff --git a/frontend/src/component/menu/routes.ts b/frontend/src/component/menu/routes.ts index 105542065b..a9d1336d01 100644 --- a/frontend/src/component/menu/routes.ts +++ b/frontend/src/component/menu/routes.ts @@ -511,6 +511,7 @@ export const getCondensedRoutes = (routes: IRoute[]): INavigationMenuItem[] => { menu: route.menu, configFlag: route.configFlag, notFlag: route.notFlag, + enterprise: route.enterprise, }; }); }; diff --git a/frontend/src/component/project/ProjectEnvironment/ProjectEnvironment.tsx b/frontend/src/component/project/ProjectEnvironment/ProjectEnvironment.tsx index 96ce97f9f4..d705860fda 100644 --- a/frontend/src/component/project/ProjectEnvironment/ProjectEnvironment.tsx +++ b/frontend/src/component/project/ProjectEnvironment/ProjectEnvironment.tsx @@ -230,10 +230,14 @@ const ProjectEnvironmentList = () => { initialValue={globalFilter} onChange={setGlobalFilter} /> - - - Configure environments - + {!isOss() ? ( + <> + + + Configure environments + + + ) : null} } /> diff --git a/frontend/src/interfaces/route.ts b/frontend/src/interfaces/route.ts index 6dc42151ed..4395d6545e 100644 --- a/frontend/src/interfaces/route.ts +++ b/frontend/src/interfaces/route.ts @@ -25,6 +25,7 @@ export interface INavigationMenuItem { notFlag?: keyof UiFlags; configFlag?: keyof IUiConfig; group?: string; + enterprise?: boolean; } interface IRouteMenu {