[ADF-4027] fix navigation to custom sources (#4273)

* [ADF-4027] fix navigation to custom sources

* [ADF-4027] code cleanup

* [ADF-4027] allow to perform navigation for custom sources

* [ADF-4027] disable old test

* [ADF-4027] perform site navigation on document-list

* [ADF-4027] update test
This commit is contained in:
Suzana Dirla
2019-02-06 21:07:51 +02:00
committed by Eugenio Romano
parent a31803a6bb
commit 0d6c1bedfa
4 changed files with 19 additions and 28 deletions

View File

@@ -1023,7 +1023,7 @@ describe('DocumentList', () => {
expect(documentList.noPermission).toBeTruthy();
});
it('should not perform navigation for virtual sources', () => {
it('should allow to perform navigation for virtual sources', () => {
const sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-mysites-', '-favorites-', '-recent-'];
const node = new FolderNode('folder');
@@ -1032,7 +1032,7 @@ describe('DocumentList', () => {
sources.forEach((source) => {
documentList.currentFolderId = source;
expect(documentList.canNavigateFolder(node.entry)).toBeFalsy();
expect(documentList.canNavigateFolder(node.entry)).toBeTruthy();
});
});

View File

@@ -40,7 +40,8 @@ import {
CustomLoadingContentTemplateDirective,
CustomNoPermissionTemplateDirective,
CustomEmptyContentTemplateDirective,
RequestPaginationModel
RequestPaginationModel,
AlfrescoApiService
} from '@alfresco/adf-core';
import { Node, NodeEntry, NodePaging } from '@alfresco/js-api';
@@ -283,7 +284,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
private preferences: UserPreferencesService,
private customResourcesService: CustomResourcesService,
private contentService: ContentService,
private thumbnailService: ThumbnailService) {
private thumbnailService: ThumbnailService,
private alfrescoApiService: AlfrescoApiService) {
this._pagination = <PaginationModel> {
maxItems: this.maxItems || this.preferences.paginationSize,
@@ -716,6 +718,17 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
if (nodeEntry.entry.isFolder) {
this.navigateTo(nodeEntry.entry);
}
if (nodeEntry.entry['guid']) {
const options = {
include: this.includeFields
};
this.alfrescoApiService.nodesApi.getNode(nodeEntry.entry['guid'], options)
.then((node: NodeEntry) => {
this.navigateTo(node.entry);
});
}
}
}
@@ -781,9 +794,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
canNavigateFolder(node: Node): boolean {
let canNavigateFolder: boolean = false;
if (this.customResourcesService.isCustomSource(this.currentFolderId)) {
canNavigateFolder = false;
} else if (node && node.isFolder) {
if (node && node.isFolder) {
canNavigateFolder = true;
}