mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-05 09:10:05 +00:00
repair bug&improve code (#4521)
* repair bug&improve code * delete test code
This commit is contained in:
parent
11a0d0fc3c
commit
5591bbd1d6
@ -54,7 +54,7 @@ const propTypes = {
|
|||||||
onShowDirentsDraggablePreview: PropTypes.func,
|
onShowDirentsDraggablePreview: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirentListItem extends React.Component {
|
class DirentListItem extends React.PureComponent {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -87,6 +87,8 @@ class LibContentView extends React.Component {
|
|||||||
window.onpopstate = this.onpopstate;
|
window.onpopstate = this.onpopstate;
|
||||||
this.lastModifyTime = new Date();
|
this.lastModifyTime = new Date();
|
||||||
this.isNeedUpdateHistoryState = true; // Load, refresh page, switch mode for the first time, no need to set historyState
|
this.isNeedUpdateHistoryState = true; // Load, refresh page, switch mode for the first time, no need to set historyState
|
||||||
|
this.currentMoveItemName = '';
|
||||||
|
this.currentMoveItemPath = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
showDirentDetail = (direntDetailPanelTab) => {
|
showDirentDetail = (direntDetailPanelTab) => {
|
||||||
@ -600,6 +602,12 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
if (data.successful) {
|
if (data.successful) {
|
||||||
if (asyncOperationType === 'move') {
|
if (asyncOperationType === 'move') {
|
||||||
|
if (this.currentMoveItemName && this.currentMoveItemPath) {
|
||||||
|
if (this.state.currentMode === 'column') {
|
||||||
|
this.deleteTreeNode(this.currentMoveItemPath);
|
||||||
|
}
|
||||||
|
this.moveDirent(this.currentMoveItemName);
|
||||||
|
} else {
|
||||||
if (this.state.currentMode === 'column') {
|
if (this.state.currentMode === 'column') {
|
||||||
let direntPaths = this.getSelectedDirentPaths();
|
let direntPaths = this.getSelectedDirentPaths();
|
||||||
this.deleteTreeNodes(direntPaths);
|
this.deleteTreeNodes(direntPaths);
|
||||||
@ -607,6 +615,7 @@ class LibContentView extends React.Component {
|
|||||||
let direntNames = this.getSelectedDirentNames();
|
let direntNames = this.getSelectedDirentNames();
|
||||||
this.moveDirents(direntNames);
|
this.moveDirents(direntNames);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({isCopyMoveProgressDialogShow: false});
|
this.setState({isCopyMoveProgressDialogShow: false});
|
||||||
let message = gettext('Successfully moved files to another library.');
|
let message = gettext('Successfully moved files to another library.');
|
||||||
@ -1043,10 +1052,10 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
seafileAPI.moveDir(repoID, destRepo.repo_id, moveToDirentPath, nodeParentPath, dirName).then(res => {
|
seafileAPI.moveDir(repoID, destRepo.repo_id, moveToDirentPath, nodeParentPath, dirName).then(res => {
|
||||||
if (repoID !== destRepo.repo_id) {
|
if (repoID !== destRepo.repo_id) {
|
||||||
this.setState({
|
this.setState({asyncCopyMoveTaskId: res.data.task_id}, () => {
|
||||||
asyncCopyMoveTaskId: res.data.task_id,
|
this.currentMoveItemName = dirName;
|
||||||
}, () => {
|
this.currentMoveItemPath = direntPath;
|
||||||
this.getAsyncCopyMoveProgress();
|
this.getAsyncCopyMoveProgress(dirName, direntPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,7 +1114,8 @@ class LibContentView extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repoID === destRepo.repo_id && this.state.currentMode === 'column') {
|
if (repoID === destRepo.repo_id) {
|
||||||
|
if (this.state.currentMode === 'column') {
|
||||||
this.updateMoveCopyTreeNode(copyToDirentPath);
|
this.updateMoveCopyTreeNode(copyToDirentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,7 +1123,6 @@ class LibContentView extends React.Component {
|
|||||||
this.loadDirentList(this.state.path);
|
this.loadDirentList(this.state.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repoID === destRepo.repo_id) {
|
|
||||||
let message = gettext('Successfully copied %(name)s.');
|
let message = gettext('Successfully copied %(name)s.');
|
||||||
message = message.replace('%(name)s', dirName);
|
message = message.replace('%(name)s', dirName);
|
||||||
toaster.success(message);
|
toaster.success(message);
|
||||||
|
Loading…
Reference in New Issue
Block a user