1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

Merge branch '7.0'

This commit is contained in:
shanshuirenjia
2020-03-02 16:48:38 +08:00
2 changed files with 14 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ import { gettext } from '../../utils/constants';
const propTypes = {
type: PropTypes.oneOf(['move', 'copy']).isRequired,
asyncOperatedFilesLength: PropTypes.number.isRequired,
asyncOperationProgress: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
toggleDialog: PropTypes.func.isRequired,
};
@@ -13,8 +14,9 @@ class CopyMoveDirentProgressDialog extends React.Component {
render() {
let { type , asyncOperationProgress } = this.props;
let title = type === 'move' ? gettext('Move Progress') : gettext('Copy Progress');
let { type , asyncOperationProgress, asyncOperatedFilesLength } = this.props;
let title = type === 'move' ? gettext('Move {files_length} items') : gettext('Copy {files_length} items');
title = title.replace('{files_length}', asyncOperatedFilesLength);
let progressStyle = {
width: asyncOperationProgress + '%',
lineHeight: '40px',

View File

@@ -78,6 +78,7 @@ class LibContentView extends React.Component {
isCopyMoveProgressDialogShow: false,
asyncCopyMoveTaskId: '',
asyncOperationProgress: 0,
asyncOperatedFilesLength: 0,
};
this.oldonpopstate = window.onpopstate;
@@ -578,9 +579,9 @@ class LibContentView extends React.Component {
let res = await seafileAPI.queryAsyncOperationProgress(asyncCopyMoveTaskId);
let data = res.data;
if (data.failed) {
let message = gettext('Files moved to another repository failed.')
let message = gettext('Failed to move files to another library.');
if (asyncOperationType === 'copy') {
message = gettext('Files copyed to another repository failed.')
message = gettext('Failed to copy files to another library.');
}
toaster.danger(message);
this.setState({
@@ -592,9 +593,9 @@ class LibContentView extends React.Component {
if (data.successful) {
this.setState({isCopyMoveProgressDialogShow: false});
let message = gettext('Files moved to another repository successfully.')
let message = gettext('Successfully moved files to another library.');
if (asyncOperationType === 'copy') {
message = gettext('Files copyed to another repository successfully.')
message = gettext('Successfully copyed files to another library.');
}
toaster.success(message);
return;
@@ -636,6 +637,7 @@ class LibContentView extends React.Component {
if (repoID !== destRepo.repo_id) {
this.setState({
asyncOperatedFilesLength: dirNames.length,
asyncOperationProgress: 0,
asyncOperationType: 'move',
isCopyMoveProgressDialogShow: true
@@ -684,6 +686,7 @@ class LibContentView extends React.Component {
if (repoID !== destRepo.repo_id) {
this.setState({
asyncOperatedFilesLength: dirNames.length,
asyncOperationProgress: 0,
asyncOperationType: 'copy',
isCopyMoveProgressDialogShow: true
@@ -1003,6 +1006,7 @@ class LibContentView extends React.Component {
if (repoID !== destRepo.repo_id) {
this.setState({
asyncOperatedFilesLength: 1,
asyncOperationProgress: 0,
asyncOperationType: 'move',
isCopyMoveProgressDialogShow: true,
@@ -1056,6 +1060,7 @@ class LibContentView extends React.Component {
if (repoID !== destRepo.repo_id) {
this.setState({
asyncOperatedFilesLength: 1,
asyncOperationProgress: 0,
asyncOperationType: 'copy',
isCopyMoveProgressDialogShow: true
@@ -1858,6 +1863,7 @@ class LibContentView extends React.Component {
{this.state.isCopyMoveProgressDialogShow && (
<CopyMoveDirentProgressDialog
type={this.state.asyncOperationType}
asyncOperatedFilesLength={this.state.asyncOperatedFilesLength}
asyncOperationProgress={this.state.asyncOperationProgress}
toggleDialog={this.onMoveProgressDialogToggle}
/>