mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
committed by
Eugenio Romano
parent
a31803a6bb
commit
0d6c1bedfa
@@ -68,7 +68,6 @@
|
|||||||
[where]="where"
|
[where]="where"
|
||||||
(folderChange)="onFolderChange()"
|
(folderChange)="onFolderChange()"
|
||||||
(ready)="onFolderLoaded()"
|
(ready)="onFolderLoaded()"
|
||||||
(node-dblclick)="onNodeDoubleClick($event)"
|
|
||||||
data-automation-id="content-node-selector-document-list">
|
data-automation-id="content-node-selector-document-list">
|
||||||
|
|
||||||
<adf-custom-empty-content-template>
|
<adf-custom-empty-content-template>
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { AlfrescoApiService, HighlightDirective, UserPreferencesService, PaginationModel } from '@alfresco/adf-core';
|
import { HighlightDirective, UserPreferencesService, PaginationModel } from '@alfresco/adf-core';
|
||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { Node, NodePaging, Pagination, SiteEntry, SitePaging } from '@alfresco/js-api';
|
import { Node, NodePaging, Pagination, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||||
import { DocumentListComponent } from '../document-list/components/document-list.component';
|
import { DocumentListComponent } from '../document-list/components/document-list.component';
|
||||||
@@ -27,7 +27,6 @@ import { debounceTime } from 'rxjs/operators';
|
|||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { CustomResourcesService } from '../document-list/services/custom-resources.service';
|
import { CustomResourcesService } from '../document-list/services/custom-resources.service';
|
||||||
import { ShareDataRow } from '../document-list';
|
import { ShareDataRow } from '../document-list';
|
||||||
import { NodeEntry } from '@alfresco/js-api/src/api/content-rest-api/model/nodeEntry';
|
|
||||||
|
|
||||||
export type ValidationFunction = (entry: Node) => boolean;
|
export type ValidationFunction = (entry: Node) => boolean;
|
||||||
|
|
||||||
@@ -148,7 +147,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
|
|||||||
searchInput: FormControl = new FormControl();
|
searchInput: FormControl = new FormControl();
|
||||||
|
|
||||||
constructor(private contentNodeSelectorService: ContentNodeSelectorService,
|
constructor(private contentNodeSelectorService: ContentNodeSelectorService,
|
||||||
private apiService: AlfrescoApiService,
|
|
||||||
private customResourcesService: CustomResourcesService,
|
private customResourcesService: CustomResourcesService,
|
||||||
private preferences: UserPreferencesService) {
|
private preferences: UserPreferencesService) {
|
||||||
this.searchInput.valueChanges
|
this.searchInput.valueChanges
|
||||||
@@ -389,21 +387,4 @@ export class ContentNodeSelectorPanelComponent implements OnInit {
|
|||||||
onNodeSelect(event: any): void {
|
onNodeSelect(event: any): void {
|
||||||
this.attemptNodeSelection(event.detail.node.entry);
|
this.attemptNodeSelection(event.detail.node.entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNodeDoubleClick(customEvent: CustomEvent) {
|
|
||||||
const node: any = customEvent.detail.node.entry;
|
|
||||||
|
|
||||||
if (node && node.guid) {
|
|
||||||
const options = {
|
|
||||||
maxItems: this.pageSize,
|
|
||||||
skipCount: this.skipCount,
|
|
||||||
include: ['path', 'properties', 'allowableOperations']
|
|
||||||
};
|
|
||||||
|
|
||||||
this.apiService.nodesApi.getNode(node.guid, options)
|
|
||||||
.then((nodeEntry: NodeEntry) => {
|
|
||||||
this.documentList.navigateTo(nodeEntry.entry);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1023,7 +1023,7 @@ describe('DocumentList', () => {
|
|||||||
expect(documentList.noPermission).toBeTruthy();
|
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 sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-mysites-', '-favorites-', '-recent-'];
|
||||||
const node = new FolderNode('folder');
|
const node = new FolderNode('folder');
|
||||||
|
|
||||||
@@ -1032,7 +1032,7 @@ describe('DocumentList', () => {
|
|||||||
|
|
||||||
sources.forEach((source) => {
|
sources.forEach((source) => {
|
||||||
documentList.currentFolderId = source;
|
documentList.currentFolderId = source;
|
||||||
expect(documentList.canNavigateFolder(node.entry)).toBeFalsy();
|
expect(documentList.canNavigateFolder(node.entry)).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -40,7 +40,8 @@ import {
|
|||||||
CustomLoadingContentTemplateDirective,
|
CustomLoadingContentTemplateDirective,
|
||||||
CustomNoPermissionTemplateDirective,
|
CustomNoPermissionTemplateDirective,
|
||||||
CustomEmptyContentTemplateDirective,
|
CustomEmptyContentTemplateDirective,
|
||||||
RequestPaginationModel
|
RequestPaginationModel,
|
||||||
|
AlfrescoApiService
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
|
|
||||||
import { Node, NodeEntry, NodePaging } from '@alfresco/js-api';
|
import { Node, NodeEntry, NodePaging } from '@alfresco/js-api';
|
||||||
@@ -283,7 +284,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
private preferences: UserPreferencesService,
|
private preferences: UserPreferencesService,
|
||||||
private customResourcesService: CustomResourcesService,
|
private customResourcesService: CustomResourcesService,
|
||||||
private contentService: ContentService,
|
private contentService: ContentService,
|
||||||
private thumbnailService: ThumbnailService) {
|
private thumbnailService: ThumbnailService,
|
||||||
|
private alfrescoApiService: AlfrescoApiService) {
|
||||||
|
|
||||||
this._pagination = <PaginationModel> {
|
this._pagination = <PaginationModel> {
|
||||||
maxItems: this.maxItems || this.preferences.paginationSize,
|
maxItems: this.maxItems || this.preferences.paginationSize,
|
||||||
@@ -716,6 +718,17 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
if (nodeEntry.entry.isFolder) {
|
if (nodeEntry.entry.isFolder) {
|
||||||
this.navigateTo(nodeEntry.entry);
|
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 {
|
canNavigateFolder(node: Node): boolean {
|
||||||
let canNavigateFolder: boolean = false;
|
let canNavigateFolder: boolean = false;
|
||||||
|
|
||||||
if (this.customResourcesService.isCustomSource(this.currentFolderId)) {
|
if (node && node.isFolder) {
|
||||||
canNavigateFolder = false;
|
|
||||||
} else if (node && node.isFolder) {
|
|
||||||
canNavigateFolder = true;
|
canNavigateFolder = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user