1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

File move to list view and inaccurate refresh after moving

This commit is contained in:
zxj96
2019-05-05 17:20:37 +08:00
parent 7c1cacc9ed
commit 00c35d011f
4 changed files with 72 additions and 5 deletions

View File

@@ -306,6 +306,7 @@ class LibContentView extends React.Component {
// update data
this.loadDirentList(path);
this.resetShowLength();
if (!this.isNeedUpdateHistoryState) {
this.isNeedUpdateHistoryState = true;
@@ -405,7 +406,6 @@ class LibContentView extends React.Component {
if (!this.state.repoEncrypted && direntList.length) {
this.getThumbnails(repoID, path, this.state.direntList);
}
this.resetShowLength();
}).catch(() => {
this.setState({
isDirentListLoading: false,
@@ -729,12 +729,12 @@ class LibContentView extends React.Component {
nodeParentPath = this.state.path;
}
let direntPath = Utils.joinPath(nodeParentPath, dirName);
seafileAPI.moveDir(repoID, destRepo.repo_id,moveToDirentPath, nodeParentPath, dirName).then(res => {
seafileAPI.moveDir(repoID, destRepo.repo_id, moveToDirentPath, nodeParentPath, dirName).then(res => {
let nodeName = res.data[0].obj_name;
if (this.state.currentMode === 'column') {
this.moveTreeNode(direntPath, moveToDirentPath, destRepo, nodeName);
}
this.moveDirent(direntPath);
this.moveDirent(direntPath, moveToDirentPath);
let message = gettext('Successfully moved %(name)s.');
message = message.replace('%(name)s', dirName);
@@ -996,8 +996,12 @@ class LibContentView extends React.Component {
// else do nothing
}
moveDirent = (direntPath) => {
moveDirent = (direntPath, moveToDirentPath=null) => {
let name = direntPath.slice(direntPath.lastIndexOf('/') + 1);
if (moveToDirentPath === this.state.path) {
this.loadDirentList(this.state.path)
return;
}
let direntList = this.state.direntList.filter(item => {
return item.name !== name;
});