feat(frontend): pruned `labels` attribute in all the modals

pull/81/head
Samuel Rowe 3 years ago
parent 49af8559bd
commit 0b17569f22

@ -183,9 +183,9 @@ export const getFinalValues = (
); );
})() })()
}) as IIPAM, }) as IIPAM,
labels: Object.fromEntries( labels: pruneObject(
labels.map((label) => [label.key, label.value]) Object.fromEntries(labels.map((label) => [label.key, label.value]))
) ) as Record<string, string>
} }
}; };
}; };

@ -1,6 +1,6 @@
import type { IEditServiceForm, IServiceNodeItem } from "../../../types"; import type { IEditServiceForm, IServiceNodeItem } from "../../../types";
import * as yup from "yup"; import * as yup from "yup";
import { checkArray } from "../../../utils/forms"; import { checkArray, pruneObject } from "../../../utils/forms";
const initialValues: IEditServiceForm = { const initialValues: IEditServiceForm = {
imageName: "", imageName: "",
@ -180,8 +180,8 @@ export const getFinalValues = (
(port.containerPort ? `:${port.containerPort}` : "") + (port.containerPort ? `:${port.containerPort}` : "") +
(port.protocol ? `/${port.protocol}` : "") (port.protocol ? `/${port.protocol}` : "")
), ),
labels: Object.fromEntries( labels: pruneObject(
labels.map((label) => [label.key, label.value]) Object.fromEntries(labels.map((label) => [label.key, label.value]))
) )
} }
} as any; } as any;

@ -1,5 +1,6 @@
import * as yup from "yup"; import * as yup from "yup";
import { IEditVolumeForm, IVolumeNodeItem } from "../../../types"; import { IEditVolumeForm, IVolumeNodeItem } from "../../../types";
import { pruneObject } from "../../../utils/forms";
export const validationSchema = yup.object({ export const validationSchema = yup.object({
entryName: yup entryName: yup
@ -65,9 +66,9 @@ export const getFinalValues = (
}, },
volumeConfig: { volumeConfig: {
name: values.volumeName, name: values.volumeName,
labels: Object.fromEntries( labels: pruneObject(
labels.map((label) => [label.key, label.value]) Object.fromEntries(labels.map((label) => [label.key, label.value]))
) ) as Record<string, string>
} }
}; };
}; };

@ -78,7 +78,7 @@ export interface IVolumeTopLevel {
device: string; device: string;
}; };
external: boolean; external: boolean;
labels: string[] | KeyValuePair; labels?: string[] | KeyValuePair;
name: string; name: string;
} }
@ -102,7 +102,7 @@ export interface INetworkTopLevel {
enable_ipv6: boolean; enable_ipv6: boolean;
ipam?: IIPAM; ipam?: IIPAM;
internal: boolean; internal: boolean;
labels: string[] | KeyValPair; labels?: string[] | KeyValPair;
external: boolean; external: boolean;
name: string; name: string;
} }

Loading…
Cancel
Save