|
|
|
@ -1,5 +1,6 @@
|
|
|
|
import * as yup from "yup";
|
|
|
|
import * as yup from "yup";
|
|
|
|
import { IEditNetworkForm, INetworkNodeItem } from "../../../types";
|
|
|
|
import { IEditNetworkForm, INetworkNodeItem, IPAMConfig } from "../../../types";
|
|
|
|
|
|
|
|
import { pruneArray, pruneObject } from "../../../utils/forms";
|
|
|
|
|
|
|
|
|
|
|
|
export const validationSchema = yup.object({
|
|
|
|
export const validationSchema = yup.object({
|
|
|
|
entryName: yup
|
|
|
|
entryName: yup
|
|
|
|
@ -139,10 +140,16 @@ export const getFinalValues = (
|
|
|
|
name: values.networkName,
|
|
|
|
name: values.networkName,
|
|
|
|
ipam: {
|
|
|
|
ipam: {
|
|
|
|
driver: driver ? driver : undefined,
|
|
|
|
driver: driver ? driver : undefined,
|
|
|
|
config: configurations.map((configuration) => ({
|
|
|
|
config: pruneArray(
|
|
|
|
|
|
|
|
configurations.map((configuration) =>
|
|
|
|
|
|
|
|
pruneObject({
|
|
|
|
subnet: configuration.subnet ? configuration.subnet : undefined,
|
|
|
|
subnet: configuration.subnet ? configuration.subnet : undefined,
|
|
|
|
ip_range: configuration.ipRange ? configuration.ipRange : undefined,
|
|
|
|
ip_range: configuration.ipRange
|
|
|
|
gateway: configuration.gateway ? configuration.gateway : undefined,
|
|
|
|
? configuration.ipRange
|
|
|
|
|
|
|
|
: undefined,
|
|
|
|
|
|
|
|
gateway: configuration.gateway
|
|
|
|
|
|
|
|
? configuration.gateway
|
|
|
|
|
|
|
|
: undefined,
|
|
|
|
aux_addresses: (() => {
|
|
|
|
aux_addresses: (() => {
|
|
|
|
if (configuration.auxAddresses.length === 0) {
|
|
|
|
if (configuration.auxAddresses.length === 0) {
|
|
|
|
return undefined;
|
|
|
|
return undefined;
|
|
|
|
@ -158,7 +165,9 @@ export const getFinalValues = (
|
|
|
|
])
|
|
|
|
])
|
|
|
|
);
|
|
|
|
);
|
|
|
|
})()
|
|
|
|
})()
|
|
|
|
})),
|
|
|
|
})
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
) as IPAMConfig[],
|
|
|
|
options: (() => {
|
|
|
|
options: (() => {
|
|
|
|
if (options.length === 0) {
|
|
|
|
if (options.length === 0) {
|
|
|
|
return undefined;
|
|
|
|
return undefined;
|
|
|
|
|