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 }) => {
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,
};
const [ip_address, setIP] = useState(value.ip_address);

View File

@ -47,7 +47,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
return getLinkRender({ key, params: { id }, value: id });
}
let addOuter = () => {};
let addOuter = () => { };
return (
<div style={{ padding: 20 }}>
@ -93,12 +93,14 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
subnet_id: i.subnet_id,
}));
record.currentOption = options[0].value;
record.currentSubnetId = options[0].subnet_id;
return (
<Select
style={{ minWidth: 200 }}
options={options}
defaultValue={options[0].value}
onChange={(e) => {
onChange={(e, opt) => {
record.currentSubnetId = opt.subnet_id;
record.currentOption = e;
}}
/>
@ -131,6 +133,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
protocol_port: undefined,
weight: 1,
name: record.server_name,
subnet_id: record.currentSubnetId,
},
canEdit: false,
});
@ -172,8 +175,8 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
filterFunc: (record, val) => {
return val
? record.fixed_ips.some(
(item) => item.subnet_id === lbSubnetId
)
(item) => item.subnet_id === lbSubnetId
)
: true;
},
},
@ -247,7 +250,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
(it) =>
it.address === value1.ip_address.ip &&
it.protocol_port ===
value1.ip_address.protocol_port
value1.ip_address.protocol_port
);
if (!value1 || !value1.ip_address.ip) {
return Promise.reject(

View File

@ -129,12 +129,13 @@ export default class CreateAction extends ModalAction {
return { weight, protocol_port, address, name, subnet_id };
});
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 = {
weight,
protocol_port,
address: ip,
name,
subnet_id
};
members.push(addMember);
});

View File

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