Merge "fix: support the same port if different protocol"
This commit is contained in:
commit
8bda065853
@ -131,6 +131,10 @@ export class CreateDNAT extends ModalAction {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
get nameForStateUpdate() {
|
||||||
|
return ['protocol'];
|
||||||
|
}
|
||||||
|
|
||||||
get formItems() {
|
get formItems() {
|
||||||
const { fixed_ip_address = { selectedRows: [] } } = this.state;
|
const { fixed_ip_address = { selectedRows: [] } } = this.state;
|
||||||
const ret = [
|
const ret = [
|
||||||
@ -169,8 +173,10 @@ export class CreateDNAT extends ModalAction {
|
|||||||
new Error(`${t('Please input')} ${t('External Port')}`)
|
new Error(`${t('Please input')} ${t('External Port')}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const { alreadyUsedPorts } = this.state;
|
const { alreadyUsedPorts, protocol } = this.state;
|
||||||
const flag = alreadyUsedPorts.some((pf) => pf.external_port === val);
|
const flag = alreadyUsedPorts.some(
|
||||||
|
(pf) => pf.external_port === val && pf.protocol === protocol
|
||||||
|
);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(
|
new Error(
|
||||||
@ -180,6 +186,7 @@ export class CreateDNAT extends ModalAction {
|
|||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
},
|
},
|
||||||
|
dependencies: ['protocol'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'internal_port',
|
name: 'internal_port',
|
||||||
@ -202,13 +209,14 @@ export class CreateDNAT extends ModalAction {
|
|||||||
const internal_ip_address =
|
const internal_ip_address =
|
||||||
formData.fixed_ip_address.selectedRows[0].fixed_ip_address;
|
formData.fixed_ip_address.selectedRows[0].fixed_ip_address;
|
||||||
const internal_port_id = formData.virtual_adapter.selectedRows[0].id;
|
const internal_port_id = formData.virtual_adapter.selectedRows[0].id;
|
||||||
const { alreadyUsedPorts } = this.state;
|
const { alreadyUsedPorts, protocol } = this.state;
|
||||||
// determine whether the FIP has been bound to the port of the port
|
// determine whether the FIP has been bound to the port of the port
|
||||||
const flag = alreadyUsedPorts.some(
|
const flag = alreadyUsedPorts.some(
|
||||||
(pf) =>
|
(pf) =>
|
||||||
pf.internal_port === val &&
|
pf.internal_port === val &&
|
||||||
pf.internal_port_id === internal_port_id &&
|
pf.internal_port_id === internal_port_id &&
|
||||||
pf.internal_ip_address === internal_ip_address
|
pf.internal_ip_address === internal_ip_address &&
|
||||||
|
pf.protocol === protocol
|
||||||
);
|
);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
@ -221,6 +229,7 @@ export class CreateDNAT extends ModalAction {
|
|||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
},
|
},
|
||||||
|
dependencies: ['protocol'],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const extraColumn = getPortFormItem.call(this, ['compute:nova', '']);
|
const extraColumn = getPortFormItem.call(this, ['compute:nova', '']);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import { action } from 'mobx';
|
import { action } from 'mobx';
|
||||||
import client from 'client';
|
import client from 'client';
|
||||||
import Base from 'stores/base';
|
import Base from 'stores/base';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
export class PortForwardingStore extends Base {
|
export class PortForwardingStore extends Base {
|
||||||
get client() {
|
get client() {
|
||||||
@ -38,7 +39,10 @@ export class PortForwardingStore extends Base {
|
|||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
const { fipInfo } = filters;
|
const { fipInfo = {} } = filters;
|
||||||
|
if (isEmpty(fipInfo)) {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
const { floating_ip_address } = fipInfo;
|
const { floating_ip_address } = fipInfo;
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
item.fip = fipInfo;
|
item.fip = fipInfo;
|
||||||
|
Loading…
Reference in New Issue
Block a user