From 82c1621edd33b66124188bb1409abc390de587e7 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Sat, 14 May 2016 21:21:55 +0100 Subject: [PATCH] #46 refresh documentList after file uploaded --- .../app/components/files/files.component.html | 5 ++-- .../app/components/files/files.component.ts | 12 +++++--- .../src/components/document-list.ts | 29 +++++++++++++++++-- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/demo-shell-ng2/app/components/files/files.component.html b/demo-shell-ng2/app/components/files/files.component.html index f4374299bf..d654a5fd37 100644 --- a/demo-shell-ng2/app/components/files/files.component.html +++ b/demo-shell-ng2/app/components/files/files.component.html @@ -1,5 +1,6 @@ - - + + = new EventEmitter(); rootFolder = { - name: 'Document Library', - path: 'Sites/swsdp/documentLibrary' + name: '', + path: '' }; - currentFolderPath: string = 'swsdp/documentLibrary'; + + @Input() + currentFolderPath: string; + folder: NodePaging; errorMessage; @@ -81,11 +86,26 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit constructor(private _alfrescoService: AlfrescoService) { } + _createRootFolder(): Object { + let folderArray = this.currentFolderPath.split('/'); + let nameFolder = folderArray[folderArray.length -1] ; + return { + name: nameFolder, + path: this.currentFolderPath + }; + } + ngOnInit() { + this.currentFolderPath = this.currentFolderPath || this.DEFAULT_ROOT_FOLDER; + this.rootFolder = this._createRootFolder(); this.route.push(this.rootFolder); this.displayFolderContent(this.rootFolder.path); } + ngOnChanges(change) { + this.reload(this.currentFolderPath); + } + ngAfterContentInit() { if (!this.columns || this.columns.length === 0) { this.setupDefaultColumns(); @@ -132,6 +152,9 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit this.route.pop(); let parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; if (parent) { + this.folderClick.emit({ + value: parent.path + }); this.displayFolderContent(parent.path); } }