mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
Merge branch '7.0'
This commit is contained in:
@@ -5,6 +5,7 @@ import { gettext } from '../../utils/constants';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
type: PropTypes.oneOf(['move', 'copy']).isRequired,
|
type: PropTypes.oneOf(['move', 'copy']).isRequired,
|
||||||
|
asyncOperatedFilesLength: PropTypes.number.isRequired,
|
||||||
asyncOperationProgress: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
asyncOperationProgress: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||||
toggleDialog: PropTypes.func.isRequired,
|
toggleDialog: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
@@ -13,8 +14,9 @@ class CopyMoveDirentProgressDialog extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
let { type , asyncOperationProgress } = this.props;
|
let { type , asyncOperationProgress, asyncOperatedFilesLength } = this.props;
|
||||||
let title = type === 'move' ? gettext('Move Progress') : gettext('Copy Progress');
|
let title = type === 'move' ? gettext('Move {files_length} items') : gettext('Copy {files_length} items');
|
||||||
|
title = title.replace('{files_length}', asyncOperatedFilesLength);
|
||||||
let progressStyle = {
|
let progressStyle = {
|
||||||
width: asyncOperationProgress + '%',
|
width: asyncOperationProgress + '%',
|
||||||
lineHeight: '40px',
|
lineHeight: '40px',
|
||||||
|
@@ -78,6 +78,7 @@ class LibContentView extends React.Component {
|
|||||||
isCopyMoveProgressDialogShow: false,
|
isCopyMoveProgressDialogShow: false,
|
||||||
asyncCopyMoveTaskId: '',
|
asyncCopyMoveTaskId: '',
|
||||||
asyncOperationProgress: 0,
|
asyncOperationProgress: 0,
|
||||||
|
asyncOperatedFilesLength: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.oldonpopstate = window.onpopstate;
|
this.oldonpopstate = window.onpopstate;
|
||||||
@@ -578,9 +579,9 @@ class LibContentView extends React.Component {
|
|||||||
let res = await seafileAPI.queryAsyncOperationProgress(asyncCopyMoveTaskId);
|
let res = await seafileAPI.queryAsyncOperationProgress(asyncCopyMoveTaskId);
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (data.failed) {
|
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') {
|
if (asyncOperationType === 'copy') {
|
||||||
message = gettext('Files copyed to another repository failed.')
|
message = gettext('Failed to copy files to another library.');
|
||||||
}
|
}
|
||||||
toaster.danger(message);
|
toaster.danger(message);
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -592,9 +593,9 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
if (data.successful) {
|
if (data.successful) {
|
||||||
this.setState({isCopyMoveProgressDialogShow: false});
|
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') {
|
if (asyncOperationType === 'copy') {
|
||||||
message = gettext('Files copyed to another repository successfully.')
|
message = gettext('Successfully copyed files to another library.');
|
||||||
}
|
}
|
||||||
toaster.success(message);
|
toaster.success(message);
|
||||||
return;
|
return;
|
||||||
@@ -636,6 +637,7 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
if (repoID !== destRepo.repo_id) {
|
if (repoID !== destRepo.repo_id) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
asyncOperatedFilesLength: dirNames.length,
|
||||||
asyncOperationProgress: 0,
|
asyncOperationProgress: 0,
|
||||||
asyncOperationType: 'move',
|
asyncOperationType: 'move',
|
||||||
isCopyMoveProgressDialogShow: true
|
isCopyMoveProgressDialogShow: true
|
||||||
@@ -684,6 +686,7 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
if (repoID !== destRepo.repo_id) {
|
if (repoID !== destRepo.repo_id) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
asyncOperatedFilesLength: dirNames.length,
|
||||||
asyncOperationProgress: 0,
|
asyncOperationProgress: 0,
|
||||||
asyncOperationType: 'copy',
|
asyncOperationType: 'copy',
|
||||||
isCopyMoveProgressDialogShow: true
|
isCopyMoveProgressDialogShow: true
|
||||||
@@ -1003,6 +1006,7 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
if (repoID !== destRepo.repo_id) {
|
if (repoID !== destRepo.repo_id) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
asyncOperatedFilesLength: 1,
|
||||||
asyncOperationProgress: 0,
|
asyncOperationProgress: 0,
|
||||||
asyncOperationType: 'move',
|
asyncOperationType: 'move',
|
||||||
isCopyMoveProgressDialogShow: true,
|
isCopyMoveProgressDialogShow: true,
|
||||||
@@ -1056,6 +1060,7 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
if (repoID !== destRepo.repo_id) {
|
if (repoID !== destRepo.repo_id) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
asyncOperatedFilesLength: 1,
|
||||||
asyncOperationProgress: 0,
|
asyncOperationProgress: 0,
|
||||||
asyncOperationType: 'copy',
|
asyncOperationType: 'copy',
|
||||||
isCopyMoveProgressDialogShow: true
|
isCopyMoveProgressDialogShow: true
|
||||||
@@ -1858,6 +1863,7 @@ class LibContentView extends React.Component {
|
|||||||
{this.state.isCopyMoveProgressDialogShow && (
|
{this.state.isCopyMoveProgressDialogShow && (
|
||||||
<CopyMoveDirentProgressDialog
|
<CopyMoveDirentProgressDialog
|
||||||
type={this.state.asyncOperationType}
|
type={this.state.asyncOperationType}
|
||||||
|
asyncOperatedFilesLength={this.state.asyncOperatedFilesLength}
|
||||||
asyncOperationProgress={this.state.asyncOperationProgress}
|
asyncOperationProgress={this.state.asyncOperationProgress}
|
||||||
toggleDialog={this.onMoveProgressDialogToggle}
|
toggleDialog={this.onMoveProgressDialogToggle}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user