[ACA] improve reload on upload (#450)

This commit is contained in:
Suzana Dirla 2018-06-22 17:32:57 +03:00 committed by Denys Vuika
parent daf7082079
commit 5d9eb2f94d

View File

@ -172,8 +172,34 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
// check the child nodes to show dropped folder
if (event && event.file.options.parentId === this.getParentNodeId()) {
this.documentList.reload();
this.displayFolderParent(event.file.options.path, 0);
return;
}
if (event && event.file.options.parentId) {
if (this.nodePath) {
const correspondingNodePath = this.nodePath.find(pathItem => pathItem.id === event.file.options.parentId);
// check if the current folder has the 'trigger-upload-folder' as one of its parents
if (correspondingNodePath) {
const correspondingIndex = this.nodePath.length - this.nodePath.indexOf(correspondingNodePath);
this.displayFolderParent(event.file.options.path, correspondingIndex);
}
}
}
}
displayFolderParent(filePath = '', index) {
const parentName = filePath.split('/')[index];
const currentFoldersDisplayed: any = this.documentList.data.getRows() || [];
const alreadyDisplayedParentFolder = currentFoldersDisplayed.find(
row => row.node.entry.isFolder && row.node.entry.name === parentName);
if (alreadyDisplayedParentFolder) {
return;
}
this.documentList.reload();
}
onContentCopied(nodes: MinimalNodeEntity[]) {