From 6f5662e45a6bb09b4f9500ad6ed6b0c5a2c64eb3 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 5 Nov 2025 05:56:57 +0300 Subject: [PATCH] env to hide inside from menu --- .env | 2 ++ .env.options.dist | 2 ++ README.md | 3 ++- server/index.ts | 2 ++ .../organisms/Header/organisms/User/User.tsx | 13 +++++++++---- src/constants/customizationApiGroupAndVersion.ts | 4 ++++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 3053d3e..d117d9b 100644 --- a/.env +++ b/.env @@ -12,6 +12,8 @@ VITE_CUSTOMIZATION_NAVIGATION_RESOURCE=navigation VITE_USE_NAMESPACE_NAV=true +VITE_HIDE_INSIDE=false + VITE_NAVIGATE_FROM_CLUSTERLIST=/openapi-ui/~recordValue~/builtin-table/namespaces VITE_PROJECTS_API_GROUP=incloud.io diff --git a/.env.options.dist b/.env.options.dist index 504093f..d36b462 100644 --- a/.env.options.dist +++ b/.env.options.dist @@ -14,6 +14,8 @@ CUSTOMIZATION_NAVIGATION_RESOURCE= USE_NAMESPACE_NAV= +HIDE_INSIDE= + NAVIGATE_FROM_CLUSTERLIST= PROJECTS_API_GROUP= diff --git a/README.md b/README.md index 072bc63..5614994 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This app can be configured through environment variables. | `KUBE_API_URL` | `string` | URL for the Kubernetes API. `http://api.incloud-web.svc.default.in-cloud.internal:8081` | | `BFF_URL` | `string` | URL for the BFF | | `TITLE_TEXT` | `string` | Page title | -| `TITLE_TEXT` | `string` | Page title | +| `LOGO_TEXT` | `string` | Logo text near icon | | `ICON_SVG` | `string` | Favicon base64 encoded | | `FOOTER_TEXT` | `string` | Footer text | | `CUSTOM_LOGO_SVG` | `string` | Base64 encoded svg | @@ -28,6 +28,7 @@ This app can be configured through environment variables. | `CUSTOMIZATION_NAVIGATION_RESOURCE_NAME` | `string` | Resource plural name for navigation settings. `navigations` | | `CUSTOMIZATION_NAVIGATION_RESOURCE` | `string` | Resource name for navigation settings. `navigation` | | `USE_NAMESPACE_NAV` | `boolean` | Use namespaces instead of project/instances. `true` | +| `HIDE_INSIDE` | `boolean` | Use namespaces instead of project/instances. `true` | | `NAVIGATE_FROM_CLUSTERLIST` | `string` | Location to be navigated after selecting cluster. `/openapi-ui/clusters/~recordValue~` | | `PROJECTS_API_GROUP` | `string` | API group for projects resources. If not using namespace nav. | | `PROJECTS_VERSION` | `string` | API version for projects resources. If not using namespace nav. | diff --git a/server/index.ts b/server/index.ts index 3917de5..f14aca6 100644 --- a/server/index.ts +++ b/server/index.ts @@ -39,6 +39,7 @@ const CUSTOMIZATION_NAVIGATION_RESOURCE = : process.env.CUSTOMIZATION_NAVIGATION_RESOURCE const USE_NAMESPACE_NAV = process.env.LOCAL === 'true' ? options?.USE_NAMESPACE_NAV : process.env.USE_NAMESPACE_NAV +const HIDE_INSIDE = process.env.LOCAL === 'true' ? options?.HIDE_INSIDE : process.env.HIDE_INSIDE const NAVIGATE_FROM_CLUSTERLIST = process.env.LOCAL === 'true' ? options?.NAVIGATE_FROM_CLUSTERLIST : process.env.NAVIGATE_FROM_CLUSTERLIST @@ -239,6 +240,7 @@ app.get(`${basePrefix ? basePrefix : ''}/env.js`, (_, res) => { } CUSTOMIZATION_NAVIGATION_RESOURCE: ${JSON.stringify(CUSTOMIZATION_NAVIGATION_RESOURCE) || '"check envs"'}, USE_NAMESPACE_NAV: ${USE_NAMESPACE_NAV ? JSON.stringify(USE_NAMESPACE_NAV).toLowerCase() : '"false"'}, + HIDE_INSIDE: ${HIDE_INSIDE ? JSON.stringify(HIDE_INSIDE).toLowerCase() : '"false"'}, NAVIGATE_FROM_CLUSTERLIST: ${JSON.stringify(NAVIGATE_FROM_CLUSTERLIST) || '"check envs"'}, PROJECTS_API_GROUP: ${JSON.stringify(PROJECTS_API_GROUP) || '"check envs"'}, PROJECTS_VERSION: ${JSON.stringify(PROJECTS_VERSION) || '"check envs"'}, diff --git a/src/components/organisms/Header/organisms/User/User.tsx b/src/components/organisms/Header/organisms/User/User.tsx index efe7ac3..69f89ce 100644 --- a/src/components/organisms/Header/organisms/User/User.tsx +++ b/src/components/organisms/Header/organisms/User/User.tsx @@ -6,6 +6,7 @@ import { useSelector } from 'react-redux' import type { RootState } from 'store/store' import { useAuth } from 'hooks/useAuth' import { logout } from 'api/auth' +import { BASE_HIDE_INSIDE } from 'constants/customizationApiGroupAndVersion' import { Styled } from './styled' export const User: FC = () => { @@ -23,10 +24,14 @@ export const User: FC = () => { // key: '1', // label: , // }, - { - key: '2', - label:
navigate(`${baseprefix}/inside/clusters`)}>Inside
, - }, + ...(BASE_HIDE_INSIDE === 'true' + ? [] + : [ + { + key: '2', + label:
navigate(`${baseprefix}/inside/clusters`)}>Inside
, + }, + ]), { key: '3', label: ( diff --git a/src/constants/customizationApiGroupAndVersion.ts b/src/constants/customizationApiGroupAndVersion.ts index fed1307..5700560 100644 --- a/src/constants/customizationApiGroupAndVersion.ts +++ b/src/constants/customizationApiGroupAndVersion.ts @@ -38,6 +38,10 @@ export const BASE_USE_NAMESPACE_NAV = import.meta.env.DEV ? window._env_.USE_NAMESPACE_NAV || import.meta.env.VITE_USE_NAMESPACE_NAV : window._env_.USE_NAMESPACE_NAV +export const BASE_HIDE_INSIDE = import.meta.env.DEV + ? window._env_.HIDE_INSIDE || import.meta.env.VITE_HIDE_INSIDE + : window._env_.HIDE_INSIDE + export const BASE_NAVIGATE_FROM_CLUSTERLIST = import.meta.env.DEV ? window._env_.NAVIGATE_FROM_CLUSTERLIST || import.meta.env.VITE_NAVIGATE_FROM_CLUSTERLIST : window._env_.NAVIGATE_FROM_CLUSTERLIST