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

@@ -30,6 +30,8 @@ export class DocumentListService {
static DEFAULT_MIME_TYPE_ICON: string = 'ft_ic_miscellaneous.svg';
static ROOT_ID = '-root-';
mimeTypeIcons: any = {
'image/png': 'ft_ic_raster_image.svg',
'image/jpeg': 'ft_ic_raster_image.svg',
@@ -63,17 +65,21 @@ export class DocumentListService {
}
private getNodesPromise(folder: string, opts?: any): Promise<NodePaging> {
let rootPath = '-root-';
if (opts && opts.rootPath) {
rootPath = opts.rootPath;
let rootNodeId = DocumentListService.ROOT_ID;
if (opts && opts.rootFolderId) {
rootNodeId = opts.rootFolderId;
}
let params: any = {
relativePath: folder,
includeSource: true,
include: ['path', 'properties']
};
if (folder) {
params.relativePath = folder;
}
if (opts) {
if (opts.maxItems) {
params.maxItems = opts.maxItems;
@@ -83,7 +89,7 @@ export class DocumentListService {
}
}
return this.apiService.getInstance().nodes.getNodeChildren(rootPath, params);
return this.apiService.getInstance().nodes.getNodeChildren(rootNodeId, params);
}
deleteNode(nodeId: string): Observable<any> {
@@ -105,7 +111,7 @@ export class DocumentListService {
}
/**
* Gets the folder node with the content.
* Gets the folder node with the specified relative name path below the root node.
* @param folder Path to folder.
* @param opts Options.
* @returns {Observable<NodePaging>} Folder entity.