From 76d4773ff4be7332a9cff94d20fb8a6755d90694 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Sun, 31 Jul 2022 20:23:41 +0530 Subject: [PATCH] feat(frontend): updated to environment in both short and long form for top-level service objects --- .../src/components/Modal/service/form-utils.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/services/frontend/src/components/Modal/service/form-utils.ts b/services/frontend/src/components/Modal/service/form-utils.ts index 3438b44..bdde525 100644 --- a/services/frontend/src/components/Modal/service/form-utils.ts +++ b/services/frontend/src/components/Modal/service/form-utils.ts @@ -259,7 +259,6 @@ export const getInitialValues = (node?: IServiceNodeItem): IEditServiceForm => { labels } = serviceConfig; - const environment0: string[] = checkArray(environment || [], "environment"); const volumes0: string[] = checkArray(volumes, "volumes"); const ports0: string[] = checkArray(ports, "ports"); const [imageName, imageTag] = (image ?? ":").split(":"); @@ -366,13 +365,9 @@ export const getInitialValues = (node?: IServiceNodeItem): IEditServiceForm => { imageTag, serviceName: node_name, containerName: container_name, - environmentVariables: environment0.map((variable) => { - const [key, value] = variable.split("="); - return { - key, - value: value ? value : "" - }; - }), + environmentVariables: + extractObjectOrArray("=", "key", "value", environment) ?? + initialValues.environmentVariables, volumes: volumes0.map((volume) => { const [name, containerPath, accessMode] = volume.split(":"); return {