mirror of
https://github.com/outbackdingo/openapi-ui.git
synced 2026-01-27 10:19:49 +00:00
new table prepare
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
usePermissions,
|
||||
DeleteModal,
|
||||
DeleteModalMany,
|
||||
checkIfBuiltInInstanceNamespaceScoped,
|
||||
checkIfApiInstanceNamespaceScoped,
|
||||
// checkIfBuiltInInstanceNamespaceScoped,
|
||||
// checkIfApiInstanceNamespaceScoped,
|
||||
useBuiltinResources,
|
||||
useApiResources,
|
||||
Spacer,
|
||||
@@ -72,8 +72,8 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
|
||||
)
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([])
|
||||
const [selectedRowsData, setSelectedRowsData] = useState<{ name: string; endpoint: string }[]>([])
|
||||
const [isNamespaced, setIsNamespaced] = useState<boolean>()
|
||||
const [isNamespacedLoading, setIsNamespacedLoading] = useState<boolean>()
|
||||
// const [isNamespaced, setIsNamespaced] = useState<boolean>()
|
||||
// const [isNamespacedLoading, setIsNamespacedLoading] = useState<boolean>()
|
||||
|
||||
const [height, setHeight] = useState(0)
|
||||
|
||||
@@ -99,39 +99,39 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
|
||||
}
|
||||
}, [])
|
||||
|
||||
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<TTableApiBuiltinProps> = ({
|
||||
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<TTableApiBuiltinProps> = ({
|
||||
})
|
||||
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}
|
||||
>
|
||||
<PlusOutlined />
|
||||
Add {kindName}
|
||||
|
||||
Reference in New Issue
Block a user