Allow navigation to folders from search results (#1209)

* Allow navigation to folders from search results

- Uses router to pass ID of the folder
- Modified document list component to accept folder ID without path
- Current limitations
  - Breadcrumb cannot currently be shown when navigating via folder id
  - Clicking between folders does not update the current route

* Allow root folder ID to be changed and have documentlist reload

- e.g switching from Company home to My Files

* New tests for navigating to folders based on ID

Refs #666
This commit is contained in:
Will Abson
2016-12-13 09:30:58 +00:00
committed by Denys Vuika
parent a8ef1f8e4e
commit b34a38fcff
21 changed files with 370 additions and 151 deletions

View File

@@ -31,7 +31,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
ERR_ROW_NOT_FOUND: string = 'Row not found';
ERR_COL_NOT_FOUND: string = 'Column not found';
DEFAULT_ROOT_PATH: string = '-root-';
DEFAULT_ROOT_ID: string = '-root-';
DEFAULT_DATE_FORMAT: string = 'medium';
DEFAULT_PAGE_SIZE: number = 20;
MIN_PAGE_SIZE: number = 5;
@@ -53,7 +53,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
thumbnails: boolean = false;
dataLoaded: DataLoadedEventEmitter;
rootPath: string = this.DEFAULT_ROOT_PATH;
rootFolderId: string = this.DEFAULT_ROOT_ID;
constructor(private documentListService: DocumentListService,
private basePath: string,
@@ -210,7 +210,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
.getFolder(path, {
maxItems: this._maxItems,
skipCount: this._skipCount,
rootPath: this.rootPath
rootFolderId: this.rootFolderId
})
.subscribe(val => {
this.currentPath = path;
@@ -228,6 +228,30 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
}
loadById(id: string): Promise<any> {
return new Promise((resolve, reject) => {
if (id && this.documentListService) {
this.documentListService
.getFolder(null, {
maxItems: this._maxItems,
skipCount: this._skipCount,
rootFolderId: id
})
.subscribe(val => {
this.loadPage(<NodePaging>val);
this.dataLoaded.emit(null);
resolve(true);
},
error => {
reject(error);
});
} else {
resolve(false);
}
});
}
setFilter(filter: RowFilter) {
this.filter = filter;