mirror of
https://github.com/outbackdingo/openapi-ui.git
synced 2026-01-27 18:19:50 +00:00
new tableurimappings, new props for factory and enrichedtable, fix controls
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.55",
|
||||
"@prorobotech/openapi-k8s-toolkit": "^0.0.1-alpha.56",
|
||||
"@readme/openapi-parser": "4.0.0",
|
||||
"@reduxjs/toolkit": "2.2.5",
|
||||
"@tanstack/react-query": "5.62.2",
|
||||
@@ -2798,9 +2798,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@prorobotech/openapi-k8s-toolkit": {
|
||||
"version": "0.0.1-alpha.55",
|
||||
"resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.55.tgz",
|
||||
"integrity": "sha512-AleLtpAsOvTN3/dunR9/lQmh1gxJNvL5RgVNQMfmR6WomVeKqEJvm9hlEUfPJrQYpnUsFc/k/BuZqasg/+WGog==",
|
||||
"version": "0.0.1-alpha.56",
|
||||
"resolved": "https://registry.npmjs.org/@prorobotech/openapi-k8s-toolkit/-/openapi-k8s-toolkit-0.0.1-alpha.56.tgz",
|
||||
"integrity": "sha512-4LcT6KxpkcnxZE9plji23VqRJUoYF2bgwtLtuHva/LyStHIHiR/mWk++u39o2tf/yub3A7F2jxbxvgppLgb7UA==",
|
||||
"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.55",
|
||||
"@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.56",
|
||||
"@readme/openapi-parser": "4.0.0",
|
||||
"@reduxjs/toolkit": "2.2.5",
|
||||
"@tanstack/react-query": "5.62.2",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { FC } from 'react'
|
||||
import React, { FC, useState, useEffect } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import {
|
||||
DynamicComponents,
|
||||
@@ -6,16 +6,35 @@ import {
|
||||
TDynamicComponentsAppTypeMap,
|
||||
useDirectUnknownResource,
|
||||
TFactoryResponse,
|
||||
ContentCard,
|
||||
} 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'
|
||||
import { HEAD_FIRST_ROW, HEAD_SECOND_ROW, FOOTER_HEIGHT, NAV_HEIGHT } from 'constants/blocksSizes'
|
||||
|
||||
export const Factory: FC = () => {
|
||||
const theme = useSelector((state: RootState) => state.openapiTheme.theme)
|
||||
const cluster = useSelector((state: RootState) => state.cluster.cluster)
|
||||
const { key } = useParams()
|
||||
|
||||
const [height, setHeight] = useState(0)
|
||||
|
||||
useEffect(() => {
|
||||
const height = window.innerHeight - HEAD_FIRST_ROW - HEAD_SECOND_ROW - NAV_HEIGHT - FOOTER_HEIGHT
|
||||
setHeight(height)
|
||||
|
||||
const handleResize = () => {
|
||||
setHeight(height)
|
||||
}
|
||||
|
||||
window.addEventListener('resize', handleResize)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', handleResize)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const { data: factoryData } = useDirectUnknownResource<TFactoryResponse<TDynamicComponentsAppTypeMap>>({
|
||||
uri: `/api/clusters/${cluster}/k8s/apis/${BASE_API_GROUP}/${BASE_API_VERSION}/factories/`,
|
||||
refetchInterval: false,
|
||||
@@ -29,6 +48,19 @@ export const Factory: FC = () => {
|
||||
return null
|
||||
}
|
||||
|
||||
if (spec.withScrollableMainContentCard) {
|
||||
return (
|
||||
<ContentCard flexGrow={1} displayFlex flexFlow="column" maxHeight={height}>
|
||||
<DynamicRendererWithProviders
|
||||
urlsToFetch={spec.urlsToFetch}
|
||||
theme={theme}
|
||||
items={spec.data}
|
||||
components={DynamicComponents}
|
||||
/>
|
||||
</ContentCard>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<DynamicRendererWithProviders
|
||||
urlsToFetch={spec.urlsToFetch}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React, { FC } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { ManageableBreadcrumbs, Factory, NavigationContainer } from 'components'
|
||||
import { ManageableBreadcrumbs, ManageableSidebar, Factory, NavigationContainer } from 'components'
|
||||
import { getBreadcrumbsIdPrefix } from 'utils/getBreadcrumbsIdPrefix'
|
||||
import { getSidebarIdPrefix } from 'utils/getSidebarIdPrefix'
|
||||
import { BaseTemplate } from 'templates'
|
||||
|
||||
type TFactoryPageProps = {
|
||||
@@ -11,13 +12,27 @@ type TFactoryPageProps = {
|
||||
export const FactoryPage: FC<TFactoryPageProps> = ({ forcedTheme }) => {
|
||||
const { namespace, syntheticProject, key } = useParams()
|
||||
|
||||
const possibleProject = syntheticProject && namespace ? syntheticProject : namespace
|
||||
const possibleInstance = syntheticProject && namespace ? namespace : undefined
|
||||
|
||||
const breadcrumbsId = `${getBreadcrumbsIdPrefix({
|
||||
instance: !!syntheticProject,
|
||||
project: !!namespace,
|
||||
})}factory-${key}`
|
||||
|
||||
const sidebarId = `${getSidebarIdPrefix({
|
||||
instance: !!syntheticProject,
|
||||
project: !!namespace,
|
||||
})}factory-${key}`
|
||||
|
||||
return (
|
||||
<BaseTemplate forcedTheme={forcedTheme} withNoCluster>
|
||||
<BaseTemplate
|
||||
forcedTheme={forcedTheme}
|
||||
sidebar={
|
||||
<ManageableSidebar instanceName={possibleInstance} projectName={possibleProject} idToCompare={sidebarId} />
|
||||
}
|
||||
withNoCluster
|
||||
>
|
||||
<NavigationContainer>
|
||||
<ManageableBreadcrumbs idToCompare={breadcrumbsId} />
|
||||
</NavigationContainer>
|
||||
|
||||
Reference in New Issue
Block a user