diff --git a/.env b/.env index 69aead1..ddc386a 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ VITE_CUSTOMIZATION_API_GROUP=incloud.io VITE_CUSTOMIZATION_API_VERSION=v1alpha -VITE_RPROJECTS_VERSION=v1alpha +VITE_PROJECTS_VERSION=v1alpha +VITE_INSTANCES_VERSION=v1alpha1 diff --git a/src/components/molecules/MarketPlace/molecules/CardInProject/utils.ts b/src/components/molecules/MarketPlace/molecules/CardInProject/utils.ts index 5430b7e..4957490 100644 --- a/src/components/molecules/MarketPlace/molecules/CardInProject/utils.ts +++ b/src/components/molecules/MarketPlace/molecules/CardInProject/utils.ts @@ -28,7 +28,7 @@ export const getPathToNav = ({ } if (type === 'nonCrd') { - return `${baseprefix}/${clusterName}/${namespace}/non-crd-table/${apiGroup}/${apiVersion}/${typeName}` + return `${baseprefix}/${clusterName}/${namespace}/api-table/${apiGroup}/${apiVersion}/${typeName}` } return `${baseprefix}/${clusterName}/${namespace}/builtin-table/${typeName}` diff --git a/src/components/organisms/Header/organisms/Selector/Selector.tsx b/src/components/organisms/Header/organisms/Selector/Selector.tsx index 2e42ca7..6f093e9 100644 --- a/src/components/organisms/Header/organisms/Selector/Selector.tsx +++ b/src/components/organisms/Header/organisms/Selector/Selector.tsx @@ -41,7 +41,7 @@ export const Selector: FC = ({ clusterName, projectName, instanc const handleInstanceChange = (value: string) => { setSelectedInstanceName(value) - navigate(`${baseprefix}/${selectedClusterName}/${value}/${selectedProjectName}/non-crd-table/apps/v1/deployments`) + navigate(`${baseprefix}/${selectedClusterName}/${value}/${selectedProjectName}/api-table/apps/v1/deployments`) } useMountEffect(() => { diff --git a/src/constants/customizationApiGroupAndVersion.ts b/src/constants/customizationApiGroupAndVersion.ts index 39e7c9d..c998b66 100644 --- a/src/constants/customizationApiGroupAndVersion.ts +++ b/src/constants/customizationApiGroupAndVersion.ts @@ -1,3 +1,4 @@ export const BASE_API_GROUP = import.meta.env.VITE_CUSTOMIZATION_API_GROUP export const BASE_API_VERSION = import.meta.env.VITE_CUSTOMIZATION_API_VERSION -export const BASE_RPROJECTS_VERSION = import.meta.env.VITE_RPROJECTS_VERSION +export const BASE_RPROJECTS_VERSION = import.meta.env.VITE_PROJECTS_VERSION +export const BASE_INSTANCES_VERSION = import.meta.env.VITE_INSTANCES_VERSION diff --git a/src/hooks/useNavSelector.ts b/src/hooks/useNavSelector.ts index 4198035..3064671 100644 --- a/src/hooks/useNavSelector.ts +++ b/src/hooks/useNavSelector.ts @@ -1,7 +1,11 @@ import { useApiResources, TClusterList, TSingleResource } from '@prorobotech/openapi-k8s-toolkit' import { useSelector } from 'react-redux' import { RootState } from 'store/store' -import { BASE_API_GROUP, BASE_RPROJECTS_VERSION } from 'constants/customizationApiGroupAndVersion' +import { + BASE_API_GROUP, + BASE_RPROJECTS_VERSION, + BASE_INSTANCES_VERSION, +} from 'constants/customizationApiGroupAndVersion' const mappedClusterToOptionInSidebar = ({ name }: TClusterList[number]): { value: string; label: string } => ({ value: name, @@ -29,7 +33,7 @@ export const useNavSelector = (clusterName?: string, projectName?: string) => { clusterName: clusterName || '', namespace: '', apiGroup: BASE_API_GROUP, - apiVersion: BASE_RPROJECTS_VERSION, + apiVersion: BASE_INSTANCES_VERSION, typeName: 'instances', limit: null, }) diff --git a/src/pages/FormApiPage/FormApiPage.tsx b/src/pages/FormApiPage/FormApiPage.tsx index 60cd940..a9c3c02 100644 --- a/src/pages/FormApiPage/FormApiPage.tsx +++ b/src/pages/FormApiPage/FormApiPage.tsx @@ -1,6 +1,8 @@ import React, { FC } from 'react' import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams, useSearchParams } from 'react-router-dom' +import { useSelector } from 'react-redux' +import type { RootState } from 'store/store' import { CreateApisForm, UpdateApisForm, BackLink, ManageableBreadcrumbs } from 'components' import { BaseTemplate } from 'templates' @@ -11,10 +13,15 @@ type TFormApiPageProps = { export const FormApiPage: FC = ({ forcedTheme }) => { const { clusterName, syntheticProject, namespace, apiGroup, apiVersion, typeName, entryName } = useParams() const [searchParams] = useSearchParams() + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const possibleProject = syntheticProject && namespace ? syntheticProject : namespace const possibleInstance = syntheticProject && namespace ? namespace : undefined + const customBacklink = possibleInstance + ? `${baseprefix}/${clusterName}/${possibleInstance}/${possibleProject}/api-table/apps/v1/deployments` + : `${baseprefix}/clusters/${clusterName}/projects/${possibleProject}` + if (!typeName || !apiGroup || !apiVersion) { return null } @@ -25,12 +32,7 @@ export const FormApiPage: FC = ({ forcedTheme }) => { = ({ forcedTheme }) => { const { clusterName, syntheticProject, namespace, typeName, entryName } = useParams() const [searchParams] = useSearchParams() + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const possibleProject = syntheticProject && namespace ? syntheticProject : namespace const possibleInstance = syntheticProject && namespace ? namespace : undefined + const customBacklink = possibleInstance + ? `${baseprefix}/${clusterName}/${possibleInstance}/${possibleProject}/api-table/apps/v1/deployments` + : `${baseprefix}/clusters/${clusterName}/projects/${possibleProject}` + if (!typeName) { return null } @@ -25,12 +32,7 @@ export const FormBuiltinPage: FC = ({ forcedTheme }) => { diff --git a/src/pages/FormCrdPage/FormCrdPage.tsx b/src/pages/FormCrdPage/FormCrdPage.tsx index ef7ec9a..0c01766 100644 --- a/src/pages/FormCrdPage/FormCrdPage.tsx +++ b/src/pages/FormCrdPage/FormCrdPage.tsx @@ -1,6 +1,8 @@ import React, { FC } from 'react' import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams, useSearchParams } from 'react-router-dom' +import { useSelector } from 'react-redux' +import type { RootState } from 'store/store' import { CreateCrdsForm, UpdateCrdsForm, BackLink, ManageableBreadcrumbs } from 'components' import { BaseTemplate } from 'templates' @@ -11,10 +13,15 @@ type TFormCrdPageProps = { export const FormCrdPage: FC = ({ forcedTheme }) => { const { clusterName, syntheticProject, apiGroup, apiVersion, namespace, typeName, entryName } = useParams() const [searchParams] = useSearchParams() + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const possibleProject = syntheticProject && namespace ? syntheticProject : namespace const possibleInstance = syntheticProject && namespace ? namespace : undefined + const customBacklink = possibleInstance + ? `${baseprefix}/${clusterName}/${possibleInstance}/${possibleProject}/api-table/apps/v1/deployments` + : `${baseprefix}/clusters/${clusterName}/projects/${possibleProject}` + if (!typeName || !apiGroup || !apiVersion) { return null } @@ -25,12 +32,7 @@ export const FormCrdPage: FC = ({ forcedTheme }) => { = ({ forcedTheme }) => const breadcrumbItems = [ { - title: ( - - - - ), + title: In-Cloud, key: 'home', }, { diff --git a/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx b/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx index ab3fb70..f34dbdf 100644 --- a/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx +++ b/src/pages/ListInsideApiByApiGroupPage/ListInsideApiByApiGroupPage.tsx @@ -4,7 +4,6 @@ import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams, Link } from 'react-router-dom' import { useSelector } from 'react-redux' import type { RootState } from 'store/store' -import { HomeOutlined } from '@ant-design/icons' import { ListInsideApisByApiGroup } from 'components' import { BaseTemplate } from 'templates' @@ -18,11 +17,7 @@ export const ListInsideApiByApiGroupPage: FC const breadcrumbItems = [ { - title: ( - - - - ), + title: In-Cloud: inside, key: 'home', }, { diff --git a/src/pages/ListInsideApiPage/ListInsideApiPage.tsx b/src/pages/ListInsideApiPage/ListInsideApiPage.tsx index 8dfbdc9..1621557 100644 --- a/src/pages/ListInsideApiPage/ListInsideApiPage.tsx +++ b/src/pages/ListInsideApiPage/ListInsideApiPage.tsx @@ -4,7 +4,6 @@ import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams, Link } from 'react-router-dom' import { useSelector } from 'react-redux' import type { RootState } from 'store/store' -import { HomeOutlined } from '@ant-design/icons' import { ListInsideAllResources } from 'components' import { BaseTemplate } from 'templates' @@ -18,11 +17,7 @@ export const ListInsideApiPage: FC = ({ forcedTheme }) const breadcrumbItems = [ { - title: ( - - - - ), + title: In-Cloud: inside, key: 'home', }, { diff --git a/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx b/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx index 7b87b80..b2075fb 100644 --- a/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx +++ b/src/pages/ListInsideClustersAndNsPage/ListInsideClustersAndNsPage.tsx @@ -1,4 +1,9 @@ import React, { FC } from 'react' +import { Breadcrumb } from 'antd' +import { Spacer } from '@prorobotech/openapi-k8s-toolkit' +import { Link } from 'react-router-dom' +import { useSelector } from 'react-redux' +import type { RootState } from 'store/store' import { ListInsideClusterAndNs } from 'components' import { BaseTemplate } from 'templates' @@ -6,8 +11,25 @@ type TListInsideClustersAndNsPageProps = { forcedTheme?: 'light' | 'dark' } -export const ListInsideClustersAndNsPage: FC = ({ forcedTheme }) => ( - - - -) +export const ListInsideClustersAndNsPage: FC = ({ forcedTheme }) => { + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) + + const breadcrumbItems = [ + { + title: In-Cloud: inside, + key: 'home', + }, + { + title: 'Select cluster / namespace', + key: 'select-cluster-and-ns', + }, + ] + + return ( + + + + + + ) +} diff --git a/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx b/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx index 185a918..4af8a1a 100644 --- a/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx +++ b/src/pages/ListInsideCrdByApiGroupPage/ListInsideCrdByApiGroupPage.tsx @@ -4,7 +4,6 @@ import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams, Link } from 'react-router-dom' import { useSelector } from 'react-redux' import type { RootState } from 'store/store' -import { HomeOutlined } from '@ant-design/icons' import { ListInsideCrdsByApiGroup } from 'components' import { BaseTemplate } from 'templates' @@ -18,11 +17,7 @@ export const ListInsideCrdByApiGroupPage: FC const breadcrumbItems = [ { - title: ( - - - - ), + title: In-Cloud: inside, key: 'home', }, { diff --git a/src/pages/TableApiPage/TableApiPage.tsx b/src/pages/TableApiPage/TableApiPage.tsx index 4b06080..b20bc1f 100644 --- a/src/pages/TableApiPage/TableApiPage.tsx +++ b/src/pages/TableApiPage/TableApiPage.tsx @@ -1,8 +1,11 @@ import React, { FC } from 'react' import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams, useSearchParams } from 'react-router-dom' +import { useSelector } from 'react-redux' +import type { RootState } from 'store/store' import { TableNonCrdInfo, BackLink, ManageableBreadcrumbs } from 'components' import { BaseTemplate } from 'templates' +import { BASE_API_GROUP, BASE_INSTANCES_VERSION } from 'constants/customizationApiGroupAndVersion' type TTableApiPageProps = { forcedTheme?: 'light' | 'dark' @@ -11,21 +14,29 @@ type TTableApiPageProps = { export const TableApiPage: FC = ({ forcedTheme }) => { const { clusterName, namespace, syntheticProject, apiGroup, apiVersion, typeName } = useParams() const [searchParams] = useSearchParams() + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const possibleProject = syntheticProject && namespace ? syntheticProject : namespace const possibleInstance = syntheticProject && namespace ? namespace : undefined + const customBacklink = possibleInstance + ? // ? `${baseprefix}/${clusterName}/${possibleInstance}/${possibleProject}/api-table/apps/v1/deployments` + `${baseprefix}/${clusterName}/${possibleProject}/api-table/${BASE_API_GROUP}/${BASE_INSTANCES_VERSION}/instances` + : `${baseprefix}/clusters/${clusterName}/projects/${possibleProject}` + + const clustererBacklink = `${baseprefix}/clusters` + + // const instancesBacklink = + // apiGroup === 'apps' && apiVersion === 'v1' && typeName === 'deployments' + // ? `${baseprefix}/${clusterName}/${possibleProject}/api-table/${BASE_API_GROUP}/${BASE_INSTANCES_VERSION}/instances` + // : undefined + + // const nonInstanceBackLink = namespace ? customBacklink : clustererBacklink + return ( - + {typeName && apiGroup && apiVersion && ( = ({ forcedTheme }) => { const { clusterName, namespace, syntheticProject, typeName } = useParams() const [searchParams] = useSearchParams() + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const possibleProject = syntheticProject && namespace ? syntheticProject : namespace const possibleInstance = syntheticProject && namespace ? namespace : undefined + const customBacklink = possibleInstance + ? `${baseprefix}/${clusterName}/${possibleProject}/api-table/${BASE_API_GROUP}/${BASE_INSTANCES_VERSION}/instances` + : `${baseprefix}/clusters/${clusterName}/projects/${possibleProject}` + + const clustererBacklink = `${baseprefix}/clusters` + return ( - + {typeName && } diff --git a/src/pages/TableCrdPage/TableCrdPage.tsx b/src/pages/TableCrdPage/TableCrdPage.tsx index 714a9ff..0d62099 100644 --- a/src/pages/TableCrdPage/TableCrdPage.tsx +++ b/src/pages/TableCrdPage/TableCrdPage.tsx @@ -1,8 +1,11 @@ import React, { FC } from 'react' import { Spacer } from '@prorobotech/openapi-k8s-toolkit' import { useParams } from 'react-router-dom' +import { useSelector } from 'react-redux' +import type { RootState } from 'store/store' import { TableCrdInfo, BackLink, ManageableBreadcrumbs } from 'components' import { BaseTemplate } from 'templates' +import { BASE_API_GROUP, BASE_INSTANCES_VERSION } from 'constants/customizationApiGroupAndVersion' type TTableCrdPageProps = { forcedTheme?: 'light' | 'dark' @@ -10,21 +13,21 @@ type TTableCrdPageProps = { export const TableCrdPage: FC = ({ forcedTheme }) => { const { clusterName, namespace, syntheticProject, apiGroup, apiVersion, apiExtensionVersion, crdName } = useParams() + const baseprefix = useSelector((state: RootState) => state.baseprefix.baseprefix) const possibleProject = syntheticProject && namespace ? syntheticProject : namespace const possibleInstance = syntheticProject && namespace ? namespace : undefined + const customBacklink = possibleInstance + ? `${baseprefix}/${clusterName}/${possibleProject}/api-table/${BASE_API_GROUP}/${BASE_INSTANCES_VERSION}/instances` + : `${baseprefix}/clusters/${clusterName}/projects/${possibleProject}` + + const clustererBacklink = `${baseprefix}/clusters` + return ( - + {crdName && apiGroup && apiVersion && apiExtensionVersion && (