From 38e695b0afb61da4dd7ac614b625b31b8c768aa3 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 5 Nov 2025 05:01:34 +0300 Subject: [PATCH 1/5] fix array of strings [object] --- .env | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.env b/.env index d2345d9..3053d3e 100644 --- a/.env +++ b/.env @@ -12,7 +12,7 @@ VITE_CUSTOMIZATION_NAVIGATION_RESOURCE=navigation VITE_USE_NAMESPACE_NAV=true -VITE_NAVIGATE_FROM_CLUSTERLIST=/openapi-ui/clusters/~recordValue~ +VITE_NAVIGATE_FROM_CLUSTERLIST=/openapi-ui/~recordValue~/builtin-table/namespaces VITE_PROJECTS_API_GROUP=incloud.io VITE_PROJECTS_VERSION=v1alpha diff --git a/package-lock.json b/package-lock.json index 5502083..54fae96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@ant-design/icons": "5.6.0", "@monaco-editor/react": "4.6.0", "@originjs/vite-plugin-federation": "1.3.6", - "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.156", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.157", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", @@ -2804,9 +2804,9 @@ } }, "node_modules/@prorobotech/openapi-k8s-toolkit": { - "version": "0.0.1-alpha.156", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.156.tgz", - "integrity": "sha512-uMKzfdcEAbzKAFPWNIjcQMUtjhLmuUETs+1p+4K752HLB+31t9W1Fl5GOiySbpIWhoM7R9Y1mw5efe7/f04aRQ==", + "version": "0.0.1-alpha.157", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.157.tgz", + "integrity": "sha512-CUpLM1+fgVo1hQB7KJ9WaT/AGj0OZIH5GQ0URXOTdDbBlKJGnxLLwWINUR7gtP456ybuRSaDAmFm6TFIwcn9XA==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 6ec3b44..bd597e9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@ant-design/icons": "5.6.0", "@monaco-editor/react": "4.6.0", "@originjs/vite-plugin-federation": "1.3.6", - "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.156", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.157", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", From 8b6582ae67b2e7bfb94b25c693b228617241f059 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 5 Nov 2025 05:09:38 +0300 Subject: [PATCH 2/5] border radius fix --- src/components/molecules/ManageableSidebar/styled.ts | 8 ++++---- src/components/organisms/Sidebar/styled.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/molecules/ManageableSidebar/styled.ts b/src/components/molecules/ManageableSidebar/styled.ts index 4c811f5..e80e757 100644 --- a/src/components/molecules/ManageableSidebar/styled.ts +++ b/src/components/molecules/ManageableSidebar/styled.ts @@ -18,7 +18,7 @@ const Container = styled.div` direction: rtl; max-height: ${({ $maxHeight }) => $maxHeight || 'initial'}; user-select: none; - border-top-right-radius: 12px; + border-top-right-radius: 7px; & ul { direction: ltr; @@ -51,9 +51,9 @@ const Container = styled.div` /* corner radius */ - && .ant-menu li:first-child div:first-child { - border-top-right-radius: 8px; - } + /* && .ant-menu li:first-child div:first-child { + border-top-right-radius: 4px; + } */ /* selected header bgcolor */ diff --git a/src/components/organisms/Sidebar/styled.ts b/src/components/organisms/Sidebar/styled.ts index 4d977e4..ff1f047 100644 --- a/src/components/organisms/Sidebar/styled.ts +++ b/src/components/organisms/Sidebar/styled.ts @@ -11,6 +11,7 @@ const BackgroundContainer = styled.div` border-top-right-radius: ${({ $borderRadius }) => $borderRadius}px; border: 1px ${({ $borderColor }) => $borderColor} solid; border-left: 0; + box-sizing: border-box; width: 250px; height: calc(100vh - ${HEAD_FIRST_ROW}px); ` From da896999c1623d33db81adaa82c6a6628ccd7cf9 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 5 Nov 2025 05:44:17 +0300 Subject: [PATCH 3/5] custom namespace api resource --- .../ListInsideClusterAndNs.tsx | 4 +-- src/hooks/useNavSelectorInside.ts | 36 +++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx b/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx index ac56e5f..4f52a36 100644 --- a/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx +++ b/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx @@ -37,7 +37,7 @@ export const ListInsideClusterAndNs: FC = () => { clusterName: selectedCluster || '', typeName: 'namespaces', limit: null, - isEnabled: selectedCluster !== undefined && !isCustomNamespaceResource, + isEnabled: Boolean(selectedCluster !== undefined && !isCustomNamespaceResource), }) const namespacesDataCustom = useApiResources({ @@ -46,7 +46,7 @@ export const ListInsideClusterAndNs: FC = () => { apiVersion: CUSTOM_NAMESPACE_API_RESOURCE_API_VERSION, typeName: CUSTOM_NAMESPACE_API_RESOURCE_RESOURCE_NAME, limit: null, - isEnabled: selectedCluster !== undefined && isCustomNamespaceResource, + isEnabled: Boolean(selectedCluster !== undefined && isCustomNamespaceResource), }) return ( diff --git a/src/hooks/useNavSelectorInside.ts b/src/hooks/useNavSelectorInside.ts index 5736e2b..7358170 100644 --- a/src/hooks/useNavSelectorInside.ts +++ b/src/hooks/useNavSelectorInside.ts @@ -1,6 +1,11 @@ -import { TClusterList, TSingleResource, useBuiltinResources } from '@prorobotech/openapi-k8s-toolkit' +import { TClusterList, TSingleResource, useBuiltinResources, useApiResources } from '@prorobotech/openapi-k8s-toolkit' import { useSelector } from 'react-redux' import { RootState } from 'store/store' +import { + CUSTOM_NAMESPACE_API_RESOURCE_API_GROUP, + CUSTOM_NAMESPACE_API_RESOURCE_API_VERSION, + CUSTOM_NAMESPACE_API_RESOURCE_RESOURCE_NAME, +} from 'constants/customizationApiGroupAndVersion' const mappedClusterToOptionInSidebar = ({ name }: TClusterList[number]): { value: string; label: string } => ({ value: name, @@ -15,15 +20,40 @@ const mappedNamespaceToOptionInSidebar = ({ metadata }: TSingleResource): { valu export const useNavSelectorInside = (clusterName?: string) => { const clusterList = useSelector((state: RootState) => state.clusterList.clusterList) + const isCustomNamespaceResource = + CUSTOM_NAMESPACE_API_RESOURCE_API_GROUP && + typeof CUSTOM_NAMESPACE_API_RESOURCE_API_GROUP === 'string' && + CUSTOM_NAMESPACE_API_RESOURCE_API_GROUP.length > 0 && + CUSTOM_NAMESPACE_API_RESOURCE_API_VERSION && + typeof CUSTOM_NAMESPACE_API_RESOURCE_API_VERSION === 'string' && + CUSTOM_NAMESPACE_API_RESOURCE_API_VERSION.length > 0 && + CUSTOM_NAMESPACE_API_RESOURCE_RESOURCE_NAME && + typeof CUSTOM_NAMESPACE_API_RESOURCE_RESOURCE_NAME === 'string' && + CUSTOM_NAMESPACE_API_RESOURCE_RESOURCE_NAME.length > 0 + const { data: namespaces } = useBuiltinResources({ clusterName: clusterName || '', typeName: 'namespaces', limit: null, - isEnabled: Boolean(clusterName), + isEnabled: Boolean(clusterName !== undefined && !isCustomNamespaceResource), + }) + + const { data: namespacesCustom } = useApiResources({ + clusterName: clusterName || '', + apiGroup: CUSTOM_NAMESPACE_API_RESOURCE_API_GROUP, + apiVersion: CUSTOM_NAMESPACE_API_RESOURCE_API_VERSION, + typeName: CUSTOM_NAMESPACE_API_RESOURCE_RESOURCE_NAME, + limit: null, + isEnabled: Boolean(clusterName !== undefined && isCustomNamespaceResource), }) const clustersInSidebar = clusterList ? clusterList.map(mappedClusterToOptionInSidebar) : [] const namespacesInSidebar = clusterName && namespaces ? namespaces.items.map(mappedNamespaceToOptionInSidebar) : [] + const namespacesInSidebarCustom = + clusterName && namespacesCustom ? namespacesCustom.items.map(mappedNamespaceToOptionInSidebar) : [] - return { clustersInSidebar, namespacesInSidebar } + return { + clustersInSidebar, + namespacesInSidebar: isCustomNamespaceResource ? namespacesInSidebarCustom : namespacesInSidebar, + } } From 6f5662e45a6bb09b4f9500ad6ed6b0c5a2c64eb3 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 5 Nov 2025 05:56:57 +0300 Subject: [PATCH 4/5] 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 From 514e5dae20e47eff49afa5f86d43127634bbdefe Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 5 Nov 2025 06:35:56 +0300 Subject: [PATCH 5/5] custom form type for multiline --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54fae96..ab7e551 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "@ant-design/icons": "5.6.0", "@monaco-editor/react": "4.6.0", "@originjs/vite-plugin-federation": "1.3.6", - "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.157", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.158", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", @@ -2804,9 +2804,9 @@ } }, "node_modules/@prorobotech/openapi-k8s-toolkit": { - "version": "0.0.1-alpha.157", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.157.tgz", - "integrity": "sha512-CUpLM1+fgVo1hQB7KJ9WaT/AGj0OZIH5GQ0URXOTdDbBlKJGnxLLwWINUR7gtP456ybuRSaDAmFm6TFIwcn9XA==", + "version": "0.0.1-alpha.158", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.158.tgz", + "integrity": "sha512-pz+FHYv5PAzdfmyVxASG+Hvh8EM1cXvTXces6uUVjZG1koPHa3Hq4RmyUZyTCuXEKJyHW94V2sAasets9Ju5OA==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index bd597e9..b6af65e 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@ant-design/icons": "5.6.0", "@monaco-editor/react": "4.6.0", "@originjs/vite-plugin-federation": "1.3.6", - "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.157", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.158", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2",