From 88d6fb1b81409d8b3b2f0ab77e5c5732ccdd6057 Mon Sep 17 00:00:00 2001 From: zhuyue Date: Tue, 31 Aug 2021 11:53:42 +0800 Subject: [PATCH] fix: Make port's fixed_ip not required make port's fixed_ip not required Change-Id: I80389983aa3d9b652f33e712ee5589d8975bec9d --- .../VirtualAdapter/actions/Create.jsx | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/pages/network/containers/VirtualAdapter/actions/Create.jsx b/src/pages/network/containers/VirtualAdapter/actions/Create.jsx index c8d70ab1..9c028f7f 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/Create.jsx +++ b/src/pages/network/containers/VirtualAdapter/actions/Create.jsx @@ -116,15 +116,19 @@ export default class CreateAction extends ModalAction { ...rest } = values; const data = { - fixed_ips: fixed_ips.map((i) => { - const ret = { - subnet_id: i.subnet, - }; - if (i.ip_address && i.ip_address.type === 'manual') { - ret.ip_address = i.ip_address.ip; - } - return ret; - }), + ...(fixed_ips && fixed_ips.length > 0 + ? { + fixed_ips: fixed_ips.map((i) => { + const ret = { + subnet_id: i.subnet, + }; + if (i.ip_address && i.ip_address.type === 'manual') { + ret.ip_address = i.ip_address.ip; + } + return ret; + }), + } + : {}), network_id: network_id.selectedRowKeys[0], ...rest, }; @@ -192,11 +196,10 @@ export default class CreateAction extends ModalAction { { name: 'fixed_ips', label: t('Owned Subnet'), - // component: , type: 'ip-distributer', subnets: subnetDetails, hidden: !network_id, - required: true, + // required: true, }, { name: 'ipv6',