From 159aa00875d1f3ef51f8c9e9f2529a5f6737aef7 Mon Sep 17 00:00:00 2001 From: xusongfu Date: Mon, 22 Aug 2022 11:42:32 +0800 Subject: [PATCH] fix: fix the abort of upload 1. Fix the `canToken` to `cancelToken` 2. Show abort button if it's not modal form Change-Id: I24f5b1632e68baaa04d9f0ed7e11ebc74f48e1bb --- src/components/Form/index.jsx | 14 +++++++++++++- src/locales/en.json | 1 + src/locales/zh.json | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/Form/index.jsx b/src/components/Form/index.jsx index 60533d69..e74c2572 100644 --- a/src/components/Form/index.jsx +++ b/src/components/Form/index.jsx @@ -474,7 +474,7 @@ export default class BaseForm extends React.Component { getUploadRequestConf = () => { return { onUploadProgress: this.onUploadProgress, - canToken: this.cancelToken, + cancelToken: this.cancelToken, }; }; @@ -637,6 +637,17 @@ export default class BaseForm extends React.Component { ); } + renderAbortButton() { + if (!this.isSubmitting || this.isModal) { + return null; + } + return ( + + ); + } + renderSubmittingTip() { if (!this.hasRequestCancelCallback) { return; @@ -648,6 +659,7 @@ export default class BaseForm extends React.Component {
+ {this.renderAbortButton()} ); } diff --git a/src/locales/en.json b/src/locales/en.json index 559c968c..ad7cdb30 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -42,6 +42,7 @@ "ARM Architecture": "ARM Architecture", "Abandon Stack": "Abandon Stack", "Abandoning this stack will preserve the resources deployed by the stack.": "Abandoning this stack will preserve the resources deployed by the stack.", + "Abort Upload": "Abort Upload", "Accept Volume Transfer": "Accept Volume Transfer", "Access Control": "Access Control", "Access Key": "Access Key", diff --git a/src/locales/zh.json b/src/locales/zh.json index c99fc1aa..0e03e6c7 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -42,6 +42,7 @@ "ARM Architecture": "ARM架构", "Abandon Stack": "废弃堆栈", "Abandoning this stack will preserve the resources deployed by the stack.": "废弃此堆栈将保留堆栈部署的资源。", + "Abort Upload": "取消上传", "Accept Volume Transfer": "接受云硬盘转让", "Access Control": "访问控制", "Access Key": "访问密钥",