diff --git a/packages/system/dashboard/Makefile b/packages/system/dashboard/Makefile index b136c864..b46252a3 100644 --- a/packages/system/dashboard/Makefile +++ b/packages/system/dashboard/Makefile @@ -4,19 +4,7 @@ export NAMESPACE=cozy-$(NAME) include ../../../hack/common-envs.mk include ../../../hack/package.mk -update: update-crd update-dockerfiles -image: image-token-proxy update-tenant-text - - -update-dockerfiles: - @echo Update dockerfiles manually - -update-crd: - rm -rf crds - mkdir -p crds - wget -O- https://github.com/PRO-Robotech/helmfile-manifests/archive/refs/heads/main.tar.gz | tar -C crds -xzvf- helmfile-manifests-main/charts/incloud-main/incloud-web-1.0.0/incloud-web/templates --strip-components=6 - rm -f crds/_helpers.tpl - sed -i '/{{/d' crds/*.yml crds/*.yaml +image: image-token-proxy image-token-proxy: docker buildx build images/token-proxy \ @@ -33,6 +21,3 @@ image-token-proxy: IMAGE="$(REGISTRY)/token-proxy:$(call settag,$(TAG))@$$(yq e '."containerimage.digest"' images/token-proxy.json -r)" \ yq -i '.tokenProxy.image = strenv(IMAGE)' values.yaml rm -f images/token-proxy.json - -update-tenant-text: - sed -i 's|\($$tenantText := "\)[^"]\+|\1$(TAG)|' templates/configmap.yaml diff --git a/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile b/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile deleted file mode 100644 index ea0c900d..00000000 --- a/packages/system/dashboard/images/openapi-ui-k8s-bff/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# imported from https://github.com/PRO-Robotech/openapi-ui-k8s-bff -ARG NODE_VERSION=20.18.1 -FROM node:${NODE_VERSION}-alpine AS builder -WORKDIR /src - -# release/1.4.0 -ARG COMMIT_REF=92e4b618eb9ad17b19827b5a2b7ceab33e8cf534 -RUN wget -O- https://github.com/PRO-Robotech/openapi-ui-k8s-bff/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1 - -ENV PATH=/src/node_modules/.bin:$PATH -RUN npm install -RUN npm run build - -FROM node:${NODE_VERSION}-alpine -WORKDIR /app -COPY --from=builder /src/package*.json /app/ -COPY --from=builder /src/node_modules /app/node_modules -COPY --from=builder /src/src/swagger/swagger-output.json /app/dist/swagger/swagger-output.json -COPY --from=builder /src/dist /app/dist -EXPOSE 8080 -USER 1001 -CMD [ "node", "/app/dist/index.js"] diff --git a/packages/system/dashboard/images/openapi-ui/Dockerfile b/packages/system/dashboard/images/openapi-ui/Dockerfile deleted file mode 100644 index 82cc6db0..00000000 --- a/packages/system/dashboard/images/openapi-ui/Dockerfile +++ /dev/null @@ -1,69 +0,0 @@ -ARG NODE_VERSION=20.18.1 - -# openapi-k8s-toolkit -# imported from https://github.com/PRO-Robotech/openapi-k8s-toolkit -FROM node:${NODE_VERSION}-alpine AS openapi-k8s-toolkit-builder -RUN apk add git -WORKDIR /src -# release/1.4.0 -ARG COMMIT=d6b9e4ad0d1eb9d3730f7f0c664792c8dda3214d -RUN wget -O- https://github.com/PRO-Robotech/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 - - -# openapi-ui -# imported from https://github.com/PRO-Robotech/openapi-ui -FROM node:${NODE_VERSION}-alpine AS builder -#RUN apk add git -WORKDIR /src - -# release/1.4.0 -ARG COMMIT_REF=6addca6939264ef2e39801baa88c1460cc1aa53e -RUN wget -O- https://github.com/PRO-Robotech/openapi-ui/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1 - -#COPY openapi-ui/patches /patches -#RUN git apply /patches/*.diff - -ENV PATH=/src/node_modules/.bin:$PATH - -RUN npm install - -# add patched openapi-k8s-toolkit -RUN rm -rf node_modules/@prorobotech/openapi-k8s-toolkit/dist -COPY --from=openapi-k8s-toolkit-builder /src/dist node_modules/@prorobotech/openapi-k8s-toolkit/dist - -RUN npm run build - -FROM node:${NODE_VERSION}-alpine AS builder2 -WORKDIR /src -ENV PATH=/src/node_modules/.bin:$PATH - -COPY --from=builder /src/server/package.json ./ -COPY --from=builder /src/server/package-lock.json ./ -RUN npm install -COPY --from=builder /src/server server -COPY --from=builder /src/tsconfig.server.json ./ -COPY --from=builder /src/build /src/build -RUN npm run server:build - -FROM node:${NODE_VERSION}-alpine -WORKDIR /app -COPY --from=builder2 /src/node_modules /app/node_modules -COPY --from=builder2 /src/build /app/build -EXPOSE 8080 -RUN sed -i -e 's|OpenAPI UI|Cozystack|g' build/index.html -# Fix Factory component: return null while loading instead of showing "Factory Not Found" 404 -RUN APP_JS=$(find build -name "App-react.js" -type f | head -1) && \ - if [ -n "$APP_JS" ]; then \ - sed -i 's|const { data: factoryData } = useK8sSmartResource({|const { data: factoryData, isLoading: factoryIsLoading } = useK8sSmartResource({|' "$APP_JS" && \ - sed -i '/Factory Not Found/s/return /return factoryIsLoading ? null : /' "$APP_JS" && \ - echo "Factory loading patch applied to $APP_JS"; \ - fi -USER 1001 -CMD ["node", "/app/build/index.js"] diff --git a/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/flatmap-unresolved-placeholder.diff b/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/flatmap-unresolved-placeholder.diff deleted file mode 100644 index e98861a3..00000000 --- a/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/flatmap-unresolved-placeholder.diff +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.ts b/src/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.ts ---- a/src/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.ts -+++ b/src/components/molecules/EnrichedTable/organisms/EnrichedTableProvider/utils.ts -@@ -185,6 +185,11 @@ - return `['${escaped}']` - }) - } -- const jpQueryResult = jp.query(el, `$${resolvedJsonPath}`) -- fieldValue = Array.isArray(jpQueryResult) && jpQueryResult.length === 1 ? jpQueryResult[0] : jpQueryResult -+ if (/_flatMap[^\]]+_Key/.test(resolvedJsonPath)) { -+ // Placeholder was not resolved (row not yet expanded or key missing) — skip query -+ fieldValue = null -+ } else { -+ const jpQueryResult = jp.query(el, `$${resolvedJsonPath}`) -+ fieldValue = Array.isArray(jpQueryResult) && jpQueryResult.length === 1 ? jpQueryResult[0] : jpQueryResult -+ } - } diff --git a/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/formlistinput-allow-empty.diff b/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/formlistinput-allow-empty.diff deleted file mode 100644 index 1c83df7c..00000000 --- a/packages/system/dashboard/images/openapi-ui/openapi-k8s-toolkit/patches/formlistinput-allow-empty.diff +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/src/localTypes/formExtensions.ts b/src/localTypes/formExtensions.ts ---- a/src/localTypes/formExtensions.ts -+++ b/src/localTypes/formExtensions.ts -@@ -59,2 +59,4 @@ - relatedValuePath?: string -+ allowEmpty?: boolean -+ persistType?: 'str' | 'number' | 'arr' | 'obj' - } -diff --git a/src/components/molecules/BlackholeForm/molecules/FormListInput/FormListInput.tsx b/src/components/molecules/BlackholeForm/molecules/FormListInput/FormListInput.tsx ---- a/src/components/molecules/BlackholeForm/molecules/FormListInput/FormListInput.tsx -+++ b/src/components/molecules/BlackholeForm/molecules/FormListInput/FormListInput.tsx -@@ -149,3 +149,10 @@ - }, [relatedPath, form, arrName, fixedName, relatedFieldValue, onValuesChangeCallBack, isTouchedPeristed]) - -+ // When allowEmpty is set, auto-persist the field so the BFF preserves empty values -+ useEffect(() => { -+ if (customProps.allowEmpty) { -+ persistedControls.onPersistMark(persistName || name, customProps.persistType ?? 'str') -+ } -+ }, [customProps.allowEmpty, customProps.persistType, persistedControls, persistName, name]) -+ - const uri = prepareTemplate({ -@@ -267,5 +274,14 @@ - validateTrigger="onBlur" - hasFeedback={designNewLayout ? { icons: feedbackIcons } : true} - style={{ flex: 1 }} -+ normalize={(value: unknown) => { -+ if (customProps.allowEmpty && (value === undefined || value === null)) { -+ if (customProps.persistType === 'number') return 0 -+ if (customProps.persistType === 'arr') return [] -+ if (customProps.persistType === 'obj') return {} -+ return '' -+ } -+ return value -+ }} - > -