diff --git a/services/frontend/src/components/Modal/network/form-utils.ts b/services/frontend/src/components/Modal/network/form-utils.ts index 478c45c..e73e58b 100644 --- a/services/frontend/src/components/Modal/network/form-utils.ts +++ b/services/frontend/src/components/Modal/network/form-utils.ts @@ -183,9 +183,9 @@ export const getFinalValues = ( ); })() }) as IIPAM, - labels: Object.fromEntries( - labels.map((label) => [label.key, label.value]) - ) + labels: pruneObject( + Object.fromEntries(labels.map((label) => [label.key, label.value])) + ) as Record } }; }; diff --git a/services/frontend/src/components/Modal/service/form-utils.ts b/services/frontend/src/components/Modal/service/form-utils.ts index 4ef6f36..cae855d 100644 --- a/services/frontend/src/components/Modal/service/form-utils.ts +++ b/services/frontend/src/components/Modal/service/form-utils.ts @@ -1,6 +1,6 @@ import type { IEditServiceForm, IServiceNodeItem } from "../../../types"; import * as yup from "yup"; -import { checkArray } from "../../../utils/forms"; +import { checkArray, pruneObject } from "../../../utils/forms"; const initialValues: IEditServiceForm = { imageName: "", @@ -180,8 +180,8 @@ export const getFinalValues = ( (port.containerPort ? `:${port.containerPort}` : "") + (port.protocol ? `/${port.protocol}` : "") ), - labels: Object.fromEntries( - labels.map((label) => [label.key, label.value]) + labels: pruneObject( + Object.fromEntries(labels.map((label) => [label.key, label.value])) ) } } as any; diff --git a/services/frontend/src/components/Modal/volume/form-utils.ts b/services/frontend/src/components/Modal/volume/form-utils.ts index a3cf2f6..c19c797 100644 --- a/services/frontend/src/components/Modal/volume/form-utils.ts +++ b/services/frontend/src/components/Modal/volume/form-utils.ts @@ -1,5 +1,6 @@ import * as yup from "yup"; import { IEditVolumeForm, IVolumeNodeItem } from "../../../types"; +import { pruneObject } from "../../../utils/forms"; export const validationSchema = yup.object({ entryName: yup @@ -65,9 +66,9 @@ export const getFinalValues = ( }, volumeConfig: { name: values.volumeName, - labels: Object.fromEntries( - labels.map((label) => [label.key, label.value]) - ) + labels: pruneObject( + Object.fromEntries(labels.map((label) => [label.key, label.value])) + ) as Record } }; }; diff --git a/services/frontend/src/types/index.ts b/services/frontend/src/types/index.ts index 322d68d..e62eaae 100644 --- a/services/frontend/src/types/index.ts +++ b/services/frontend/src/types/index.ts @@ -78,7 +78,7 @@ export interface IVolumeTopLevel { device: string; }; external: boolean; - labels: string[] | KeyValuePair; + labels?: string[] | KeyValuePair; name: string; } @@ -102,7 +102,7 @@ export interface INetworkTopLevel { enable_ipv6: boolean; ipam?: IIPAM; internal: boolean; - labels: string[] | KeyValPair; + labels?: string[] | KeyValPair; external: boolean; name: string; }