From 7a16d82669e47d43b1e9d24d9c09d9b31586971a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98JoinTyang=E2=80=99?= Date: Mon, 26 Aug 2024 18:33:29 +0800 Subject: [PATCH] rebase and optimize --- ...d-sdoc-dialog.js => import-sdoc-dialog.js} | 10 +++++----- .../toolbar/dir-operation-toolbar.js | 20 +++++++++---------- frontend/src/utils/text-translation.js | 2 +- seahub/api2/views.py | 9 +++++---- seahub/seadoc/utils.py | 4 ++-- 5 files changed, 23 insertions(+), 22 deletions(-) rename frontend/src/components/dialog/{upload-sdoc-dialog.js => import-sdoc-dialog.js} (89%) diff --git a/frontend/src/components/dialog/upload-sdoc-dialog.js b/frontend/src/components/dialog/import-sdoc-dialog.js similarity index 89% rename from frontend/src/components/dialog/upload-sdoc-dialog.js rename to frontend/src/components/dialog/import-sdoc-dialog.js index 228cf3001a2..bf1208d3487 100644 --- a/frontend/src/components/dialog/upload-sdoc-dialog.js +++ b/frontend/src/components/dialog/import-sdoc-dialog.js @@ -13,7 +13,7 @@ const propTypes = { loadDirentList: PropTypes.func.isRequired, }; -class UploadSdocDialog extends React.Component { +class ImportSdocDialog extends React.Component { constructor(props) { super(props); this.state = { @@ -48,9 +48,9 @@ class UploadSdocDialog extends React.Component { } // check file extension let fileName = this.fileInputRef.current.files[0].name; - if (fileName.substr(fileName.lastIndexOf('.') + 1) != 'zsdoc') { + if (fileName.substr(fileName.lastIndexOf('.') + 1) != 'sdoczip') { this.setState({ - errorMsg: gettext('Please choose a .zsdoc file.') + errorMsg: gettext('Please choose a .zip file.') }); return; } @@ -77,6 +77,6 @@ class UploadSdocDialog extends React.Component { } } -UploadSdocDialog.propTypes = propTypes; +ImportSdocDialog.propTypes = propTypes; -export default UploadSdocDialog; +export default ImportSdocDialog; diff --git a/frontend/src/components/toolbar/dir-operation-toolbar.js b/frontend/src/components/toolbar/dir-operation-toolbar.js index be54b04158a..57664ccd99c 100644 --- a/frontend/src/components/toolbar/dir-operation-toolbar.js +++ b/frontend/src/components/toolbar/dir-operation-toolbar.js @@ -7,7 +7,7 @@ import ModalPortal from '../modal-portal'; import CreateFolder from '../../components/dialog/create-folder-dialog'; import CreateFile from '../../components/dialog/create-file-dialog'; import ShareDialog from '../../components/dialog/share-dialog'; -import UploadSdocDialog from '../dialog/upload-sdoc-dialog'; +import ImportSdocDialog from '../dialog/import-sdoc-dialog'; const propTypes = { path: PropTypes.string.isRequired, @@ -40,7 +40,7 @@ class DirOperationToolbar extends React.Component { isDesktopMenuOpen: false, isSubMenuShown: false, isMobileOpMenuOpen: false, - isUploadSdocDialogOpen: false, + isImportSdocDialogOpen: false, }; } @@ -159,8 +159,8 @@ class DirOperationToolbar extends React.Component { } }; - onToggleUploadSdoc = () => { - this.setState({ isUploadSdocDialogOpen: !this.state.isUploadSdocDialogOpen }); + onToggleImportSdoc = () => { + this.setState({ isImportSdocDialogOpen: !this.state.isImportSdocDialogOpen }); }; render() { @@ -193,9 +193,9 @@ class DirOperationToolbar extends React.Component { 'text': gettext('Upload Folder'), 'onClick': this.onUploadFolder }, { - 'icon': 'upload-sdoc', - 'text': gettext('Upload Sdoc'), - 'onClick': this.onToggleUploadSdoc + 'icon': 'import-sdoc', + 'text': gettext('Import Sdoc'), + 'onClick': this.onToggleImportSdoc }); } else { opList.push({ @@ -366,9 +366,9 @@ class DirOperationToolbar extends React.Component { /> } - {this.state.isUploadSdocDialogOpen && -