From 4bd9b0a02f947fa96d7b60e9913c6f5177459d5f Mon Sep 17 00:00:00 2001 From: Dylan Decrulle Date: Wed, 20 Nov 2024 15:08:40 +0100 Subject: [PATCH 1/3] fix #878 --- .../computeRootForm/computeRootFormFieldGroup.ts | 2 ++ web/src/core/usecases/launcher/decoupledLogic/formTypes.ts | 2 +- web/src/ui/pages/launcher/RootFormComponent/Accordion.tsx | 6 ++++++ .../RootFormComponent/ConfigurationTopLevelGroup.tsx | 7 ++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.ts b/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.ts index 6996034b1..cbc6fae58 100644 --- a/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.ts +++ b/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.ts @@ -358,6 +358,7 @@ function computeRootFormFieldGroup_rec(params: { type: "group", helmValuesPath, description: helmValuesSchema.description, + title: helmValuesSchema.title ?? undefined, nodes: Object.entries(helmValuesSchema.properties) .map(([segment, helmValuesSchema_child]) => computeRootFormFieldGroup_rec({ @@ -388,6 +389,7 @@ function computeRootFormFieldGroup_rec(params: { type: "group", helmValuesPath, description: helmValuesSchema.description, + title: undefined, nodes: values .map((...[, index]) => computeRootFormFieldGroup_rec({ diff --git a/web/src/core/usecases/launcher/decoupledLogic/formTypes.ts b/web/src/core/usecases/launcher/decoupledLogic/formTypes.ts index 77697cc49..72a7ea8e5 100644 --- a/web/src/core/usecases/launcher/decoupledLogic/formTypes.ts +++ b/web/src/core/usecases/launcher/decoupledLogic/formTypes.ts @@ -18,7 +18,7 @@ export type FormFieldGroup = { type: "group"; helmValuesPath: (string | number)[]; description: string | undefined; - + title: string | undefined; nodes: (FormField | FormFieldGroup)[]; canAdd: boolean; canRemove: boolean; diff --git a/web/src/ui/pages/launcher/RootFormComponent/Accordion.tsx b/web/src/ui/pages/launcher/RootFormComponent/Accordion.tsx index 3497136d5..9a7c3196d 100644 --- a/web/src/ui/pages/launcher/RootFormComponent/Accordion.tsx +++ b/web/src/ui/pages/launcher/RootFormComponent/Accordion.tsx @@ -22,6 +22,7 @@ type Props = { className?: string; helmValuesPath: (string | number)[]; description: string | undefined; + title: string | undefined; nodes: (FormFieldGroup | FormField)[]; canAdd: boolean; canRemove: boolean; @@ -33,6 +34,7 @@ export function Accordion(props: Props) { className, helmValuesPath, description, + title, nodes, canAdd, canRemove, @@ -134,6 +136,10 @@ export function Accordion(props: Props) { > {(() => { + if (title !== undefined) { + return title; + } + const lastSegment = helmValuesPath[helmValuesPath.length - 1]; assert(typeof lastSegment === "string"); diff --git a/web/src/ui/pages/launcher/RootFormComponent/ConfigurationTopLevelGroup.tsx b/web/src/ui/pages/launcher/RootFormComponent/ConfigurationTopLevelGroup.tsx index 6194e3295..ac15332b5 100644 --- a/web/src/ui/pages/launcher/RootFormComponent/ConfigurationTopLevelGroup.tsx +++ b/web/src/ui/pages/launcher/RootFormComponent/ConfigurationTopLevelGroup.tsx @@ -50,6 +50,7 @@ export function ConfigurationTopLevelGroup(props: Props) { { helmValuesPath: ["Global"], description: "configuration that applies to all charts", + title: undefined, canAdd: false, canRemove: false, nodes: global @@ -61,6 +62,7 @@ export function ConfigurationTopLevelGroup(props: Props) { { helmValuesPath: ["Miscellaneous"], // TODO: i18n + title: undefined, description: "Top level configuration values", canAdd: false, canRemove: false, @@ -72,6 +74,7 @@ export function ConfigurationTopLevelGroup(props: Props) { return { helmValuesPath: [node.title], description: node.description, + title: node.title, canAdd: false, canRemove: false, nodes: [ @@ -92,6 +95,7 @@ export function ConfigurationTopLevelGroup(props: Props) { return { helmValuesPath: node.helmValuesPath, description: node.description, + title: node.title, canAdd: node.canAdd, canRemove: node.canRemove, nodes: node.nodes @@ -105,11 +109,12 @@ export function ConfigurationTopLevelGroup(props: Props) { return (
{accordionEntries.map( - ({ helmValuesPath, description, canAdd, canRemove, nodes }) => ( + ({ helmValuesPath, description, title, canAdd, canRemove, nodes }) => ( Date: Wed, 20 Nov 2024 15:14:15 +0100 Subject: [PATCH 2/3] adapt test --- .../computeRootForm/computeRootForm.test.ts | 2 ++ .../computeRootForm/computeRootFormFieldGroup.test.ts | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootForm.test.ts b/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootForm.test.ts index 1427a8659..a2fcef3fb 100644 --- a/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootForm.test.ts +++ b/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootForm.test.ts @@ -67,6 +67,7 @@ describe(symToStr({ computeRootForm }), () => { type: "group", helmValuesPath: ["services"], description: undefined, + title: undefined, nodes: [ { type: "field", @@ -208,6 +209,7 @@ describe(symToStr({ computeRootForm }), () => { type: "group", helmValuesPath: ["services"], description: undefined, + title: undefined, nodes: [ { type: "field", diff --git a/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.test.ts b/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.test.ts index 3c1409ad3..611cdcbed 100644 --- a/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.test.ts +++ b/web/src/core/usecases/launcher/decoupledLogic/computeRootForm/computeRootFormFieldGroup.test.ts @@ -35,6 +35,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { type: "group", helmValuesPath: [], description: undefined, + title: undefined, nodes: [ { type: "field", @@ -87,6 +88,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { type: "group", helmValuesPath: [], description: undefined, + title: undefined, nodes: [ { type: "field", @@ -117,6 +119,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { properties: { persistence: { description: "Configuration for persistence", + title: "Persistence", type: "object", properties: { enabled: { @@ -155,11 +158,13 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { type: "group", helmValuesPath: [], description: undefined, + title: undefined, nodes: [ { type: "group", helmValuesPath: ["persistence"], description: "Configuration for persistence", + title: "Persistence", nodes: [ { type: "field", @@ -191,6 +196,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { properties: { persistence: { description: "Configuration for persistence", + title: "Persistence", type: "object", properties: { enabled: { @@ -228,11 +234,13 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { type: "group", helmValuesPath: [], description: undefined, + title: undefined, nodes: [ { type: "group", helmValuesPath: ["persistence"], description: "Configuration for persistence", + title: "Persistence", nodes: [ { type: "field", @@ -289,6 +297,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { type: "group", helmValuesPath: [], description: undefined, + title: undefined, nodes: [ { type: "field", @@ -306,11 +315,13 @@ describe(symToStr({ computeRootFormFieldGroup }), () => { type: "group", helmValuesPath: ["b"], description: undefined, + title: undefined, nodes: [ { type: "group", helmValuesPath: ["b", 0], description: undefined, + title: undefined, nodes: [ { type: "field", From 3de84f555754b50cc85873ad305a5da935524624 Mon Sep 17 00:00:00 2001 From: Dylan Decrulle Date: Wed, 20 Nov 2024 15:24:06 +0100 Subject: [PATCH 3/3] build fix --- .../mutateHelmValues_update/findInRootForm.test.ts | 2 ++ .../mutateHelmValues_update/mutateHelmValues_update.test.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/findInRootForm.test.ts b/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/findInRootForm.test.ts index dbc384eb0..ecaceae30 100644 --- a/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/findInRootForm.test.ts +++ b/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/findInRootForm.test.ts @@ -9,6 +9,7 @@ const rootForm: RootForm = { type: "group", helmValuesPath: ["services"], description: undefined, + title: undefined, nodes: [ { type: "field", @@ -30,6 +31,7 @@ const rootForm: RootForm = { type: "group", helmValuesPath: ["resources"], description: undefined, + title: undefined, nodes: [ { type: "field", diff --git a/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/mutateHelmValues_update.test.ts b/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/mutateHelmValues_update.test.ts index 4a2bac713..9da24b043 100644 --- a/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/mutateHelmValues_update.test.ts +++ b/web/src/core/usecases/launcher/decoupledLogic/mutateHelmValues/mutateHelmValues_update/mutateHelmValues_update.test.ts @@ -118,6 +118,7 @@ describe(symToStr({ mutateHelmValues_update }), () => { type: "group", helmValuesPath: ["resources"], description: THROW_IF_ACCESSED, + title: THROW_IF_ACCESSED, canAdd: THROW_IF_ACCESSED, canRemove: THROW_IF_ACCESSED, nodes: [