diff --git a/internal/controller/dashboard/factory.go b/internal/controller/dashboard/factory.go index add6940b..f5da1d6b 100644 --- a/internal/controller/dashboard/factory.go +++ b/internal/controller/dashboard/factory.go @@ -324,6 +324,7 @@ func yamlTab(plural string) map[string]any { "type": "builtin", "typeName": plural, "prefillValuesRequestIndex": float64(0), + "readOnly": true, "substractHeight": float64(400), }, }, diff --git a/internal/controller/dashboard/static_refactored.go b/internal/controller/dashboard/static_refactored.go index 3caf8edb..af9c5449 100644 --- a/internal/controller/dashboard/static_refactored.go +++ b/internal/controller/dashboard/static_refactored.go @@ -796,6 +796,7 @@ func CreateAllFactories() []*dashboardv1alpha1.Factory { "substractHeight": float64(400), "type": "builtin", "typeName": "secrets", + "readOnly": true, }, }, }, diff --git a/packages/system/dashboard/images/openapi-ui/Dockerfile b/packages/system/dashboard/images/openapi-ui/Dockerfile index d25920e1..af41cb65 100644 --- a/packages/system/dashboard/images/openapi-ui/Dockerfile +++ b/packages/system/dashboard/images/openapi-ui/Dockerfile @@ -3,9 +3,14 @@ ARG NODE_VERSION=20.18.1 # openapi-k8s-toolkit # imported from https://github.com/cozystack/openapi-k8s-toolkit FROM node:${NODE_VERSION}-alpine AS openapi-k8s-toolkit-builder +RUN apk add git WORKDIR /src -ARG COMMIT=61ebefdb878f41a76b77d53ae149eb25ca474805 +ARG COMMIT=e5f16b45de19f892de269cc4ef27e74aa62f4c92 RUN wget -O- https://github.com/cozystack/openapi-k8s-toolkit/archive/${COMMIT}.tar.gz | tar -xzvf- --strip-components=1 + +COPY openapi-k8s-toolkit/patches /patches +RUN git apply /patches/*.diff + RUN npm install RUN npm install --build-from-source @swc/core RUN npm run build @@ -20,7 +25,7 @@ WORKDIR /src ARG COMMIT_REF=9ce4367657f49c0032d8016b1d9491f8abbd2b15 RUN wget -O- https://github.com/PRO-Robotech/openapi-ui/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1 -COPY patches /patches +COPY openapi-ui/patches /patches RUN git apply /patches/*.diff ENV PATH=/src/node_modules/.bin:$PATH diff --git a/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/tenantmodules.diff b/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/tenantmodules.diff new file mode 100644 index 00000000..2817a8e0 --- /dev/null +++ b/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/tenantmodules.diff @@ -0,0 +1,50 @@ +diff --git a/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx b/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx +index 8bcef4d..2551e92 100644 +--- a/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx ++++ b/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx +@@ -22,6 +22,15 @@ import { TableFactory } from '../../molecules' + import { ShortenedTextWithTooltip, FilterDropdown, TrimmedTags, TextAlignContainer, TinyButton } from './atoms' + import { TInternalDataForControls } from './types' + ++const getPluralForm = (singular: string): string => { ++ // If already ends with 's', add 'es' ++ if (singular.endsWith('s')) { ++ return `${singular}es` ++ } ++ // Otherwise just add 's' ++ return `${singular}s` ++} ++ + export const getCellRender = ({ + value, + record, +@@ -255,7 +264,7 @@ export const getEnrichedColumnsWithControls = ({ + key: 'controls', + className: 'controls', + width: 60, +- render: (value: TInternalDataForControls) => { ++ render: (value: TInternalDataForControls, record: unknown) => { + return ( + // + +@@ -279,10 +288,19 @@ export const getEnrichedColumnsWithControls = ({ + domEvent.stopPropagation() + domEvent.preventDefault() + if (key === 'edit') { ++ // Special case: redirect tenantmodules from core.cozystack.io to apps.cozystack.io with plural form ++ let apiGroupAndVersion = value.apiGroupAndVersion ++ let typeName = value.typeName ++ if (apiGroupAndVersion?.startsWith('core.cozystack.io/') && typeName === 'tenantmodules') { ++ const appsApiVersion = apiGroupAndVersion.replace('core.cozystack.io/', 'apps.cozystack.io/') ++ const pluralTypeName = getPluralForm(value.entryName) ++ apiGroupAndVersion = appsApiVersion ++ typeName = pluralTypeName ++ } + navigate( + `${baseprefix}/${value.cluster}${value.namespace ? `/${value.namespace}` : ''}${ + value.syntheticProject ? `/${value.syntheticProject}` : '' +- }/${value.pathPrefix}/${value.apiGroupAndVersion}/${value.typeName}/${value.entryName}?backlink=${ ++ }/${value.pathPrefix}/${apiGroupAndVersion}/${typeName}/${value.entryName}?backlink=${ + value.backlink + }`, + ) diff --git a/packages/system/dashboard/images/openapi-ui/patches/namespaces.diff b/packages/system/dashboard/images/openapi-ui/openapi-ui/patches/namespaces.diff similarity index 100% rename from packages/system/dashboard/images/openapi-ui/patches/namespaces.diff rename to packages/system/dashboard/images/openapi-ui/openapi-ui/patches/namespaces.diff diff --git a/packages/system/dashboard/images/openapi-ui/openapi-ui/patches/remove-inside-link.diff b/packages/system/dashboard/images/openapi-ui/openapi-ui/patches/remove-inside-link.diff new file mode 100644 index 00000000..b131b53d --- /dev/null +++ b/packages/system/dashboard/images/openapi-ui/openapi-ui/patches/remove-inside-link.diff @@ -0,0 +1,15 @@ +diff --git a/src/components/organisms/Header/organisms/User/User.tsx b/src/components/organisms/Header/organisms/User/User.tsx +index efe7ac3..80b715c 100644 +--- a/src/components/organisms/Header/organisms/User/User.tsx ++++ b/src/components/organisms/Header/organisms/User/User.tsx +@@ -23,10 +23,6 @@ export const User: FC = () => { + // key: '1', + // label: , + // }, +- { +- key: '2', +- label:
navigate(`${baseprefix}/inside/clusters`)}>Inside
, +- }, + { + key: '3', + label: ( diff --git a/packages/system/dashboard/values.yaml b/packages/system/dashboard/values.yaml index f2aaba79..03e11b3d 100644 --- a/packages/system/dashboard/values.yaml +++ b/packages/system/dashboard/values.yaml @@ -1,5 +1,5 @@ openapiUI: - image: ghcr.io/cozystack/cozystack/openapi-ui:latest@sha256:890de65079967507c580aa89a27298c4b325edb748e9afe25d054c9cff20500c + image: ghcr.io/cozystack/cozystack/openapi-ui:latest@sha256:dfd3227aec5944e303a96f8e3197ac37a6b6bd7994ddbd681b7d5827bd621f4b openapiUIK8sBff: image: ghcr.io/cozystack/cozystack/openapi-ui-k8s-bff:latest@sha256:d2200791865a84640722079f2a3194af0c67d83c27c1bd303215183450265485 tokenProxy: