[ACA-1054] [Destination picker] File Libraries list should be sorted … (#132)

* [ACA-1054] [Destination picker] File Libraries list should be sorted by name

manipulate the content-node-selector component from ACA by using the matDialogRef.componentInstance

* [ACA-1054] fix node-actions.service tests
This commit is contained in:
suzanadirla
2017-12-12 13:26:24 +02:00
committed by Denys Vuika
parent b99c99c27c
commit d834e7d628
2 changed files with 18 additions and 6 deletions

View File

@@ -263,7 +263,7 @@ describe('NodeActionsService', () => {
const dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.callFake((contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data;
return {};
return {componentInstance: {}};
});
service.copyNodes([fileToCopy, folderToCopy]);
@@ -316,7 +316,7 @@ describe('NodeActionsService', () => {
const dialog = TestBed.get(MatDialog);
const spyOnDialog = spyOn(dialog, 'open').and.callFake((contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data;
return {};
return {componentInstance: {}};
});
service.copyNodes([fileToCopy, folderToCopy]);
@@ -343,7 +343,7 @@ describe('NodeActionsService', () => {
const dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.callFake((contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data;
return {};
return {componentInstance: {}};
});
service.copyNodes([{entry: {id: 'entry-id', name: 'entry-name'}}]);
@@ -362,7 +362,7 @@ describe('NodeActionsService', () => {
const dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.callFake((contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data;
return {};
return {componentInstance: {}};
});
service.copyNodes([{entry: {id: 'entry-id'}}]);

View File

@@ -27,7 +27,7 @@ import { EventEmitter, Injectable } from '@angular/core';
import { MatDialog } from '@angular/material';
import { Observable, Subject } from 'rxjs/Rx';
import { AlfrescoApiService, ContentService, NodesApiService, DataColumn } from '@alfresco/adf-core';
import { AlfrescoApiService, ContentService, NodesApiService, DataColumn, DataSorting } from '@alfresco/adf-core';
import { DocumentListService, ContentNodeSelectorComponent, ContentNodeSelectorComponentData } from '@alfresco/adf-content-services';
import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
@@ -194,11 +194,23 @@ export class NodeActionsService {
select: new EventEmitter<MinimalNodeEntryEntity[]>()
};
this.dialog.open(ContentNodeSelectorComponent, <any>{
const matDialogRef = this.dialog.open(ContentNodeSelectorComponent, <any>{
data,
panelClass: 'adf-content-node-selector-dialog',
width: '630px'
});
const destinationPicker = matDialogRef.componentInstance;
const initialSiteChanged = destinationPicker.siteChanged;
destinationPicker.siteChanged = (chosenSite) => {
initialSiteChanged.call(destinationPicker, chosenSite);
if (chosenSite.guid === '-mysites-') {
destinationPicker.documentList.data.setSorting(new DataSorting('title', 'asc'));
} else {
destinationPicker.documentList.data.setSorting(new DataSorting('name', 'asc'));
}
};
return data.select;
}