Skip to content

Commit bd9dcb5

Browse files
committed
[dashboard] Add new patches
Signed-off-by: Andrei Kvapil <[email protected]>
1 parent be473a1 commit bd9dcb5

7 files changed

Lines changed: 75 additions & 3 deletions

File tree

‎internal/controller/dashboard/factory.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ func yamlTab(plural string) map[string]any {
324324
"type": "builtin",
325325
"typeName": plural,
326326
"prefillValuesRequestIndex": float64(0),
327+
"readOnly": true,
327328
"substractHeight": float64(400),
328329
},
329330
},

‎internal/controller/dashboard/static_refactored.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ func CreateAllFactories() []*dashboardv1alpha1.Factory {
796796
"substractHeight": float64(400),
797797
"type": "builtin",
798798
"typeName": "secrets",
799+
"readOnly": true,
799800
},
800801
},
801802
},

‎packages/system/dashboard/images/openapi-ui/Dockerfile‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ ARG NODE_VERSION=20.18.1
33
# openapi-k8s-toolkit
44
# imported from https://github.com/cozystack/openapi-k8s-toolkit
55
FROM node:${NODE_VERSION}-alpine AS openapi-k8s-toolkit-builder
6+
RUN apk add git
67
WORKDIR /src
7-
ARG COMMIT=61ebefdb878f41a76b77d53ae149eb25ca474805
8+
ARG COMMIT=e5f16b45de19f892de269cc4ef27e74aa62f4c92
89
RUN wget -O- https://github.com/cozystack/openapi-k8s-toolkit/archive/${COMMIT}.tar.gz | tar -xzvf- --strip-components=1
10+
11+
COPY openapi-k8s-toolkit/patches /patches
12+
RUN git apply /patches/*.diff
13+
914
RUN npm install
1015
RUN npm install --build-from-source @swc/core
1116
RUN npm run build
@@ -20,7 +25,7 @@ WORKDIR /src
2025
ARG COMMIT_REF=9ce4367657f49c0032d8016b1d9491f8abbd2b15
2126
RUN wget -O- https://github.com/PRO-Robotech/openapi-ui/archive/${COMMIT_REF}.tar.gz | tar xzf - --strip-components=1
2227

23-
COPY patches /patches
28+
COPY openapi-ui/patches /patches
2429
RUN git apply /patches/*.diff
2530

2631
ENV PATH=/src/node_modules/.bin:$PATH
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
diff --git a/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx b/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx
2+
index 8bcef4d..2551e92 100644
3+
--- a/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx
4+
+++ b/src/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.tsx
5+
@@ -22,6 +22,15 @@ import { TableFactory } from '../../molecules'
6+
import { ShortenedTextWithTooltip, FilterDropdown, TrimmedTags, TextAlignContainer, TinyButton } from './atoms'
7+
import { TInternalDataForControls } from './types'
8+
9+
+const getPluralForm = (singular: string): string => {
10+
+ // If already ends with 's', add 'es'
11+
+ if (singular.endsWith('s')) {
12+
+ return `${singular}es`
13+
+ }
14+
+ // Otherwise just add 's'
15+
+ return `${singular}s`
16+
+}
17+
+
18+
export const getCellRender = ({
19+
value,
20+
record,
21+
@@ -255,7 +264,7 @@ export const getEnrichedColumnsWithControls = ({
22+
key: 'controls',
23+
className: 'controls',
24+
width: 60,
25+
- render: (value: TInternalDataForControls) => {
26+
+ render: (value: TInternalDataForControls, record: unknown) => {
27+
return (
28+
// <TextAlignContainer $align="right" className="hideable">
29+
<TextAlignContainer $align="center">
30+
@@ -279,10 +288,19 @@ export const getEnrichedColumnsWithControls = ({
31+
domEvent.stopPropagation()
32+
domEvent.preventDefault()
33+
if (key === 'edit') {
34+
+ // Special case: redirect tenantmodules from core.cozystack.io to apps.cozystack.io with plural form
35+
+ let apiGroupAndVersion = value.apiGroupAndVersion
36+
+ let typeName = value.typeName
37+
+ if (apiGroupAndVersion?.startsWith('core.cozystack.io/') && typeName === 'tenantmodules') {
38+
+ const appsApiVersion = apiGroupAndVersion.replace('core.cozystack.io/', 'apps.cozystack.io/')
39+
+ const pluralTypeName = getPluralForm(value.entryName)
40+
+ apiGroupAndVersion = appsApiVersion
41+
+ typeName = pluralTypeName
42+
+ }
43+
navigate(
44+
`${baseprefix}/${value.cluster}${value.namespace ? `/${value.namespace}` : ''}${
45+
value.syntheticProject ? `/${value.syntheticProject}` : ''
46+
- }/${value.pathPrefix}/${value.apiGroupAndVersion}/${value.typeName}/${value.entryName}?backlink=${
47+
+ }/${value.pathPrefix}/${apiGroupAndVersion}/${typeName}/${value.entryName}?backlink=${
48+
value.backlink
49+
}`,
50+
)

packages/system/dashboard/images/openapi-ui/patches/namespaces.diff renamed to packages/system/dashboard/images/openapi-ui/openapi-ui/patches/namespaces.diff

File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/components/organisms/Header/organisms/User/User.tsx b/src/components/organisms/Header/organisms/User/User.tsx
2+
index efe7ac3..80b715c 100644
3+
--- a/src/components/organisms/Header/organisms/User/User.tsx
4+
+++ b/src/components/organisms/Header/organisms/User/User.tsx
5+
@@ -23,10 +23,6 @@ export const User: FC = () => {
6+
// key: '1',
7+
// label: <ThemeSelector />,
8+
// },
9+
- {
10+
- key: '2',
11+
- label: <div onClick={() => navigate(`${baseprefix}/inside/clusters`)}>Inside</div>,
12+
- },
13+
{
14+
key: '3',
15+
label: (

‎packages/system/dashboard/values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
openapiUI:
2-
image: ghcr.io/cozystack/cozystack/openapi-ui:latest@sha256:890de65079967507c580aa89a27298c4b325edb748e9afe25d054c9cff20500c
2+
image: ghcr.io/cozystack/cozystack/openapi-ui:latest@sha256:dfd3227aec5944e303a96f8e3197ac37a6b6bd7994ddbd681b7d5827bd621f4b
33
openapiUIK8sBff:
44
image: ghcr.io/cozystack/cozystack/openapi-ui-k8s-bff:latest@sha256:d2200791865a84640722079f2a3194af0c67d83c27c1bd303215183450265485
55
tokenProxy:

0 commit comments

Comments
 (0)