From e63eba36e26489c2727d74805877224dc63b1987 Mon Sep 17 00:00:00 2001 From: typescreep Date: Wed, 15 Oct 2025 14:40:05 +0300 Subject: [PATCH] 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}