From be473a12be74e2b3225fb65d2657cc8038204432 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Fri, 31 Oct 2025 17:07:51 +0100 Subject: [PATCH 1/2] [dashboard] Update openapi-ui v1.0.3 Signed-off-by: Andrei Kvapil --- .../dashboard/images/openapi-ui-k8s-bff/Dockerfile | 2 +- .../images/openapi-ui-k8s-bff/patches/namespaces.diff | 6 +++--- packages/system/dashboard/images/openapi-ui/Dockerfile | 4 ++-- .../images/openapi-ui/patches/namespaces.diff | 10 +++++----- packages/system/dashboard/values.yaml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile b/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile index e21829d2..d8447e7a 100644 --- a/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile +++ b/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile @@ -4,7 +4,7 @@ FROM node:${NODE_VERSION}-alpine AS builder RUN apk add git WORKDIR /src -ARG COMMIT_REF=22f9143f5109fb90332651c857d70b51bffccd9b +ARG COMMIT_REF=88531ed6881b4ce4808e56c00905951d7ba8031c RUN wget -O- https://github.com/PRO-Robotech/openapi-ui-k8s-bff/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1 COPY patches /patches diff --git a/packages/system/dashboard/images/openapi-ui-k8s-bff/patches/namespaces.diff b/packages/system/dashboard/images/openapi-ui-k8s-bff/patches/namespaces.diff index 6a8ecbbe..3ed11a7c 100644 --- a/packages/system/dashboard/images/openapi-ui-k8s-bff/patches/namespaces.diff +++ b/packages/system/dashboard/images/openapi-ui-k8s-bff/patches/namespaces.diff @@ -1,7 +1,7 @@ -diff --git a/src/endpoints/forms/formPrepare/formPrepare.ts b/src/endpoints/forms/formPrepare/formPrepare.ts +diff --git a/src/endpoints/forms/prepareFormProps/prepareFormProps.ts b/src/endpoints/forms/prepareFormProps/prepareFormProps.ts index 7e437db..90c40f6 100644 ---- a/src/endpoints/forms/formPrepare/formPrepare.ts -+++ b/src/endpoints/forms/formPrepare/formPrepare.ts +--- a/src/endpoints/forms/prepareFormProps/prepareFormProps.ts ++++ b/src/endpoints/forms/prepareFormProps/prepareFormProps.ts @@ -15,6 +15,7 @@ export const prepareFormProps: RequestHandler = async (req: TPrepareFormReq, res const filteredHeaders = { ...req.headers } diff --git a/packages/system/dashboard/images/openapi-ui/Dockerfile b/packages/system/dashboard/images/openapi-ui/Dockerfile index ea10ac8a..d25920e1 100644 --- a/packages/system/dashboard/images/openapi-ui/Dockerfile +++ b/packages/system/dashboard/images/openapi-ui/Dockerfile @@ -4,7 +4,7 @@ ARG NODE_VERSION=20.18.1 # imported from https://github.com/cozystack/openapi-k8s-toolkit FROM node:${NODE_VERSION}-alpine AS openapi-k8s-toolkit-builder WORKDIR /src -ARG COMMIT=4f57ab295b2a886eb294b0b987554194fbe67dcd +ARG COMMIT=61ebefdb878f41a76b77d53ae149eb25ca474805 RUN wget -O- https://github.com/cozystack/openapi-k8s-toolkit/archive/${COMMIT}.tar.gz | tar -xzvf- --strip-components=1 RUN npm install RUN npm install --build-from-source @swc/core @@ -17,7 +17,7 @@ FROM node:${NODE_VERSION}-alpine AS builder RUN apk add git WORKDIR /src -ARG COMMIT_REF=65e7fa8b3dc530a36e94c8435622bb09961aef97 +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 diff --git a/packages/system/dashboard/images/openapi-ui/patches/namespaces.diff b/packages/system/dashboard/images/openapi-ui/patches/namespaces.diff index 66bce93a..b76c86d3 100644 --- a/packages/system/dashboard/images/openapi-ui/patches/namespaces.diff +++ b/packages/system/dashboard/images/openapi-ui/patches/namespaces.diff @@ -1,5 +1,5 @@ diff --git a/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx b/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx -index 577ba0f..018df9c 100644 +index b6fb99f..965bac0 100644 --- a/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx +++ b/src/components/organisms/ListInsideClusterAndNs/ListInsideClusterAndNs.tsx @@ -1,11 +1,16 @@ @@ -26,16 +26,16 @@ index 577ba0f..018df9c 100644 - const namespacesData = useBuiltinResources({ + const namespacesData = useApiResources({ - clusterName: cluster, + clusterName: selectedCluster || '', - typeName: 'namespaces', + apiGroup: BASE_PROJECTS_API_GROUP, + apiVersion: BASE_PROJECTS_VERSION, + typeName: BASE_PROJECTS_RESOURCE_NAME, limit: null, + isEnabled: selectedCluster !== undefined, }) - diff --git a/src/hooks/useNavSelectorInside.ts b/src/hooks/useNavSelectorInside.ts -index d69405e..5adbd5d 100644 +index 5736e2b..1ec0f71 100644 --- a/src/hooks/useNavSelectorInside.ts +++ b/src/hooks/useNavSelectorInside.ts @@ -1,6 +1,11 @@ @@ -63,8 +63,8 @@ index d69405e..5adbd5d 100644 + apiVersion: BASE_PROJECTS_VERSION, + typeName: BASE_PROJECTS_RESOURCE_NAME, limit: null, + isEnabled: Boolean(clusterName), }) - diff --git a/src/utils/getBacklink.ts b/src/utils/getBacklink.ts index a862354..f24e2bc 100644 --- a/src/utils/getBacklink.ts diff --git a/packages/system/dashboard/values.yaml b/packages/system/dashboard/values.yaml index 4cb8571b..f2aaba79 100644 --- a/packages/system/dashboard/values.yaml +++ b/packages/system/dashboard/values.yaml @@ -1,6 +1,6 @@ openapiUI: - image: ghcr.io/cozystack/cozystack/openapi-ui:v0.37.0@sha256:13f38cf56830e899eb5e3d9dc8184965dd8dba9f8cd3c5ca10df0970355842d6 + image: ghcr.io/cozystack/cozystack/openapi-ui:latest@sha256:890de65079967507c580aa89a27298c4b325edb748e9afe25d054c9cff20500c openapiUIK8sBff: - image: ghcr.io/cozystack/cozystack/openapi-ui-k8s-bff:v0.37.0@sha256:2b626dbbf87241e8621ac5b0285f402edbc2c2069ba254ca2ace2dd5c9248ac8 + image: ghcr.io/cozystack/cozystack/openapi-ui-k8s-bff:latest@sha256:d2200791865a84640722079f2a3194af0c67d83c27c1bd303215183450265485 tokenProxy: image: ghcr.io/cozystack/cozystack/token-proxy:v0.37.0@sha256:fad27112617bb17816702571e1f39d0ac3fe5283468d25eb12f79906cdab566b From bd9dcb52a33c6d8a5d69b9cad77adfef9334eaac Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Fri, 31 Oct 2025 18:01:15 +0100 Subject: [PATCH 2/2] [dashboard] Add new patches Signed-off-by: Andrei Kvapil --- internal/controller/dashboard/factory.go | 1 + .../controller/dashboard/static_refactored.go | 1 + .../dashboard/images/openapi-ui/Dockerfile | 9 +++- .../patches/tenantmodules.diff | 50 +++++++++++++++++++ .../{ => openapi-ui}/patches/namespaces.diff | 0 .../patches/remove-inside-link.diff | 15 ++++++ packages/system/dashboard/values.yaml | 2 +- 7 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/tenantmodules.diff rename packages/system/dashboard/images/openapi-ui/{ => openapi-ui}/patches/namespaces.diff (100%) create mode 100644 packages/system/dashboard/images/openapi-ui/openapi-ui/patches/remove-inside-link.diff 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: