mirror of
https://github.com/outbackdingo/openapi-ui.git
synced 2026-01-27 18:19:50 +00:00
factory improvement
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -11,8 +11,8 @@
|
||||
"@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.16",
|
||||
"@readme/openapi-parser": "^4.0.0",
|
||||
"@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.17",
|
||||
"@readme/openapi-parser": "4.0.0",
|
||||
"@reduxjs/toolkit": "2.2.5",
|
||||
"@tanstack/react-query": "5.62.2",
|
||||
"@tanstack/react-query-devtools": "5.62.2",
|
||||
@@ -2752,9 +2752,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@prorobotech/openapi-k8s-toolkit": {
|
||||
"version": "0.0.1-alpha.16",
|
||||
"resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.16.tgz",
|
||||
"integrity": "sha512-mo+4Fbp+bi1zTuaheq53vpiS9Ole4a823IiwElsY1PM0eJs5EYprqhXI7l5BRlYQTeyL8tDTtfNQ6Ck4wikbAw==",
|
||||
"version": "0.0.1-alpha.17",
|
||||
"resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.17.tgz",
|
||||
"integrity": "sha512-nGJXsCN01Q/h4KMrS557xdKdE9XrKDuoepiR9CZf6kQcd/c338TcJ6P8X3CVDCd6hNVJ3QzpPK+0oU6LhArQ4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@monaco-editor/react": "4.6.0",
|
||||
|
||||
@@ -17,7 +17,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.16",
|
||||
"@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.17",
|
||||
"@readme/openapi-parser": "4.0.0",
|
||||
"@reduxjs/toolkit": "2.2.5",
|
||||
"@tanstack/react-query": "5.62.2",
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
import React, { FC } from 'react'
|
||||
import { DynamicExample } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import {
|
||||
DynamicComponents,
|
||||
DynamicRendererWithProviders,
|
||||
TDynamicComponentsAppTypeMap,
|
||||
useDirectUnknownResource,
|
||||
TFactoryResponse,
|
||||
} from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { RootState } from 'store/store'
|
||||
import { BASE_API_GROUP, BASE_API_VERSION } from 'constants/customizationApiGroupAndVersion'
|
||||
|
||||
export const Factory: FC = () => {
|
||||
return <DynamicExample />
|
||||
const cluster = useSelector((state: RootState) => state.cluster.cluster)
|
||||
const { key } = useParams()
|
||||
|
||||
const { data: factoryData } = useDirectUnknownResource<TFactoryResponse<TDynamicComponentsAppTypeMap>>({
|
||||
uri: `/api/clusters/${cluster}/k8s/apis/${BASE_API_GROUP}/${BASE_API_VERSION}/factories/`,
|
||||
refetchInterval: false,
|
||||
queryKey: ['factories', cluster || 'no-cluster'],
|
||||
isEnabled: cluster !== undefined,
|
||||
})
|
||||
|
||||
const { spec } = factoryData?.items.find(({ spec }) => spec.key === key) ?? { spec: undefined }
|
||||
|
||||
if (!spec) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <DynamicRendererWithProviders items={spec.data} components={DynamicComponents} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user