From 666dce3ea0c497bd648599eb0bf4a50e49026485 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Fri, 29 Jul 2022 20:36:30 +0530 Subject: [PATCH] fix(frontend): fixed incorrect encoding of labels in service forms --- .../src/components/Modal/service/form-utils.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/services/frontend/src/components/Modal/service/form-utils.ts b/services/frontend/src/components/Modal/service/form-utils.ts index 190cb14..67b717f 100644 --- a/services/frontend/src/components/Modal/service/form-utils.ts +++ b/services/frontend/src/components/Modal/service/form-utils.ts @@ -136,13 +136,10 @@ export const getInitialValues = (node?: IServiceNodeItem): IEditServiceForm => { return { hostPort, containerPort, protocol } as any; }), - labels: labels0.map((label) => { - const [key, value] = label.split("="); - return { - key, - value - }; - }) + labels: Object.entries(labels as any).map(([key, value]: any) => ({ + key, + value + })) }; }; @@ -184,8 +181,8 @@ export const getFinalValues = ( (port.containerPort ? `:${port.containerPort}` : "") + (port.protocol ? `/${port.protocol}` : "") ), - labels: labels.map( - (label) => `${label.key}${label.value ? `=${label.value}` : ""}` + labels: Object.fromEntries( + labels.map((label) => [label.key, label.value]) ) } } as any;