fix: Fix the prompts when form submit
1. Modify response processing to distinguish single operation or batch operation 2. Modify the request function of creating volume in batches Change-Id: Iffcd8174cf69191b8c36aa0f4de1853c8284fa93
This commit is contained in:
parent
b80b85911a
commit
cc897b08b7
@ -265,10 +265,40 @@ export default class BaseForm extends React.Component {
|
||||
this.updateSumbitting(false);
|
||||
!this.isModal && this.routing.push(this.listUrl);
|
||||
this.response = response;
|
||||
this.showNotice && Notify.success(this.successText);
|
||||
if (callback && isFunction(callback)) {
|
||||
callback(true, false);
|
||||
}
|
||||
if (response instanceof Array) {
|
||||
const instanceNameArr = this.instanceName.split(', ');
|
||||
const failedNames = response
|
||||
.map((it, idx) => {
|
||||
if (it.status === 'rejected') {
|
||||
return {
|
||||
reason: it.reason,
|
||||
name: instanceNameArr[idx],
|
||||
};
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((it) => !!it);
|
||||
if (failedNames.length !== 0) {
|
||||
failedNames.forEach((it) => {
|
||||
const { response: { data } = {} } = it.reason;
|
||||
this.showNotice &&
|
||||
Notify.errorWithDetail(
|
||||
data,
|
||||
t('Unable to {action}, instance: {name}.', {
|
||||
action: this.name.toLowerCase(),
|
||||
name: it.name,
|
||||
})
|
||||
);
|
||||
});
|
||||
} else {
|
||||
this.showNotice && Notify.success(this.successText);
|
||||
}
|
||||
} else {
|
||||
this.showNotice && Notify.success(this.successText);
|
||||
}
|
||||
},
|
||||
(err = {}) => {
|
||||
this.updateSumbitting(false);
|
||||
|
@ -568,7 +568,7 @@ export default class Create extends FormAction {
|
||||
if (count === 1) {
|
||||
return this.volumeStore.create(volume);
|
||||
}
|
||||
return Promise.all(
|
||||
return Promise.allSettled(
|
||||
new Array(count).fill(count).map((_, index) => {
|
||||
const body = {
|
||||
...volume,
|
||||
|
Loading…
Reference in New Issue
Block a user