From b6ec438d4fa8b1dcf0de6a4da693b930422cfea4 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Fri, 29 Jul 2022 23:13:07 +0530 Subject: [PATCH] fix(frontend): fixed incorrect loading of labels --- .../src/components/Modal/network/form-utils.ts | 10 ++++++---- .../src/components/Modal/service/form-utils.ts | 10 ++++++---- .../frontend/src/components/Modal/volume/form-utils.ts | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/services/frontend/src/components/Modal/network/form-utils.ts b/services/frontend/src/components/Modal/network/form-utils.ts index e73e58b..184056c 100644 --- a/services/frontend/src/components/Modal/network/form-utils.ts +++ b/services/frontend/src/components/Modal/network/form-utils.ts @@ -113,10 +113,12 @@ export const getInitialValues = (node?: INetworkNodeItem): IEditNetworkForm => { value: ipam?.options?.[key].toString() ?? "" }; }), - labels: Object.entries(labels as any).map(([key, value]: any) => ({ - key, - value - })) + labels: labels + ? Object.entries(labels as any).map(([key, value]: any) => ({ + key, + value + })) + : [] }; }; diff --git a/services/frontend/src/components/Modal/service/form-utils.ts b/services/frontend/src/components/Modal/service/form-utils.ts index 84921a7..1b4010e 100644 --- a/services/frontend/src/components/Modal/service/form-utils.ts +++ b/services/frontend/src/components/Modal/service/form-utils.ts @@ -135,10 +135,12 @@ export const getInitialValues = (node?: IServiceNodeItem): IEditServiceForm => { return { hostPort, containerPort, protocol } as any; }), - labels: Object.entries(labels as any).map(([key, value]: any) => ({ - key, - value - })) + labels: labels + ? Object.entries(labels as any).map(([key, value]: any) => ({ + key, + value + })) + : [] }; }; diff --git a/services/frontend/src/components/Modal/volume/form-utils.ts b/services/frontend/src/components/Modal/volume/form-utils.ts index c19c797..200e677 100644 --- a/services/frontend/src/components/Modal/volume/form-utils.ts +++ b/services/frontend/src/components/Modal/volume/form-utils.ts @@ -39,10 +39,12 @@ export const getInitialValues = (node?: IVolumeNodeItem): IEditVolumeForm => { ...initialValues, entryName: node_name, volumeName: name, - labels: Object.entries(labels as any).map(([key, value]: any) => ({ - key, - value - })) + labels: labels + ? Object.entries(labels as any).map(([key, value]: any) => ({ + key, + value + })) + : [] }; };