Merge "fix: Close batch action modal when error"

This commit is contained in:
Zuul 2021-09-03 09:55:16 +00:00 committed by Gerrit Code Review
commit 239274fa5b

View File

@ -271,19 +271,21 @@ class ActionButton extends Component {
try { try {
perform(data).then( perform(data).then(
() => { () => {
Confirm.confirm({ const modal = Confirm.confirm({
title, title,
content, content,
okText, okText,
cancelText, cancelText,
onOk: () => onOk: () => {
this.onConfirmOK( this.onConfirmOK(
data, data,
onSubmit, onSubmit,
isBatch, isBatch,
containerProps, containerProps,
afterSubmit afterSubmit,
), modal
);
},
onCancel: () => { onCancel: () => {
onCancelAction && onCancelAction(); onCancelAction && onCancelAction();
}, },
@ -363,7 +365,14 @@ class ActionButton extends Component {
}); });
}); });
onConfirmOK = (data, onSubmit, isBatch, containerProps, afterSubmit) => { onConfirmOK = (
data,
onSubmit,
isBatch,
containerProps,
afterSubmit,
modal
) => {
if (isBatch) { if (isBatch) {
return this.onSubmitBatch( return this.onSubmitBatch(
data, data,
@ -371,7 +380,12 @@ class ActionButton extends Component {
containerProps, containerProps,
isBatch, isBatch,
afterSubmit afterSubmit
); ).catch(() => {
modal &&
modal.update({
visible: false,
});
});
} }
return this.onSubmitOne(data, onSubmit, containerProps, afterSubmit); return this.onSubmitOne(data, onSubmit, containerProps, afterSubmit);
}; };
@ -444,6 +458,7 @@ class ActionButton extends Component {
confirmLoading: submitLoading, confirmLoading: submitLoading,
okText, okText,
cancelText, cancelText,
maskClosable: false,
}; };
if (readOnly) { if (readOnly) {
modalProps.cancelButtonProps = { modalProps.cancelButtonProps = {