mirror of
https://github.com/outbackdingo/openapi-ui.git
synced 2026-01-27 10:19:49 +00:00
Merge pull request #173 from PRO-Robotech/feature/dev
ownerRef | base factories mapping | codestyles
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": "1.1.0-alpha.8",
|
||||
"@prorobotech/openapi-k8s-toolkit": "^1.1.0-alpha.9",
|
||||
"@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": "1.1.0-alpha.8",
|
||||
"resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-1.1.0-alpha.8.tgz",
|
||||
"integrity": "sha512-bv7paXWtah6Wj1UnTPhx9akfWjKw/CXtddmm2f18ehvDqYgKqmDE4ZLEdBC6pFugxIwiyuXTnQ73pePnT8u+Jw==",
|
||||
"version": "1.1.0-alpha.9",
|
||||
"resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-1.1.0-alpha.9.tgz",
|
||||
"integrity": "sha512-Lb97O5RsOQLwhUTetnXeVXqCHRhZRXOxLqVHp24xnyInwWvMbCsgVn3tXKSQz2MFIuyCw1HWVdN5/Dh19GiPdA==",
|
||||
"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": "^1.1.0-alpha.8",
|
||||
"@prorobotech/openapi-k8s-toolkit": "1.1.0-alpha.9",
|
||||
"@readme/openapi-parser": "4.0.0",
|
||||
"@reduxjs/toolkit": "2.2.5",
|
||||
"@tanstack/react-query": "5.62.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { FC, useState, useEffect } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { BlackholeFormDataProvider, TJSON } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { BlackholeFormProvider, TJSON } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useSelector } from 'react-redux'
|
||||
import type { RootState } from 'store/store'
|
||||
import {
|
||||
@@ -83,7 +83,7 @@ export const BlackholeForm: FC<TBlackholeFormProps> = ({ data, customizationId,
|
||||
}
|
||||
|
||||
return (
|
||||
<BlackholeFormDataProvider
|
||||
<BlackholeFormProvider
|
||||
theme={theme}
|
||||
cluster={cluster}
|
||||
urlParams={urlParams}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { FC } from 'react'
|
||||
import { useLocation, useParams } from 'react-router-dom'
|
||||
import { ManageableBreadcrumbsWithDataProvider } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { ManageableBreadcrumbsProvider } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { BASE_API_GROUP, BASE_API_VERSION } from 'constants/customizationApiGroupAndVersion'
|
||||
|
||||
type TManageableBreadCrumbsProps = {
|
||||
@@ -30,7 +30,7 @@ export const ManageableBreadcrumbs: FC<TManageableBreadCrumbsProps> = ({ idToCom
|
||||
}, {})
|
||||
|
||||
return (
|
||||
<ManageableBreadcrumbsWithDataProvider
|
||||
<ManageableBreadcrumbsProvider
|
||||
idToCompare={idToCompare}
|
||||
cluster={clusterName}
|
||||
apiGroup={BASE_API_GROUP}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { FC, useState, useEffect } from 'react'
|
||||
import { theme as antdtheme } from 'antd'
|
||||
import { useLocation, useParams } from 'react-router-dom'
|
||||
import { ManageableSidebarWithDataProvider } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { ManageableSidebarProvider } from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useSelector } from 'react-redux'
|
||||
import type { RootState } from 'store/store'
|
||||
// import { HEAD_FIRST_ROW, SIDEBAR_CLUSTER_HEIGHT } from 'constants/blocksSizes'
|
||||
@@ -66,7 +66,7 @@ export const ManageableSidebar: FC<TManageableSidebarProps> = ({
|
||||
$colorBorder={token.colorBorder}
|
||||
$maxHeight={height}
|
||||
>
|
||||
<ManageableSidebarWithDataProvider
|
||||
<ManageableSidebarProvider
|
||||
cluster={clusterName}
|
||||
apiGroup={BASE_API_GROUP}
|
||||
apiVersion={BASE_API_VERSION}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom'
|
||||
import {
|
||||
// useDirectUnknownResource,
|
||||
useK8sSmartResource,
|
||||
TNavigationResource,
|
||||
} from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useNavSelector } from 'hooks/useNavSelector'
|
||||
import { useMountEffect } from 'hooks/useMountEffect'
|
||||
@@ -44,7 +45,7 @@ export const Selector: FC<TSelectorProps> = ({ clusterName, projectName, instanc
|
||||
// })
|
||||
|
||||
const { data: navigationDataArr } = useK8sSmartResource<{
|
||||
items: { spec: { projects: { clear: string; change: string }; instances: { clear: string; change: string } } }[]
|
||||
items: TNavigationResource[]
|
||||
}>({
|
||||
cluster: clusterName || '',
|
||||
group: BASE_API_GROUP,
|
||||
@@ -66,13 +67,13 @@ export const Selector: FC<TSelectorProps> = ({ clusterName, projectName, instanc
|
||||
if (value && value !== 'all') {
|
||||
setSelectedProjectName(value)
|
||||
const changeUrl =
|
||||
navigationData?.spec.projects.change
|
||||
navigationData?.spec?.projects?.change
|
||||
.replace('{selectedCluster}', selectedClusterName || 'no-cluster')
|
||||
.replace('{value}', value) || 'no navigation data'
|
||||
navigate(changeUrl)
|
||||
} else {
|
||||
const clearUrl =
|
||||
navigationData?.spec.projects.clear.replace('{selectedCluster}', selectedClusterName || 'no-cluster') ||
|
||||
navigationData?.spec?.projects?.clear.replace('{selectedCluster}', selectedClusterName || 'no-cluster') ||
|
||||
'no navigation data'
|
||||
navigate(clearUrl)
|
||||
}
|
||||
@@ -82,14 +83,14 @@ export const Selector: FC<TSelectorProps> = ({ clusterName, projectName, instanc
|
||||
if (value && value !== 'all') {
|
||||
setSelectedInstanceName(value)
|
||||
const changeUrl =
|
||||
navigationData?.spec.instances.change
|
||||
navigationData?.spec?.instances?.change
|
||||
.replace('{selectedCluster}', selectedClusterName || 'no-cluster')
|
||||
.replace('{selectedProject}', selectedProjectName || 'no-project')
|
||||
.replace('{value}', value) || 'no navigation data'
|
||||
navigate(changeUrl)
|
||||
} else {
|
||||
const clearUrl =
|
||||
navigationData?.spec.instances.clear
|
||||
navigationData?.spec?.instances?.clear
|
||||
.replace('{selectedCluster}', selectedClusterName || 'no-cluster')
|
||||
.replace('{selectedProject}', selectedProjectName || 'no-project') || 'no navigation data'
|
||||
navigate(clearUrl)
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import {
|
||||
// useDirectUnknownResource,
|
||||
useK8sSmartResource,
|
||||
TNavigationResource,
|
||||
} from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useSelector } from 'react-redux'
|
||||
import type { RootState } from 'store/store'
|
||||
@@ -44,9 +45,7 @@ export const SelectorNamespace: FC<TSelectorNamespaceProps> = ({ clusterName, na
|
||||
// })
|
||||
|
||||
const { data: navigationDataArr } = useK8sSmartResource<{
|
||||
items: {
|
||||
spec: { namespaces: { clear: string; change: string } }
|
||||
}[]
|
||||
items: TNavigationResource[]
|
||||
}>({
|
||||
cluster: clusterName || '',
|
||||
group: BASE_API_GROUP,
|
||||
@@ -101,13 +100,13 @@ export const SelectorNamespace: FC<TSelectorNamespaceProps> = ({ clusterName, na
|
||||
if (value && value !== 'all') {
|
||||
setSelectedNamespace(value)
|
||||
const changeUrl =
|
||||
navigationData?.spec.namespaces.change
|
||||
navigationData?.spec?.namespaces?.change
|
||||
.replace('{selectedCluster}', selectedClusterName || 'no-cluster')
|
||||
.replace('{value}', value) || 'no navigation data'
|
||||
navigate(changeUrl)
|
||||
} else {
|
||||
const clearUrl =
|
||||
navigationData?.spec.namespaces.clear.replace('{selectedCluster}', selectedClusterName || 'no-cluster') ||
|
||||
navigationData?.spec?.namespaces?.clear.replace('{selectedCluster}', selectedClusterName || 'no-cluster') ||
|
||||
'no navigation data'
|
||||
navigate(clearUrl)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
TSingleResource,
|
||||
// useDirectUnknownResource,
|
||||
useK8sSmartResource,
|
||||
TNavigationResource,
|
||||
} from '@prorobotech/openapi-k8s-toolkit'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { RootState } from 'store/store'
|
||||
@@ -61,9 +62,7 @@ export const useNavSelector = (clusterName?: string, projectName?: string) => {
|
||||
// })
|
||||
|
||||
const { data: navigationDataArr } = useK8sSmartResource<{
|
||||
items: {
|
||||
spec: { instances: { mapOptionsPattern: string } }
|
||||
}[]
|
||||
items: TNavigationResource[]
|
||||
}>({
|
||||
cluster: clusterName || '',
|
||||
group: BASE_API_GROUP,
|
||||
@@ -133,7 +132,7 @@ export const useNavSelector = (clusterName?: string, projectName?: string) => {
|
||||
.map(item =>
|
||||
mappedInstanceToOptionInSidebar({
|
||||
instance: item,
|
||||
templateString: navigationData?.spec.instances.mapOptionsPattern,
|
||||
templateString: navigationData?.spec?.instances?.mapOptionsPattern,
|
||||
}),
|
||||
)
|
||||
: []
|
||||
|
||||
Reference in New Issue
Block a user