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,
labels: Object.fromEntries(
labels.map((label) => [label.key, label.value])
)
labels: pruneObject(
Object.fromEntries(labels.map((label) => [label.key, label.value]))
) as Record<string, string>
}
};
};

@ -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;

@ -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<string, string>
}
};
};

@ -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;
}

Loading…
Cancel
Save