fix: Support multi add networks/routers to neutron agent
1. Support multi add networks to DHCP agent 2. Support multi add routers to L3 agent Change-Id: I375e3c0f39da8be2b3839cd5c057b5b6005be2f0
This commit is contained in:
parent
3ba3223cf9
commit
2912303311
@ -280,13 +280,15 @@ export default class BaseForm extends React.Component {
|
|||||||
callback(true, false);
|
callback(true, false);
|
||||||
}
|
}
|
||||||
if (response instanceof Array) {
|
if (response instanceof Array) {
|
||||||
const instanceNameArr = this.instanceName.split(', ');
|
const instanceNameArr = this.instanceName
|
||||||
|
? this.instanceName.split(', ')
|
||||||
|
: null;
|
||||||
const failedNames = response
|
const failedNames = response
|
||||||
.map((it, idx) => {
|
.map((it, idx) => {
|
||||||
if (it.status === 'rejected') {
|
if (it.status === 'rejected') {
|
||||||
return {
|
return {
|
||||||
reason: it.reason,
|
reason: it.reason,
|
||||||
name: instanceNameArr[idx],
|
name: instanceNameArr ? instanceNameArr[idx] : '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -45,8 +45,9 @@ export default class AddNetwork extends ModalAction {
|
|||||||
return t('add network');
|
return t('add network');
|
||||||
}
|
}
|
||||||
|
|
||||||
get messageHasItemName() {
|
get instanceName() {
|
||||||
return false;
|
const { network: { selectedRows = [] } = {} } = this.values;
|
||||||
|
return selectedRows.map((it) => it.name).join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
get detail() {
|
get detail() {
|
||||||
@ -63,7 +64,7 @@ export default class AddNetwork extends ModalAction {
|
|||||||
if (!agentId) {
|
if (!agentId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.store.fetchList({ agentId });
|
await this.store.fetchList({ agentId, all_projects: true });
|
||||||
this.updateDefaultValue();
|
this.updateDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ export default class AddNetwork extends ModalAction {
|
|||||||
|
|
||||||
disabledFunc = (record) => {
|
disabledFunc = (record) => {
|
||||||
const { id } = record;
|
const { id } = record;
|
||||||
return this.dhcpNetworks.indexOf(id) >= 0;
|
return this.dhcpNetworks.includes(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
get defaultValue() {
|
get defaultValue() {
|
||||||
@ -137,6 +138,7 @@ export default class AddNetwork extends ModalAction {
|
|||||||
disabledFunc: this.disabledFunc,
|
disabledFunc: this.disabledFunc,
|
||||||
extraParams: { all_projects: true },
|
extraParams: { all_projects: true },
|
||||||
required: true,
|
required: true,
|
||||||
|
isMulti: true,
|
||||||
filterParams: this.getSearchFilters(),
|
filterParams: this.getSearchFilters(),
|
||||||
columns: this.getColumns(),
|
columns: this.getColumns(),
|
||||||
...networkSortProps,
|
...networkSortProps,
|
||||||
@ -145,11 +147,11 @@ export default class AddNetwork extends ModalAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
const { network } = values;
|
const { network: { selectedRowKeys = [] } = {} } = values;
|
||||||
const body = {
|
const data = selectedRowKeys.map((it) => ({
|
||||||
network_id: network.selectedRowKeys[0],
|
network_id: it,
|
||||||
};
|
}));
|
||||||
const { agentId } = this;
|
const { agentId } = this;
|
||||||
return this.store.add({ agentId }, body);
|
return this.store.add({ agentId }, data);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,9 @@ export default class AddRouter extends ModalAction {
|
|||||||
return t('add router');
|
return t('add router');
|
||||||
}
|
}
|
||||||
|
|
||||||
get messageHasItemName() {
|
get instanceName() {
|
||||||
return false;
|
const { router: { selectedRows = [] } = {} } = this.values;
|
||||||
|
return selectedRows.map((it) => it.name).join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
get detail() {
|
get detail() {
|
||||||
@ -66,7 +67,7 @@ export default class AddRouter extends ModalAction {
|
|||||||
if (!agentId) {
|
if (!agentId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.store.fetchList({ agentId });
|
await this.store.fetchList({ agentId, all_projects: true });
|
||||||
this.updateDefaultValue();
|
this.updateDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ export default class AddRouter extends ModalAction {
|
|||||||
disabledFunc: this.disabledFunc,
|
disabledFunc: this.disabledFunc,
|
||||||
extraParams: { all_projects: true },
|
extraParams: { all_projects: true },
|
||||||
required: true,
|
required: true,
|
||||||
|
isMulti: true,
|
||||||
filterParams: this.getFilters(),
|
filterParams: this.getFilters(),
|
||||||
columns: this.getColumns(),
|
columns: this.getColumns(),
|
||||||
...routerSortProps,
|
...routerSortProps,
|
||||||
@ -131,11 +133,11 @@ export default class AddRouter extends ModalAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSubmit = (values) => {
|
onSubmit = (values) => {
|
||||||
const { router } = values;
|
const { router: { selectedRowKeys = [] } = {} } = values;
|
||||||
const body = {
|
const data = selectedRowKeys.map((it) => ({
|
||||||
router_id: router.selectedRowKeys[0],
|
router_id: it,
|
||||||
};
|
}));
|
||||||
const { agentId } = this;
|
const { agentId } = this;
|
||||||
return this.store.add({ agentId }, body);
|
return this.store.add({ agentId }, data);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user