fix: fix for lb members subnet id params

fix for lb members subnet id params

Change-Id: I875557396867938119ac1f22f3df2818b33b5a48
This commit is contained in:
zhuyue 2021-12-10 12:25:14 +08:00
parent 979fbfe6e5
commit 7cd19fe428
4 changed files with 14 additions and 8 deletions

View File

@ -17,7 +17,7 @@ import IPAddress from './IPAddress';
const Item = ({ onChange, value }) => { const Item = ({ onChange, value }) => {
value = value || { value = value || {
ip_address: { ip: undefined, protocol_port: undefined, weight: 1 }, ip_address: { ip: undefined, protocol_port: undefined, weight: 1, subnet_id: undefined },
canEdit: true, canEdit: true,
}; };
const [ip_address, setIP] = useState(value.ip_address); const [ip_address, setIP] = useState(value.ip_address);

View File

@ -93,12 +93,14 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
subnet_id: i.subnet_id, subnet_id: i.subnet_id,
})); }));
record.currentOption = options[0].value; record.currentOption = options[0].value;
record.currentSubnetId = options[0].subnet_id;
return ( return (
<Select <Select
style={{ minWidth: 200 }} style={{ minWidth: 200 }}
options={options} options={options}
defaultValue={options[0].value} defaultValue={options[0].value}
onChange={(e) => { onChange={(e, opt) => {
record.currentSubnetId = opt.subnet_id;
record.currentOption = e; record.currentOption = e;
}} }}
/> />
@ -131,6 +133,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
protocol_port: undefined, protocol_port: undefined,
weight: 1, weight: 1,
name: record.server_name, name: record.server_name,
subnet_id: record.currentSubnetId,
}, },
canEdit: false, canEdit: false,
}); });

View File

@ -129,12 +129,13 @@ export default class CreateAction extends ModalAction {
return { weight, protocol_port, address, name, subnet_id }; return { weight, protocol_port, address, name, subnet_id };
}); });
extMembers.forEach((member) => { extMembers.forEach((member) => {
const { ip, protocol_port, weight, name = null } = member.ip_address; const { ip, protocol_port, weight, name = null, subnet_id } = member.ip_address;
const addMember = { const addMember = {
weight, weight,
protocol_port, protocol_port,
address: ip, address: ip,
name, name,
subnet_id
}; };
members.push(addMember); members.push(addMember);
}); });

View File

@ -141,19 +141,21 @@ class StepCreate extends StepAction {
memberData.push(addMember); memberData.push(addMember);
}); });
}); });
extMembers.forEach((member) => { extMembers.forEach((member) => {
const { const {
ip, ip,
protocol_port, protocol_port,
weight, weight,
name: server_name = null, name: server_name = null,
subnet_id,
} = member.ip_address; } = member.ip_address;
const addMember = { const addMember = {
weight, weight,
protocol_port, protocol_port,
address: ip, address: ip,
name: server_name, name: server_name,
subnet_id: member.subnet, subnet_id,
}; };
memberData.push(addMember); memberData.push(addMember);
}); });