From 71f45746a5be61b5c783ab4a7412c8b6a02c0773 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 8 Oct 2025 05:39:13 +0300 Subject: [PATCH 01/11] new tables | new permissions --- .../TableApiBuiltin/TableApiBuiltin.tsx | 57 +--- .../molecules/TableApiBuiltin/utils.ts | 175 ------------ .../molecules/TableCrdInfo/TableCrdInfo.tsx | 12 +- .../molecules/ResourceInfo/ResourceInfo.tsx | 261 +++++++++--------- .../molecules/SearchEntry/SearchEntry.tsx | 2 +- .../TableBuiltinPage/TableBuiltinPage.tsx | 1 + 6 files changed, 151 insertions(+), 357 deletions(-) diff --git a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx index 853dccf..6beb5bb 100644 --- a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx +++ b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx @@ -15,6 +15,7 @@ import { useBuiltinResources, useApiResources, Spacer, + getLinkToForm, } from '@prorobotech/openapi-k8s-toolkit' import { FlexGrow, PaddingContainer } from 'components' import { TABLE_PROPS } from 'constants/tableProps' @@ -27,13 +28,13 @@ import { TABLE_ADD_BUTTON_HEIGHT, } from 'constants/blocksSizes' import { OverflowContainer } from './atoms' -import { getDataItems, getBackLinkToTable, getLinkToForm } from './utils' +import { getDataItems } from './utils' type TTableApiBuiltinProps = { namespace?: string resourceType: 'builtin' | 'api' apiGroup?: string // api - apiVersion?: string // api + apiVersion: string // api typeName: string labels?: string[] fields?: string[] @@ -123,32 +124,14 @@ export const TableApiBuiltin: FC = ({ }, [resourceType, cluster, typeName, apiGroup, apiVersion]) const createPermission = usePermissions({ - apiGroup: apiGroup || '', - typeName, - namespace: '', + group: apiGroup || undefined, + resource: typeName, + namespace: params.namespace, clusterName: cluster, verb: 'create', refetchInterval: false, }) - const updatePermission = usePermissions({ - apiGroup: apiGroup || '', - typeName, - namespace: '', - clusterName: cluster, - verb: 'update', - refetchInterval: false, - }) - - const deletePermission = usePermissions({ - apiGroup: apiGroup || '', - typeName, - namespace: '', - clusterName: cluster, - verb: 'delete', - refetchInterval: false, - }) - const { isPending: isPendingBuiltin, error: errorBuiltin, @@ -239,29 +222,12 @@ export const TableApiBuiltin: FC = ({ dataForControls={{ cluster, syntheticProject: params.syntheticProject, - pathPrefix: resourceType === 'builtin' ? 'forms/builtin' : 'forms/apis', - typeName, - apiVersion: resourceType === 'builtin' ? 'v1' : `${apiGroup}/${apiVersion}`, - backlink: getBackLinkToTable({ - resourceType, - cluster, - baseprefix, - namespace, - syntheticProject: params.syntheticProject, - apiGroup, - apiVersion, - typeName, - inside, - fullPath, - searchMount, - }), - deletePathPrefix: - resourceType === 'builtin' ? `/api/clusters/${cluster}/k8s/api` : `/api/clusters/${cluster}/k8s/apis`, + resource: typeName, + apiGroup, + apiVersion, + }} + dataForControlsInternal={{ onDeleteHandle, - permissions: { - canUpdate: isNamespaced ? true : updatePermission.data?.status.allowed, - canDelete: isNamespaced ? true : deletePermission.data?.status.allowed, - }, }} selectData={{ selectedRowKeys, @@ -297,7 +263,6 @@ export const TableApiBuiltin: FC = ({ type="primary" onClick={() => { const url = getLinkToForm({ - resourceType, cluster, baseprefix, namespace, diff --git a/src/components/molecules/TableApiBuiltin/utils.ts b/src/components/molecules/TableApiBuiltin/utils.ts index c0973b2..dde900f 100644 --- a/src/components/molecules/TableApiBuiltin/utils.ts +++ b/src/components/molecules/TableApiBuiltin/utils.ts @@ -11,178 +11,3 @@ export const getDataItems = ({ }): TJSON[] => { return resourceType === 'builtin' ? dataBuiltin?.items || [] : dataApi?.items || [] } - -export const getBackLinkToBuiltinTable = ({ - cluster, - baseprefix, - namespace, - syntheticProject, - typeName, - inside, - fullPath, - searchMount, -}: { - cluster: string - baseprefix?: string - namespace?: string - syntheticProject?: string - typeName: string - inside?: boolean - fullPath: string - searchMount?: boolean -}): string => { - if (searchMount) { - return encodeURIComponent(fullPath) - } - const root = `${baseprefix}${inside ? '/inside' : ''}/${cluster}` - const mainRoute = `${root}${namespace ? `/${namespace}` : ''}${syntheticProject ? `/${syntheticProject}` : ''}` - - return `${mainRoute}/builtin-table/${typeName}` -} - -export const getBackLinkToApiTable = ({ - cluster, - baseprefix, - namespace, - syntheticProject, - apiGroup, - apiVersion, - typeName, - inside, - fullPath, - searchMount, -}: { - cluster: string - baseprefix?: string - namespace?: string - syntheticProject?: string - apiGroup?: string // api - apiVersion?: string // api - typeName: string - inside?: boolean - fullPath: string - searchMount?: boolean -}): string => { - if (searchMount) { - return encodeURIComponent(fullPath) - } - - const root = `${baseprefix}${inside ? '/inside' : ''}/${cluster}` - const mainRoute = `${root}${namespace ? `/${namespace}` : ''}${syntheticProject ? `/${syntheticProject}` : ''}` - - return `${mainRoute}/api-table/${apiGroup}/${apiVersion}/${typeName}` -} - -export const getBackLinkToTable = ({ - resourceType, - ...rest -}: { - resourceType: 'builtin' | 'api' - cluster: string - baseprefix?: string - namespace?: string - syntheticProject?: string - apiGroup?: string // api - apiVersion?: string // api - typeName: string - inside?: boolean - fullPath: string - searchMount?: boolean -}): string => { - return resourceType === 'builtin' ? getBackLinkToBuiltinTable({ ...rest }) : getBackLinkToApiTable({ ...rest }) -} - -export const getLinkToBuiltinForm = ({ - cluster, - baseprefix, - namespace, - syntheticProject, - typeName, - inside, - fullPath, - searchMount, -}: { - cluster: string - baseprefix?: string - namespace?: string - syntheticProject?: string - typeName: string - inside?: boolean - fullPath: string - searchMount?: boolean -}): string => { - const root = `${baseprefix}${inside ? '/inside' : ''}/${cluster}` - const mainRoute = `${root}${namespace ? `/${namespace}` : ''}${syntheticProject ? `/${syntheticProject}` : ''}` - const backlink = getBackLinkToBuiltinTable({ - cluster, - baseprefix, - namespace, - syntheticProject, - typeName, - inside, - fullPath, - searchMount, - }) - - return `${mainRoute}/forms/builtin/v1/${typeName}?backlink=${backlink}` -} - -export const getLinkToApiForm = ({ - cluster, - baseprefix, - namespace, - syntheticProject, - apiGroup, - apiVersion, - typeName, - inside, - fullPath, - searchMount, -}: { - cluster: string - baseprefix?: string - namespace?: string - syntheticProject?: string - apiGroup?: string // api - apiVersion?: string // api - typeName: string - inside?: boolean - fullPath: string - searchMount?: boolean -}): string => { - const root = `${baseprefix}${inside ? '/inside' : ''}/${cluster}` - const mainRoute = `${root}${namespace ? `/${namespace}` : ''}${syntheticProject ? `/${syntheticProject}` : ''}` - const backlink = getBackLinkToApiTable({ - cluster, - baseprefix, - namespace, - syntheticProject, - apiGroup, - apiVersion, - typeName, - inside, - fullPath, - searchMount, - }) - - return `${mainRoute}/forms/apis/${apiGroup}/${apiVersion}/${typeName}?backlink=${backlink}` -} - -export const getLinkToForm = ({ - resourceType, - ...rest -}: { - resourceType: 'builtin' | 'api' - cluster: string - baseprefix?: string - namespace?: string - syntheticProject?: string - apiGroup?: string // api - apiVersion?: string // api - typeName: string - inside?: boolean - fullPath: string - searchMount?: boolean -}): string => { - return resourceType === 'builtin' ? getLinkToBuiltinForm({ ...rest }) : getLinkToApiForm({ ...rest }) -} diff --git a/src/components/molecules/TableCrdInfo/TableCrdInfo.tsx b/src/components/molecules/TableCrdInfo/TableCrdInfo.tsx index 9c079ae..fbd8519 100644 --- a/src/components/molecules/TableCrdInfo/TableCrdInfo.tsx +++ b/src/components/molecules/TableCrdInfo/TableCrdInfo.tsx @@ -50,8 +50,8 @@ export const TableCrdInfo: FC = ({ }, [cluster, data, isPending, error, apiGroup, apiVersion]) const createPermission = usePermissions({ - apiGroup, - typeName: data ? data.spec.names.singular : '', + group: apiGroup, + resource: data ? data.spec.names.singular : '', namespace: '', clusterName: cluster, verb: 'create', @@ -59,8 +59,8 @@ export const TableCrdInfo: FC = ({ }) const updatePermission = usePermissions({ - apiGroup, - typeName: data ? data.spec.names.singular : '', + group: apiGroup, + resource: data ? data.spec.names.singular : '', namespace: '', clusterName: cluster, verb: 'update', @@ -68,8 +68,8 @@ export const TableCrdInfo: FC = ({ }) const deletePermission = usePermissions({ - apiGroup, - typeName: data ? data.spec.names.singular : '', + group: apiGroup, + resource: data ? data.spec.names.singular : '', namespace: '', clusterName: cluster, verb: 'delete', diff --git a/src/components/molecules/TableCrdInfo/molecules/ResourceInfo/ResourceInfo.tsx b/src/components/molecules/TableCrdInfo/molecules/ResourceInfo/ResourceInfo.tsx index 15c914d..9f0d04b 100644 --- a/src/components/molecules/TableCrdInfo/molecules/ResourceInfo/ResourceInfo.tsx +++ b/src/components/molecules/TableCrdInfo/molecules/ResourceInfo/ResourceInfo.tsx @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import React, { FC, useState, useEffect } from 'react' import { useLocation, useNavigate, useParams } from 'react-router-dom' import { Spin, Alert, Button, Flex } from 'antd' @@ -130,133 +131,135 @@ export const ResourceInfo: FC = ({ return acc }, {}) - return ( - <> - {isPending && } - {error && } - - {!error && data && ( - { - setSelectedRowKeys(selectedRowKeys) - setSelectedRowsData(selectedRowsData) - }, - }} - tableProps={{ ...TABLE_PROPS, disablePagination: true }} - // maxHeight={height - 65} - /> - )} - {/* {selectedRowKeys.length > 0 && ( - - - - - - - )} */} - - - - - - {selectedRowKeys.length > 0 && ( - - - - - )} - - - {isDeleteModalOpen && ( - { - setIsDeleteModalOpen(false) - clearSelected() - }} - endpoint={isDeleteModalOpen.endpoint} - /> - )} - {isDeleteModalManyOpen !== false && ( - { - setIsDeleteModalManyOpen(false) - clearSelected() - }} - /> - )} - - ) + return
Most likely deprecated
+ + // return ( + // <> + // {isPending && } + // {error && } + // + // {!error && data && ( + // { + // setSelectedRowKeys(selectedRowKeys) + // setSelectedRowsData(selectedRowsData) + // }, + // }} + // tableProps={{ ...TABLE_PROPS, disablePagination: true }} + // // maxHeight={height - 65} + // /> + // )} + // {/* {selectedRowKeys.length > 0 && ( + // + // + // + // + // + // + // )} */} + // + // + // + // + // + // {selectedRowKeys.length > 0 && ( + // + // + // + // + // )} + // + // + // {isDeleteModalOpen && ( + // { + // setIsDeleteModalOpen(false) + // clearSelected() + // }} + // endpoint={isDeleteModalOpen.endpoint} + // /> + // )} + // {isDeleteModalManyOpen !== false && ( + // { + // setIsDeleteModalManyOpen(false) + // clearSelected() + // }} + // /> + // )} + // + // ) } diff --git a/src/components/organisms/Search/molecules/SearchEntry/SearchEntry.tsx b/src/components/organisms/Search/molecules/SearchEntry/SearchEntry.tsx index 5f3cf6e..169bd9f 100644 --- a/src/components/organisms/Search/molecules/SearchEntry/SearchEntry.tsx +++ b/src/components/organisms/Search/molecules/SearchEntry/SearchEntry.tsx @@ -94,7 +94,7 @@ export const SearchEntry: FC = ({ resource, labels, fields, f resourceType={apiGroup.length > 0 ? 'api' : 'builtin'} namespace={isNamespaceResource ? namespace : undefined} apiGroup={apiGroup.length > 0 ? apiGroup : undefined} - apiVersion={apiGroup.length > 0 ? apiVersion : undefined} + apiVersion={apiVersion} typeName={typeName} labels={labels?.length ? labels : undefined} fields={fields?.length ? fields : undefined} diff --git a/src/pages/TableBuiltinPage/TableBuiltinPage.tsx b/src/pages/TableBuiltinPage/TableBuiltinPage.tsx index 03ad1da..71797c7 100644 --- a/src/pages/TableBuiltinPage/TableBuiltinPage.tsx +++ b/src/pages/TableBuiltinPage/TableBuiltinPage.tsx @@ -68,6 +68,7 @@ export const TableBuiltinPage: FC = ({ forcedTheme, insi {typeName && ( Date: Wed, 8 Oct 2025 15:32:31 +0300 Subject: [PATCH 02/11] package sync --- 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 9869ff4..65c799f 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.129", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.130", "@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.129", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.129.tgz", - "integrity": "sha512-V5hrvOfbx7ZXCHu3sDYfvVKJPEbiymMk7Zb/1cQNfkyzjqvBB2JVRVEGVR9c6uyuWOHchBAMkiw2S5c5pm+yfQ==", + "version": "0.0.1-alpha.130", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.130.tgz", + "integrity": "sha512-JI53qkBcHQyJYm3/PkjJ4olKH82fbYQUmw9s7ubVgdWvPyGz2/OoPywFjoIvTHn6BY7t1tZIaCc1WSgs24f2iA==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 4d22087..3427284 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.129", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.130", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", From a8477ec3d37bbfde606245bb9f829b571862890a Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 8 Oct 2025 15:34:19 +0300 Subject: [PATCH 03/11] linters --- src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx index 6beb5bb..b6ab290 100644 --- a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx +++ b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx @@ -237,7 +237,6 @@ export const TableApiBuiltin: FC = ({ }, }} tableProps={{ ...TABLE_PROPS, disablePagination: !searchMount }} - namespaceScopedWithoutNamespace={isNamespaced && !namespace} // maxHeight={height - 65} /> )} From b5f6d16c715498bba219c89c93986243d97bedb8 Mon Sep 17 00:00:00 2001 From: typescreep Date: Thu, 9 Oct 2025 18:53:18 +0300 Subject: [PATCH 04/11] namespace in tables --- src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx index b6ab290..0c20076 100644 --- a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx +++ b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx @@ -216,9 +216,11 @@ export const TableApiBuiltin: FC = ({ ...replaceValuesPartsOfUrls, }} cluster={cluster} + namespace={namespace} theme={theme} baseprefix={inside ? `${baseprefix}/inside` : baseprefix} dataItems={getDataItems({ resourceType, dataBuiltin, dataApi })} + isNamespaced={isNamespaced} dataForControls={{ cluster, syntheticProject: params.syntheticProject, From b7475c48b1d2c73ff6d1835ec61683f9e6f378e2 Mon Sep 17 00:00:00 2001 From: typescreep Date: Thu, 9 Oct 2025 19:21:22 +0300 Subject: [PATCH 05/11] package sync --- 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 65c799f..240a226 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.130", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.131", "@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.130", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.130.tgz", - "integrity": "sha512-JI53qkBcHQyJYm3/PkjJ4olKH82fbYQUmw9s7ubVgdWvPyGz2/OoPywFjoIvTHn6BY7t1tZIaCc1WSgs24f2iA==", + "version": "0.0.1-alpha.131", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.131.tgz", + "integrity": "sha512-u8D3kdXLOl59wlhjLHH2KErrKMc2S6ScULqgiVjC4CHs6vn8ukZPiqVg52OBaOomYZjgVy5iTy9H7uE3nZK/Qg==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 3427284..8247214 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.130", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.131", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", From 737ec274e1ffa552896ba6cbdb8cf9dddf1346f4 Mon Sep 17 00:00:00 2001 From: typescreep Date: Thu, 9 Oct 2025 22:43:23 +0300 Subject: [PATCH 06/11] fix permissions --- 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 240a226..730718a 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.131", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.132", "@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.131", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.131.tgz", - "integrity": "sha512-u8D3kdXLOl59wlhjLHH2KErrKMc2S6ScULqgiVjC4CHs6vn8ukZPiqVg52OBaOomYZjgVy5iTy9H7uE3nZK/Qg==", + "version": "0.0.1-alpha.132", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.132.tgz", + "integrity": "sha512-ZgRTaGzVhJL3ieWjjQGGUDfFrENkRLo4qPZQicl9oSkX0vEfXcEf6fGi858ycQ8KgtstK9OStzPQB4OJQ9knkg==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 8247214..05d069c 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.131", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.132", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", From d523ea7c352daaa332adbff0ec1da64d2ce56f6c Mon Sep 17 00:00:00 2001 From: typescreep Date: Mon, 13 Oct 2025 16:48:49 +0300 Subject: [PATCH 07/11] fix ns col while same table type resource change | labels edit while verticalviewlist --- package-lock.json | 8 +++--- package.json | 2 +- .../TableApiBuiltin/TableApiBuiltin.tsx | 27 +++++++++++++------ src/pages/TableApiPage/TableApiPage.tsx | 1 + .../TableBuiltinPage/TableBuiltinPage.tsx | 1 + 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 730718a..a24379e 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.132", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.133", "@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.132", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.132.tgz", - "integrity": "sha512-ZgRTaGzVhJL3ieWjjQGGUDfFrENkRLo4qPZQicl9oSkX0vEfXcEf6fGi858ycQ8KgtstK9OStzPQB4OJQ9knkg==", + "version": "0.0.1-alpha.133", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.133.tgz", + "integrity": "sha512-/fzTDAbm/YbSK9PEWVBpcmT9Vbk8EJhMGTku/5u/+T5MxPxj9krg0zfJ1DsEjoWAtT7hjlghxfGK/+GCHsONsg==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 05d069c..6734509 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.132", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.133", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", diff --git a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx index 0c20076..92d5075 100644 --- a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx +++ b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx @@ -73,6 +73,7 @@ export const TableApiBuiltin: FC = ({ const [selectedRowKeys, setSelectedRowKeys] = useState([]) const [selectedRowsData, setSelectedRowsData] = useState<{ name: string; endpoint: string }[]>([]) const [isNamespaced, setIsNamespaced] = useState() + const [isNamespacedLoading, setIsNamespacedLoading] = useState() const [height, setHeight] = useState(0) @@ -99,15 +100,20 @@ export const TableApiBuiltin: FC = ({ }, []) useEffect(() => { + setIsNamespacedLoading(true) if (resourceType === 'builtin') { checkIfBuiltInInstanceNamespaceScoped({ typeName, clusterName: cluster, - }).then(({ isNamespaceScoped }) => { - if (isNamespaceScoped) { - setIsNamespaced(isNamespaceScoped) - } }) + .then(({ isNamespaceScoped }) => { + if (isNamespaceScoped) { + setIsNamespaced(isNamespaceScoped) + } else { + setIsNamespaced(false) + } + }) + .finally(() => setIsNamespacedLoading(false)) } if (resourceType === 'api' && apiGroup && apiVersion) { checkIfApiInstanceNamespaceScoped({ @@ -115,11 +121,15 @@ export const TableApiBuiltin: FC = ({ apiVersion, typeName, clusterName: cluster, - }).then(({ isNamespaceScoped }) => { - if (isNamespaceScoped) { - setIsNamespaced(true) - } }) + .then(({ isNamespaceScoped }) => { + if (isNamespaceScoped) { + setIsNamespaced(true) + } else { + setIsNamespaced(false) + } + }) + .finally(() => setIsNamespacedLoading(false)) } }, [resourceType, cluster, typeName, apiGroup, apiVersion]) @@ -221,6 +231,7 @@ export const TableApiBuiltin: FC = ({ baseprefix={inside ? `${baseprefix}/inside` : baseprefix} dataItems={getDataItems({ resourceType, dataBuiltin, dataApi })} isNamespaced={isNamespaced} + isNamespacedLoading={isNamespacedLoading} dataForControls={{ cluster, syntheticProject: params.syntheticProject, diff --git a/src/pages/TableApiPage/TableApiPage.tsx b/src/pages/TableApiPage/TableApiPage.tsx index accb7e6..851dde5 100644 --- a/src/pages/TableApiPage/TableApiPage.tsx +++ b/src/pages/TableApiPage/TableApiPage.tsx @@ -85,6 +85,7 @@ export const TableApiPage: FC = ({ forcedTheme, inside }) => apiGroup={apiGroup} apiVersion={apiVersion} typeName={typeName} + key={`${apiGroup}-${apiVersion}-${namespace}-${typeName}`} limit={searchParams.get('limit')} inside={inside} customizationIdPrefix={tableCustomizationIdPrefix} diff --git a/src/pages/TableBuiltinPage/TableBuiltinPage.tsx b/src/pages/TableBuiltinPage/TableBuiltinPage.tsx index 71797c7..7d82f01 100644 --- a/src/pages/TableBuiltinPage/TableBuiltinPage.tsx +++ b/src/pages/TableBuiltinPage/TableBuiltinPage.tsx @@ -69,6 +69,7 @@ export const TableBuiltinPage: FC = ({ forcedTheme, insi Date: Mon, 13 Oct 2025 17:45:10 +0300 Subject: [PATCH 08/11] possibly logs fix --- 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 a24379e..f58631f 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.133", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.134", "@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.133", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.133.tgz", - "integrity": "sha512-/fzTDAbm/YbSK9PEWVBpcmT9Vbk8EJhMGTku/5u/+T5MxPxj9krg0zfJ1DsEjoWAtT7hjlghxfGK/+GCHsONsg==", + "version": "0.0.1-alpha.134", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.134.tgz", + "integrity": "sha512-PgaNGnmLkCWL1QSe9U6GAj8V8N2Q4AG6iASp++VcqQU22d9++y3OJ4CuZ08s2TaIceUwY7W4ruWEJYP9RA2IOA==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 6734509..f064656 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.133", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.134", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", From e63eba36e26489c2727d74805877224dc63b1987 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 15 Oct 2025 14:40:05 +0300 Subject: [PATCH 09/11] new table prepare --- package-lock.json | 8 +- package.json | 2 +- .../TableApiBuiltin/TableApiBuiltin.tsx | 89 ++++++++++--------- 3 files changed, 53 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index f58631f..15f39e7 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.134", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.135", "@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.134", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.134.tgz", - "integrity": "sha512-PgaNGnmLkCWL1QSe9U6GAj8V8N2Q4AG6iASp++VcqQU22d9++y3OJ4CuZ08s2TaIceUwY7W4ruWEJYP9RA2IOA==", + "version": "0.0.1-alpha.135", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.135.tgz", + "integrity": "sha512-OwKpZw5GuSD09buUHz3D9nLG69J/u1I8G/1ADGcQmCZaGqf9DevZBHGbO/PkTQWS+7xCEVvTPJ9QBQvTm8ATKQ==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index f064656..6fdabc2 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.134", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.135", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", diff --git a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx index 92d5075..4a27a36 100644 --- a/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx +++ b/src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx @@ -10,8 +10,8 @@ import { usePermissions, DeleteModal, DeleteModalMany, - checkIfBuiltInInstanceNamespaceScoped, - checkIfApiInstanceNamespaceScoped, + // checkIfBuiltInInstanceNamespaceScoped, + // checkIfApiInstanceNamespaceScoped, useBuiltinResources, useApiResources, Spacer, @@ -72,8 +72,8 @@ export const TableApiBuiltin: FC = ({ ) const [selectedRowKeys, setSelectedRowKeys] = useState([]) const [selectedRowsData, setSelectedRowsData] = useState<{ name: string; endpoint: string }[]>([]) - const [isNamespaced, setIsNamespaced] = useState() - const [isNamespacedLoading, setIsNamespacedLoading] = useState() + // const [isNamespaced, setIsNamespaced] = useState() + // const [isNamespacedLoading, setIsNamespacedLoading] = useState() const [height, setHeight] = useState(0) @@ -99,39 +99,39 @@ export const TableApiBuiltin: FC = ({ } }, []) - useEffect(() => { - setIsNamespacedLoading(true) - if (resourceType === 'builtin') { - checkIfBuiltInInstanceNamespaceScoped({ - typeName, - clusterName: cluster, - }) - .then(({ isNamespaceScoped }) => { - if (isNamespaceScoped) { - setIsNamespaced(isNamespaceScoped) - } else { - setIsNamespaced(false) - } - }) - .finally(() => setIsNamespacedLoading(false)) - } - if (resourceType === 'api' && apiGroup && apiVersion) { - checkIfApiInstanceNamespaceScoped({ - apiGroup, - apiVersion, - typeName, - clusterName: cluster, - }) - .then(({ isNamespaceScoped }) => { - if (isNamespaceScoped) { - setIsNamespaced(true) - } else { - setIsNamespaced(false) - } - }) - .finally(() => setIsNamespacedLoading(false)) - } - }, [resourceType, cluster, typeName, apiGroup, apiVersion]) + // useEffect(() => { + // setIsNamespacedLoading(true) + // if (resourceType === 'builtin') { + // checkIfBuiltInInstanceNamespaceScoped({ + // typeName, + // clusterName: cluster, + // }) + // .then(({ isNamespaceScoped }) => { + // if (isNamespaceScoped) { + // setIsNamespaced(isNamespaceScoped) + // } else { + // setIsNamespaced(false) + // } + // }) + // .finally(() => setIsNamespacedLoading(false)) + // } + // if (resourceType === 'api' && apiGroup && apiVersion) { + // checkIfApiInstanceNamespaceScoped({ + // apiGroup, + // apiVersion, + // typeName, + // clusterName: cluster, + // }) + // .then(({ isNamespaceScoped }) => { + // if (isNamespaceScoped) { + // setIsNamespaced(true) + // } else { + // setIsNamespaced(false) + // } + // }) + // .finally(() => setIsNamespacedLoading(false)) + // } + // }, [resourceType, cluster, typeName, apiGroup, apiVersion]) const createPermission = usePermissions({ group: apiGroup || undefined, @@ -230,8 +230,13 @@ export const TableApiBuiltin: FC = ({ theme={theme} baseprefix={inside ? `${baseprefix}/inside` : baseprefix} dataItems={getDataItems({ resourceType, dataBuiltin, dataApi })} - isNamespaced={isNamespaced} - isNamespacedLoading={isNamespacedLoading} + k8sResource={{ + resource: typeName, + apiGroup, + apiVersion, + }} + // isNamespaced={isNamespaced} + // isNamespacedLoading={isNamespacedLoading} dataForControls={{ cluster, syntheticProject: params.syntheticProject, @@ -288,8 +293,10 @@ export const TableApiBuiltin: FC = ({ }) navigate(url) }} - loading={isNamespaced ? false : createPermission.isPending} - disabled={isNamespaced ? false : !createPermission.data?.status.allowed} + // loading={isNamespaced ? false : createPermission.isPending} + // disabled={isNamespaced ? false : !createPermission.data?.status.allowed} + loading={createPermission.isPending} + disabled={!createPermission.data?.status.allowed} > Add {kindName} From 7003b57a1dc3030ba3d313d143766e5153d1314b Mon Sep 17 00:00:00 2001 From: typescreep Date: Sun, 19 Oct 2025 14:42:15 +0300 Subject: [PATCH 10/11] base tables & factories --- 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 15f39e7..a6627ec 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.135", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.136", "@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.135", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.135.tgz", - "integrity": "sha512-OwKpZw5GuSD09buUHz3D9nLG69J/u1I8G/1ADGcQmCZaGqf9DevZBHGbO/PkTQWS+7xCEVvTPJ9QBQvTm8ATKQ==", + "version": "0.0.1-alpha.136", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.136.tgz", + "integrity": "sha512-Lwdifu6YwCYxg5uWR+oL52fDl7g5PU79kgg230y38nrfUqP7251H2amGSyg2QMmrYG3x31BwFM5iuWLPqDmqfA==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 6fdabc2..2d407f1 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.135", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.136", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", From 7992494f87c16672807a6673252111cddba4ba12 Mon Sep 17 00:00:00 2001 From: typescreep Date: Mon, 20 Oct 2025 11:29:46 +0300 Subject: [PATCH 11/11] remove flickering | currenttags parser in sidebars --- package-lock.json | 8 +- package.json | 2 +- src/App.tsx | 153 +++++++++--------- .../organisms/Header/organisms/User/User.tsx | 2 +- .../SelectorCluster/SelectorCluster.tsx | 2 +- .../SelectorClusterInside.tsx | 2 +- .../SelectorInside/SelectorInside.tsx | 4 +- .../ListInsideClusterAndNs.tsx | 3 +- src/hooks/useNavSelector/useNavSelector.ts | 2 + src/hooks/useNavSelectorInside.ts | 1 + src/pages/FactoryPage/FactoryPage.tsx | 9 +- src/pages/FormApiPage/FormApiPage.tsx | 4 +- src/pages/FormBuiltinPage/FormBuiltinPage.tsx | 4 +- src/pages/FormCrdPage/FormCrdPage.tsx | 4 +- .../ListClustersPage/ListClustersPage.tsx | 8 +- .../ListInsideApiByApiGroupPage.tsx | 5 +- .../ListInsideApiPage/ListInsideApiPage.tsx | 5 +- .../ListInsideClustersAndNsPage.tsx | 5 +- .../ListInsideCrdByApiGroupPage.tsx | 5 +- .../ListProjectsPage/ListProjectsPage.tsx | 8 +- src/pages/MainPage/MainPage.tsx | 8 +- src/pages/ProjectInfoPage/ProjectInfoPage.tsx | 8 +- src/pages/SearchPage/SearchPage.tsx | 7 +- src/pages/TableApiPage/TableApiPage.tsx | 4 +- .../TableBuiltinPage/TableBuiltinPage.tsx | 4 +- src/pages/TableCrdPage/TableCrdPage.tsx | 4 +- src/templates/BaseTemplate/BaseTemplate.tsx | 136 +++------------- src/templates/MainLayout/MainLayout.tsx | 95 +++++++++++ src/templates/MainLayout/index.ts | 1 + .../{BaseTemplate => MainLayout}/styled.ts | 0 30 files changed, 226 insertions(+), 277 deletions(-) create mode 100644 src/templates/MainLayout/MainLayout.tsx create mode 100644 src/templates/MainLayout/index.ts rename src/templates/{BaseTemplate => MainLayout}/styled.ts (100%) diff --git a/package-lock.json b/package-lock.json index a6627ec..7bcdf8c 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.136", + "@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.137", "@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.136", - "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.136.tgz", - "integrity": "sha512-Lwdifu6YwCYxg5uWR+oL52fDl7g5PU79kgg230y38nrfUqP7251H2amGSyg2QMmrYG3x31BwFM5iuWLPqDmqfA==", + "version": "0.0.1-alpha.137", + "resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.137.tgz", + "integrity": "sha512-40wpiC8aRBmXZiNnkqYjqo15UEjF9mowoSGqe1/xzxFdjjeZtSBoDoGhLMFy/j6QBCvgaYnNH7mYqxZg5MS7rg==", "license": "MIT", "dependencies": { "@monaco-editor/react": "4.6.0", diff --git a/package.json b/package.json index 2d407f1..bff473d 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.136", + "@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.137", "@readme/openapi-parser": "4.0.0", "@reduxjs/toolkit": "2.2.5", "@tanstack/react-query": "5.62.2", diff --git a/src/App.tsx b/src/App.tsx index 4ea0d50..6711b2b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -30,6 +30,7 @@ import { } from 'pages' import { getBasePrefix } from 'utils/getBaseprefix' import { colorsLight, colorsDark, sizes } from 'constants/colors' +import { MainLayout } from 'templates/MainLayout' type TAppProps = { isFederation?: boolean @@ -54,87 +55,77 @@ export const App: FC = ({ isFederation, forcedTheme }) => { const renderRoutes = (prefix = '') => ( - } /> - } /> - } /> - } /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - } /> + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + } /> + } /> + ) diff --git a/src/components/organisms/Header/organisms/User/User.tsx b/src/components/organisms/Header/organisms/User/User.tsx index 5565425..efe7ac3 100644 --- a/src/components/organisms/Header/organisms/User/User.tsx +++ b/src/components/organisms/Header/organisms/User/User.tsx @@ -25,7 +25,7 @@ export const User: FC = () => { // }, { key: '2', - label:
navigate(`${baseprefix}/inside`)}>Inside
, + label:
navigate(`${baseprefix}/inside/clusters`)}>Inside
, }, { key: '3', diff --git a/src/components/organisms/HeaderSecond/organisms/SelectorCluster/SelectorCluster.tsx b/src/components/organisms/HeaderSecond/organisms/SelectorCluster/SelectorCluster.tsx index e090ebf..00c75d7 100644 --- a/src/components/organisms/HeaderSecond/organisms/SelectorCluster/SelectorCluster.tsx +++ b/src/components/organisms/HeaderSecond/organisms/SelectorCluster/SelectorCluster.tsx @@ -38,7 +38,7 @@ export const SelectorCluster: FC = ({ clusterName }) => { Cluster: = ({ cluster Cluster: = ({ clusterName, namespac const navigate = useNavigate() const params = useParams() - const [selectedClusterName, setSelectedClusterName] = useState(clusterName) - const [selectedNamespace, setSelectedNamespace] = useState(namespace) + const [selectedClusterName, setSelectedClusterName] = useState(clusterName) + const [selectedNamespace, setSelectedNamespace] = useState(namespace) // const { namespacesInSidebar, clustersInSidebar } = useNavSelectorInside(selectedClusterName) const { namespacesInSidebar } = useNavSelectorInside(selectedClusterName) diff --git a/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx b/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx index 577ba0f..b6fb99f 100644 --- a/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx +++ b/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx @@ -18,9 +18,10 @@ export const ListInsideClusterAndNs: FC = () => { const [selectedNamespace, setSelectedNamespace] = useState() const namespacesData = useBuiltinResources({ - clusterName: cluster, + clusterName: selectedCluster || '', typeName: 'namespaces', limit: null, + isEnabled: selectedCluster !== undefined, }) return ( diff --git a/src/hooks/useNavSelector/useNavSelector.ts b/src/hooks/useNavSelector/useNavSelector.ts index 6acb35d..4bc12ef 100644 --- a/src/hooks/useNavSelector/useNavSelector.ts +++ b/src/hooks/useNavSelector/useNavSelector.ts @@ -66,6 +66,7 @@ export const useNavSelector = (clusterName?: string, projectName?: string) => { apiVersion: BASE_PROJECTS_VERSION, typeName: BASE_PROJECTS_RESOURCE_NAME, limit: null, + isEnabled: clusterName !== undefined, }) const { data: instances, isSuccess: allInstancesLoadingSuccess } = useApiResources({ @@ -75,6 +76,7 @@ export const useNavSelector = (clusterName?: string, projectName?: string) => { apiVersion: BASE_INSTANCES_VERSION, typeName: BASE_INSTANCES_RESOURCE_NAME, limit: null, + isEnabled: clusterName !== undefined, }) const clustersInSidebar = clusterList ? clusterList.map(mappedClusterToOptionInSidebar) : [] diff --git a/src/hooks/useNavSelectorInside.ts b/src/hooks/useNavSelectorInside.ts index d69405e..5736e2b 100644 --- a/src/hooks/useNavSelectorInside.ts +++ b/src/hooks/useNavSelectorInside.ts @@ -19,6 +19,7 @@ export const useNavSelectorInside = (clusterName?: string) => { clusterName: clusterName || '', typeName: 'namespaces', limit: null, + isEnabled: Boolean(clusterName), }) const clustersInSidebar = clusterList ? clusterList.map(mappedClusterToOptionInSidebar) : [] diff --git a/src/pages/FactoryPage/FactoryPage.tsx b/src/pages/FactoryPage/FactoryPage.tsx index 6ceb1fb..ad6c8e6 100644 --- a/src/pages/FactoryPage/FactoryPage.tsx +++ b/src/pages/FactoryPage/FactoryPage.tsx @@ -5,11 +5,7 @@ import { getBreadcrumbsIdPrefix } from 'utils/getBreadcrumbsIdPrefix' import { getSidebarIdPrefix } from 'utils/getSidebarIdPrefix' import { BaseTemplate } from 'templates' -type TFactoryPageProps = { - forcedTheme?: 'light' | 'dark' -} - -export const FactoryPage: FC = ({ forcedTheme }) => { +export const FactoryPage: FC = () => { const { namespace, syntheticProject, key } = useParams() const [currentTags, setCurrentTags] = useState() @@ -29,7 +25,6 @@ export const FactoryPage: FC = ({ forcedTheme }) => { return ( = ({ forcedTheme }) => { currentTags={currentTags} /> } - withNoCluster + // withNoCluster > diff --git a/src/pages/FormApiPage/FormApiPage.tsx b/src/pages/FormApiPage/FormApiPage.tsx index 96cf7d4..aa623dc 100644 --- a/src/pages/FormApiPage/FormApiPage.tsx +++ b/src/pages/FormApiPage/FormApiPage.tsx @@ -18,11 +18,10 @@ import { BASE_USE_NAMESPACE_NAV } from 'constants/customizationApiGroupAndVersio import { BaseTemplate } from 'templates' type TFormApiPageProps = { - forcedTheme?: 'light' | 'dark' inside?: boolean } -export const FormApiPage: FC = ({ forcedTheme, inside }) => { +export const FormApiPage: FC = ({ inside }) => { const { clusterName, syntheticProject, namespace, apiGroup, apiVersion, typeName, entryName } = useParams() const [searchParams] = useSearchParams() const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) @@ -54,7 +53,6 @@ export const FormApiPage: FC = ({ forcedTheme, inside }) => { return ( = ({ forcedTheme, inside }) => { +export const FormBuiltinPage: FC = ({ inside }) => { const { clusterName, syntheticProject, namespace, typeName, entryName } = useParams() const [searchParams] = useSearchParams() const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) @@ -54,7 +53,6 @@ export const FormBuiltinPage: FC = ({ forcedTheme, inside return ( = ({ forcedTheme, inside }) => { +export const FormCrdPage: FC = ({ inside }) => { const { clusterName, syntheticProject, apiGroup, apiVersion, namespace, typeName, entryName } = useParams() const [searchParams] = useSearchParams() const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) @@ -54,7 +53,6 @@ export const FormCrdPage: FC = ({ forcedTheme, inside }) => { return ( = ({ forcedTheme }) => { +export const ListClustersPage: FC = () => { const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const breadcrumbItems = [ @@ -26,7 +22,7 @@ export const ListClustersPage: FC = ({ forcedTheme }) => ] return ( - + diff --git a/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx b/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx index 4f8950a..bb5f561 100644 --- a/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx +++ b/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx @@ -7,18 +7,17 @@ import { getBreadcrumbsIdPrefix } from 'utils/getBreadcrumbsIdPrefix' import { BaseTemplate } from 'templates' type TListInsideApiByApiGroupPageProps = { - forcedTheme?: 'light' | 'dark' inside?: boolean } -export const ListInsideApiByApiGroupPage: FC = ({ forcedTheme, inside }) => { +export const ListInsideApiByApiGroupPage: FC = ({ inside }) => { const { namespace, apiGroup, apiVersion } = useParams() const sidebarId = `${getSidebarIdPrefix({ namespace: !!namespace, inside })}api-by-api` const breadcrumbsId = `${getBreadcrumbsIdPrefix({ namespace: !!namespace, inside })}api-by-api` return ( - }> + }> diff --git a/src/pages/ListInsideApiPage/ListInsideApiPage.tsx b/src/pages/ListInsideApiPage/ListInsideApiPage.tsx index b38c085..9e5ae09 100644 --- a/src/pages/ListInsideApiPage/ListInsideApiPage.tsx +++ b/src/pages/ListInsideApiPage/ListInsideApiPage.tsx @@ -7,18 +7,17 @@ import { getBreadcrumbsIdPrefix } from 'utils/getBreadcrumbsIdPrefix' import { BaseTemplate } from 'templates' type TListInsideApiPageProps = { - forcedTheme?: 'light' | 'dark' inside?: boolean } -export const ListInsideApiPage: FC = ({ forcedTheme, inside }) => { +export const ListInsideApiPage: FC = ({ inside }) => { const { namespace } = useParams() const sidebarId = `${getSidebarIdPrefix({ namespace: !!namespace, inside })}apis` const breadcrumbsId = `${getBreadcrumbsIdPrefix({ namespace: !!namespace, inside })}apis` return ( - }> + }> diff --git a/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx b/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx index ded39d0..35ab413 100644 --- a/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx +++ b/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx @@ -8,11 +8,10 @@ import { ListInsideClusterAndNs, NavigationContainer } from 'components' import { BaseTemplate } from 'templates' type TListInsideClustersAndNsPageProps = { - forcedTheme?: 'light' | 'dark' inside?: boolean } -export const ListInsideClustersAndNsPage: FC = ({ forcedTheme, inside }) => { +export const ListInsideClustersAndNsPage: FC = ({ inside }) => { const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const breadcrumbItems = [ @@ -27,7 +26,7 @@ export const ListInsideClustersAndNsPage: FC ] return ( - + diff --git a/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx b/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx index 37796a9..19cd151 100644 --- a/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx +++ b/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx @@ -7,18 +7,17 @@ import { getBreadcrumbsIdPrefix } from 'utils/getBreadcrumbsIdPrefix' import { BaseTemplate } from 'templates' type TListInsideCrdByApiGroupPageProps = { - forcedTheme?: 'light' | 'dark' inside?: boolean } -export const ListInsideCrdByApiGroupPage: FC = ({ forcedTheme, inside }) => { +export const ListInsideCrdByApiGroupPage: FC = ({ inside }) => { const { namespace, apiGroup, apiVersion, apiExtensionVersion } = useParams() const sidebarId = `${getSidebarIdPrefix({ namespace: !!namespace, inside })}crd-by-api` const breadcrumbsId = `${getBreadcrumbsIdPrefix({ namespace: !!namespace, inside })}crd-by-api` return ( - }> + }> diff --git a/src/pages/ListProjectsPage/ListProjectsPage.tsx b/src/pages/ListProjectsPage/ListProjectsPage.tsx index 1b9c9e4..1d02c38 100644 --- a/src/pages/ListProjectsPage/ListProjectsPage.tsx +++ b/src/pages/ListProjectsPage/ListProjectsPage.tsx @@ -2,13 +2,9 @@ import React, { FC } from 'react' import { RedirectProjectList } from 'components' import { BaseTemplate } from 'templates' -type TListProjectsPageProps = { - forcedTheme?: 'light' | 'dark' -} - -export const ListProjectsPage: FC = ({ forcedTheme }) => { +export const ListProjectsPage: FC = () => { return ( - + ) diff --git a/src/pages/MainPage/MainPage.tsx b/src/pages/MainPage/MainPage.tsx index 11602d3..ec24134 100644 --- a/src/pages/MainPage/MainPage.tsx +++ b/src/pages/MainPage/MainPage.tsx @@ -2,16 +2,12 @@ import React, { FC, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { BaseTemplate } from 'templates' -type TMainPageProps = { - forcedTheme?: 'light' | 'dark' -} - -export const MainPage: FC = ({ forcedTheme }) => { +export const MainPage: FC = () => { const navigate = useNavigate() useEffect(() => { navigate('./clusters') }, [navigate]) - return + return } diff --git a/src/pages/ProjectInfoPage/ProjectInfoPage.tsx b/src/pages/ProjectInfoPage/ProjectInfoPage.tsx index 8438dc7..f205d63 100644 --- a/src/pages/ProjectInfoPage/ProjectInfoPage.tsx +++ b/src/pages/ProjectInfoPage/ProjectInfoPage.tsx @@ -2,13 +2,9 @@ import React, { FC } from 'react' import { RedirectProjectInfo } from 'components' import { BaseTemplate } from 'templates' -type TProjectInfoPageProps = { - forcedTheme?: 'light' | 'dark' -} - -export const ProjectInfoPage: FC = ({ forcedTheme }) => { +export const ProjectInfoPage: FC = () => { return ( - + ) diff --git a/src/pages/SearchPage/SearchPage.tsx b/src/pages/SearchPage/SearchPage.tsx index c69ed59..33e3e24 100644 --- a/src/pages/SearchPage/SearchPage.tsx +++ b/src/pages/SearchPage/SearchPage.tsx @@ -6,11 +6,7 @@ import { getSidebarIdPrefix } from 'utils/getSidebarIdPrefix' import { getBreadcrumbsIdPrefix } from 'utils/getBreadcrumbsIdPrefix' import { BaseTemplate } from 'templates' -type TSearchPageProps = { - forcedTheme?: 'light' | 'dark' -} - -export const SearchPage: FC = ({ forcedTheme }) => { +export const SearchPage: FC = () => { const { namespace, syntheticProject } = useParams() const possibleProject = syntheticProject && namespace ? syntheticProject : namespace @@ -28,7 +24,6 @@ export const SearchPage: FC = ({ forcedTheme }) => { return ( = ({ forcedTheme, inside }) => { +export const TableApiPage: FC = ({ inside }) => { const { clusterName, namespace, syntheticProject, apiGroup, apiVersion, typeName } = useParams() const [searchParams] = useSearchParams() const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) @@ -62,7 +61,6 @@ export const TableApiPage: FC = ({ forcedTheme, inside }) => return ( = ({ forcedTheme, inside }) => { +export const TableBuiltinPage: FC = ({ inside }) => { const { clusterName, namespace, syntheticProject, typeName } = useParams() const [searchParams] = useSearchParams() const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) @@ -49,7 +48,6 @@ export const TableBuiltinPage: FC = ({ forcedTheme, insi return ( = ({ forcedTheme, inside }) => { +export const TableCrdPage: FC = ({ inside }) => { const { clusterName, namespace, syntheticProject, apiGroup, apiVersion, apiExtensionVersion, crdName } = useParams() const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) @@ -48,7 +47,6 @@ export const TableCrdPage: FC = ({ forcedTheme, inside }) => return ( = ({ - children, - withNoCluster, - forcedTheme, - inside, - isSearch, - sidebar, -}) => { - const navigate = useNavigate() - const { clusterName } = useParams() - const { useToken } = antdtheme - const { token } = useToken() - const dispatch = useDispatch() - const theme = useSelector((state: RootState) => state.openapiTheme.theme) +export const BaseTemplate: FC = ({ children, inside, isSearch, sidebar }) => { const isFederation = useSelector((state: RootState) => state.federation.isFederation) - const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) - const clusterListQuery = useClusterList({ refetchInterval: false }) - - useEffect(() => { - if (forcedTheme) { - return - } - const localStorageTheme = localStorage.getItem('theme') - if (localStorageTheme && (localStorageTheme === 'dark' || localStorageTheme === 'light')) { - dispatch(setTheme(localStorageTheme)) - } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) { - localStorage.setItem('theme', 'dark') - dispatch(setTheme('dark')) - } else { - localStorage.setItem('theme', 'light') - dispatch(setTheme('light')) - } - }, [dispatch, forcedTheme]) - - useEffect(() => { - if (forcedTheme) { - dispatch(setTheme(forcedTheme)) - } - }, [dispatch, forcedTheme]) - - const handleStorage = useCallback(() => { - const localStorageTheme = localStorage.getItem('theme') - if (localStorageTheme && (localStorageTheme === 'dark' || localStorageTheme === 'light')) { - dispatch(setTheme(localStorageTheme)) - } - }, [dispatch]) - - useEffect(() => { - window.addEventListener('storage', handleStorage) - - return () => { - window.removeEventListener('storage', handleStorage) - } - }, [handleStorage]) - - useEffect(() => { - if (clusterListQuery.data) { - dispatch(setClusterList(clusterListQuery.data)) - } - }, [clusterListQuery, dispatch]) - - if (clusterName) { - dispatch(setCluster(clusterName)) - } - - if (clusterName === undefined) { - dispatch(setCluster('')) - } - - if (!clusterName && !withNoCluster) { - navigate(`${baseprefix}/`) - } return ( - - - - - -
- - - - - - - - {clusterListQuery.error && ( - - )} - {children} - -