[ADF-3606] added extra icon for special folders and fixed link navigation folder (#3960)

* [ADF-3606] added extra icon for special folders

* [ADF-3606] changed icons and added tests

* [ADF-3606] added navigation via linked folder

* [ADF-3606] fixed problem in test

* [ADF-3606] added extra documentation

* [ADF-3606] fixed problem with folderchange event
This commit is contained in:
Vito
2018-11-19 12:29:26 +00:00
committed by Eugenio Romano
parent a18b1c1579
commit 2fcec4f235
10 changed files with 151 additions and 8 deletions

View File

@@ -720,6 +720,18 @@ describe('DocumentList', () => {
expect(documentList.performNavigation(null)).toBeFalsy();
});
it('should perform navigation through corret linked folder', () => {
let linkFolder = new FolderNode();
linkFolder.entry.id = 'link-folder';
linkFolder.entry.nodeType = 'app:folderlink';
linkFolder.entry.properties['cm:destination'] = 'normal-folder';
spyOn(documentList, 'loadFolder').and.stub();
expect(documentList.performNavigation(linkFolder)).toBeTruthy();
expect(documentList.currentFolderId).toBe('normal-folder');
});
it('should require valid node for file preview', () => {
let file = new FileNode();
file.entry = null;
@@ -977,6 +989,16 @@ describe('DocumentList', () => {
documentList.loadFolderByNodeId('123');
});
it('should emit folderChange event when a folder node is clicked', (done) => {
spyOn(documentList, 'reload').and.stub();
documentList.folderChange.subscribe((folderNode) => {
expect(folderNode.value.id).toBe('fake-node');
done();
});
documentList.onNodeDblClick({ entry: { id: 'fake-node', isFolder: true } });
});
it('should set no permission when getFolderNode fails with 403', (done) => {
const error = { message: '{ "error": { "statusCode": 403 } }' };
spyOn(documentListService, 'getFolderNode').and.returnValue(throwError(error));

View File

@@ -539,9 +539,18 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
updateFolderData(node: MinimalNodeEntity): void {
this.resetNewFolderPagination();
this.currentFolderId = node.entry.id;
this.currentFolderId = this.getNodeFolderDestinationId(node);
this.folderChange.emit(new NodeEntryEvent({ id: this.currentFolderId }));
this.reload();
this.folderChange.emit(new NodeEntryEvent(node.entry));
}
private getNodeFolderDestinationId(node: MinimalNodeEntity) {
return this.isLinkFolder(node) ? node.entry.properties['cm:destination'] : node.entry.id;
}
private isLinkFolder(node: MinimalNodeEntity) {
return node.entry.nodeType === 'app:folderlink' && node.entry.properties &&
node.entry.properties['cm:destination'];
}
updateCustomSourceData(nodeId: string): void {