fix: Fix for create lb members
fix for create lb members Change-Id: Iabd009f90dfcda329f809d48220bfce97fe63717
This commit is contained in:
parent
6113ab6331
commit
ea9cbb9455
@ -25,7 +25,13 @@ import Item from './Item';
|
||||
const { isIPv4, isIpv6 } = ipValidate;
|
||||
|
||||
const MemberAllocator = ({ componentProps, formItemProps }) => {
|
||||
const { maxNumber = 10, ports, isLoading, members = [] } = componentProps;
|
||||
const {
|
||||
maxNumber = 10,
|
||||
ports,
|
||||
isLoading,
|
||||
members = [],
|
||||
lbSubnetId,
|
||||
} = componentProps;
|
||||
const { name, onChange } = formItemProps;
|
||||
|
||||
const [currentFieldsLength, setLength] = useState(0);
|
||||
@ -51,6 +57,9 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
|
||||
xs: 18,
|
||||
xm: 12,
|
||||
}}
|
||||
extra={t(
|
||||
'If you choose a port which subnet is different from the subnet of LB, please ensure connectivity between the two.'
|
||||
)}
|
||||
>
|
||||
<SelectTable
|
||||
maxSelectedCount={-1}
|
||||
@ -151,6 +160,23 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
|
||||
filterFunc: (record, val) =>
|
||||
record.some((item) => item.ip_address.indexOf(val) > -1),
|
||||
},
|
||||
{
|
||||
label: t('Same subnet with LB'),
|
||||
name: 'origin_data',
|
||||
options: [
|
||||
{
|
||||
label: t('true'),
|
||||
key: true,
|
||||
},
|
||||
],
|
||||
filterFunc: (record, val) => {
|
||||
return val
|
||||
? record.fixed_ips.some(
|
||||
(item) => item.subnet_id === lbSubnetId
|
||||
)
|
||||
: true;
|
||||
},
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
@ -280,7 +306,12 @@ const MemberAllocator = ({ componentProps, formItemProps }) => {
|
||||
</Form.List>
|
||||
</Form.Item>
|
||||
{currentFieldsLength < maxNumber && (
|
||||
<Form.Item label={t('Add External Members')}>
|
||||
<Form.Item
|
||||
label={t('Add External Members')}
|
||||
extra={t(
|
||||
'The ip of external members can be any, including the public network ip.'
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
|
@ -917,6 +917,7 @@
|
||||
"If the capacity of the disk is large,the type modify operation may takes several hours. Please be cautious.": "If the capacity of the disk is large,the type modify operation may takes several hours. Please be cautious.",
|
||||
"If the volume associated with the snapshot has changed the volume type, please modify this option manually; if the volume associated with the snapshot keeps the volume type unchanged, please ignore this option. (no need to change).": "If the volume associated with the snapshot has changed the volume type, please modify this option manually; if the volume associated with the snapshot keeps the volume type unchanged, please ignore this option. (no need to change).",
|
||||
"If you are not authorized to access any project, or if the project you are involved in has been deleted or disabled, contact the platform administrator to reassign the project": "If you are not authorized to access any project, or if the project you are involved in has been deleted or disabled, contact the platform administrator to reassign the project",
|
||||
"If you choose a port which subnet is different from the subnet of LB, please ensure connectivity between the two.": "If you choose a port which subnet is different from the subnet of LB, please ensure connectivity between the two.",
|
||||
"If you do not fill in parameters such as cpus, memory_mb, local_gb, cpu_arch, etc., you can automatically inject the configuration and Mac address of the physical machine by performing the \"Auto Inspect\" operation.": "If you do not fill in parameters such as cpus, memory_mb, local_gb, cpu_arch, etc., you can automatically inject the configuration and Mac address of the physical machine by performing the \"Auto Inspect\" operation.",
|
||||
"If you still want to keep the disk data, it is recommended that you create a snapshot for the disk before deleting.": "If you still want to keep the disk data, it is recommended that you create a snapshot for the disk before deleting.",
|
||||
"Illegal JSON scheme": "Illegal JSON scheme",
|
||||
@ -1658,6 +1659,7 @@
|
||||
"SNAT rules": "SNAT rules",
|
||||
"SOURCE_IP": "Source IP",
|
||||
"Saint Vincent and the Grenadines": "Saint Vincent and the Grenadines",
|
||||
"Same subnet with LB": "Same subnet with LB",
|
||||
"Samoa": "Samoa",
|
||||
"San Marino": "San Marino",
|
||||
"Sao Tome and Principe": "Sao Tome and Principe",
|
||||
@ -1881,6 +1883,7 @@
|
||||
"The instances in the anti-affinity group are allocated to different physical machines as much as possible. When there are no more physical machines to allocate, the normal allocation strategy is returned.": "The instances in the anti-affinity group are allocated to different physical machines as much as possible. When there are no more physical machines to allocate, the normal allocation strategy is returned.",
|
||||
"The instances in the anti-affinity group are strictly allocated to different physical machines. When there are no more physical machines to allocate, the allocation fails.": "The instances in the anti-affinity group are strictly allocated to different physical machines. When there are no more physical machines to allocate, the allocation fails.",
|
||||
"The ip is not within the allocated pool!": "The ip is not within the allocated pool!",
|
||||
"The ip of external members can be any, including the public network ip.": "The ip of external members can be any, including the public network ip.",
|
||||
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.",
|
||||
"The name cannot be modified after creation": "The name cannot be modified after creation",
|
||||
"The name of the physical network to which a port is connected": "The name of the physical network to which a port is connected",
|
||||
|
@ -917,6 +917,7 @@
|
||||
"If the capacity of the disk is large,the type modify operation may takes several hours. Please be cautious.": "如果云硬盘容量较大,修改云硬盘类型可能需要花费几个小时,请您谨慎操作。",
|
||||
"If the volume associated with the snapshot has changed the volume type, please modify this option manually; if the volume associated with the snapshot keeps the volume type unchanged, please ignore this option. (no need to change).": "若快照关联的云硬盘修改过云硬盘类型,请手动修改此选项;若快照关联的云硬盘保持云硬盘类型不变,请忽略此选项(不需要做变更)。",
|
||||
"If you are not authorized to access any project, or if the project you are involved in has been deleted or disabled, contact the platform administrator to reassign the project": "您未被授权访问任何项目,或您参与中的项目已被删除或禁用,可联系平台管理员重新分配项目",
|
||||
"If you choose a port which subnet is different from the subnet of LB, please ensure connectivity between the two.": "如果你选择了和LB子网不同的网卡,请确保两者的连通性。",
|
||||
"If you do not fill in parameters such as cpus, memory_mb, local_gb, cpu_arch, etc., you can automatically inject the configuration and Mac address of the physical machine by performing the \"Auto Inspect\" operation.": "如不填写cpus、memory_mb、local_gb、cpu_arch等参数,您可以通过执行“自动检测”操作来自动注入物理机的配置和 Mac 地址。",
|
||||
"If you still want to keep the disk data, it is recommended that you create a snapshot for the disk before deleting.": "如果您仍想保留云硬盘数据,建议您在删除之前为云硬盘创建快照。",
|
||||
"Illegal JSON scheme": "不合法的JSON格式",
|
||||
@ -1658,6 +1659,7 @@
|
||||
"SNAT rules": "SNAT规则",
|
||||
"SOURCE_IP": "源IP算法",
|
||||
"Saint Vincent and the Grenadines": "圣文森特和格林纳丁斯",
|
||||
"Same subnet with LB": "与LB子网相同",
|
||||
"Samoa": "美属萨摩亚",
|
||||
"San Marino": "圣马力诺共和国",
|
||||
"Sao Tome and Principe": "圣多美和普林西比",
|
||||
@ -1881,6 +1883,7 @@
|
||||
"The instances in the anti-affinity group are allocated to different physical machines as much as possible. When there are no more physical machines to allocate, the normal allocation strategy is returned.": "将反亲和组内的云主机尽量分配到不同物理机上,当没有更多物理机可分配时,回归普通分配策略。",
|
||||
"The instances in the anti-affinity group are strictly allocated to different physical machines. When there are no more physical machines to allocate, the allocation fails.": "将反亲和组内的云主机严格分配到不同物理机上,当没有更多物理机可分配时,则分配失败。",
|
||||
"The ip is not within the allocated pool!": "该ip不在分配的资源池范围内!",
|
||||
"The ip of external members can be any, including the public network ip.": "外部成员的IP可以是任何IP,包括公网IP。",
|
||||
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "地址片段的最大传输单位。IPv4最小68,IPv6最小1280。",
|
||||
"The name cannot be modified after creation": "名称创建后不可修改",
|
||||
"The name of the physical network to which a port is connected": "端口连接到的物理网络的名称",
|
||||
|
@ -18,7 +18,7 @@ import { ModalAction } from 'containers/Action';
|
||||
import { PoolMemberStore } from 'stores/octavia/pool-member';
|
||||
import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter';
|
||||
import { toJS } from 'mobx';
|
||||
import { uniqWith } from 'lodash';
|
||||
import { uniqWith, get } from 'lodash';
|
||||
import globalLbaasStore from 'stores/octavia/loadbalancer';
|
||||
import isEqual from 'react-fast-compare';
|
||||
|
||||
@ -43,6 +43,7 @@ export default class CreateAction extends ModalAction {
|
||||
init() {
|
||||
this.store = new VirtualAdapterStore();
|
||||
this.memberStore = new PoolMemberStore();
|
||||
this.lbDetail = {};
|
||||
this.state = {
|
||||
ports: [],
|
||||
};
|
||||
@ -56,26 +57,16 @@ export default class CreateAction extends ModalAction {
|
||||
})
|
||||
.then((lb) => {
|
||||
this.lbDetail = lb;
|
||||
return this.store.fetchList({ network_id: lb.vip_network_id });
|
||||
return this.store.fetchList();
|
||||
})
|
||||
.then((ports) => {
|
||||
this.setState({
|
||||
ports: ports
|
||||
.filter(
|
||||
(port) =>
|
||||
port.fixed_ips.some(
|
||||
(fixed_ip) =>
|
||||
fixed_ip.subnet_id === this.lbDetail.vip_subnet_id
|
||||
) &&
|
||||
port.device_owner !== 'network:dhcp' &&
|
||||
port.device_owner !== 'network:router_gateway'
|
||||
)
|
||||
.map((item) => {
|
||||
item.fixed_ips = item.fixed_ips.filter(
|
||||
(fixed_ip) => fixed_ip.subnet_id === this.lbDetail.vip_subnet_id
|
||||
);
|
||||
return item;
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -122,6 +113,7 @@ export default class CreateAction extends ModalAction {
|
||||
{
|
||||
name: 'extMembers',
|
||||
type: 'member-allocator',
|
||||
lbSubnetId: get(this.lbDetail, 'vip_subnet_id', ''),
|
||||
isLoading: this.store.list.isLoading,
|
||||
ports: this.state.ports,
|
||||
members: this.memberStore.list.data,
|
||||
|
@ -16,6 +16,7 @@ import { inject, observer } from 'mobx-react';
|
||||
import Base from 'components/Form';
|
||||
import { PortStore } from 'stores/neutron/port';
|
||||
import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter';
|
||||
import { get } from 'lodash';
|
||||
|
||||
@inject('rootStore')
|
||||
@observer
|
||||
@ -26,25 +27,14 @@ export default class MemberStep extends Base {
|
||||
this.state = {
|
||||
ports: [],
|
||||
};
|
||||
const network_id = this.props.context.vip_network_id.selectedRowKeys[0];
|
||||
const subnet_id = this.props.context.vip_address[0].subnet;
|
||||
this.store.fetchList({ network_id }).then((ports) => {
|
||||
this.store.fetchList().then((ports) => {
|
||||
this.setState({
|
||||
ports: ports
|
||||
.filter(
|
||||
(port) =>
|
||||
port.fixed_ips.some(
|
||||
(fixed_ip) => fixed_ip.subnet_id === subnet_id
|
||||
) &&
|
||||
port.device_owner !== 'network:dhcp' &&
|
||||
port.device_owner !== 'network:router_gateway'
|
||||
)
|
||||
.map((item) => {
|
||||
item.fixed_ips = item.fixed_ips.filter(
|
||||
(fixed_ip) => fixed_ip.subnet_id === subnet_id
|
||||
);
|
||||
return item;
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -71,10 +61,12 @@ export default class MemberStep extends Base {
|
||||
}
|
||||
|
||||
get formItems() {
|
||||
const subnet_id = get(this.props.context, 'vip_address[0].subnet', '');
|
||||
return [
|
||||
{
|
||||
name: 'extMembers',
|
||||
type: 'member-allocator',
|
||||
lbSubnetId: subnet_id,
|
||||
isLoading: this.store.list.isLoading,
|
||||
ports: this.state.ports,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user