From ecc396a9628b17589f470d3958a377db2624fbbf Mon Sep 17 00:00:00 2001 From: Montse Ortega Date: Mon, 4 Nov 2024 09:41:33 +0100 Subject: [PATCH] When 'Use bond' is check we shouldn't have the extra mac-address field --- .../FormViewHosts/FormViewHostsFields.tsx | 16 +++++++++------- .../formViewHostsValidationSchema.tsx | 11 ++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/libs/ui-lib/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.tsx b/libs/ui-lib/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.tsx index a839f81223..0ba7a3c2c7 100644 --- a/libs/ui-lib/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.tsx +++ b/libs/ui-lib/lib/ocm/components/clusterConfiguration/staticIp/components/FormViewHosts/FormViewHostsFields.tsx @@ -62,7 +62,7 @@ const getExpandedHostComponent = (protocolType: StaticProtocolType) => { name={`${fieldName}.useBond`} /> - {useBond && ( + {useBond.value && ( @@ -81,12 +81,14 @@ const getExpandedHostComponent = (protocolType: StaticProtocolType) => { /> )} - + {!useBond.value && ( + + )} {getShownProtocolVersions(protocolType).map((protocolVersion) => ( = ( const getHostValidationSchema = (networkWideValues: FormViewNetworkWideValues) => Yup.object({ - macAddress: macAddressValidationSchema - .required(requiredMsg) - .concat(getUniqueValidationSchema(getAllMacAddresses)), + macAddress: Yup.mixed().when('useBond', { + is: false, + then: () => + macAddressValidationSchema + .required(requiredMsg) + .concat(getUniqueValidationSchema(getAllMacAddresses)), + otherwise: () => Yup.mixed().notRequired(), + }), ips: Yup.object({ ipv4: showIpv4(networkWideValues.protocolType) ? getInMachineNetworkValidationSchema(