[ADF-2065] Refactored Content node selector component (#2778)

* [ADF-2065] created dialog component for content node selector

* [ADF-2065] removing SiteModel from site dropdown to use SitePaging model of js-api

* [ADF-2065] - removed site model and updated documentation

* [ADF-2065] fixed test for site component

* [ADF-2065] refactored content node selector and created content node selector dialog

* [ADF-2065] fixed test on site-api service

* [ADF-2065] added a new content node dialog service to centralise the logic for content node dialog

* [ADF-2065] start adding test for node-actions service|

* [ADF-2065] added test for node-actions service

* [ADF-2065] added test for node action service

* [ADF-2065] renamed components to keep backward compatibility

* [ADF-2065] added input just for backward compatibility

* [ADF-2065] added some changes for backward compatibility and updated documentation

* [ADF-2065] updated documentation for content node selector
This commit is contained in:
Vito
2017-12-14 12:36:08 +00:00
committed by Eugenio Romano
parent d489dd175a
commit 9afa632148
35 changed files with 2028 additions and 1526 deletions

View File

@@ -9,8 +9,8 @@
[(ngModel)]="siteSelected"
(ngModelChange)="selectedSite()">
<mat-option *ngIf="!hideMyFiles" data-automation-id="site-my-files-option" id="default_site_option" [value]="MY_FILES_VALUE">{{'DROPDOWN.MY_FILES_OPTION' | translate}}</mat-option>
<mat-option *ngFor="let site of siteList" [value]="site.guid">
{{ site.title | translate }}
<mat-option *ngFor="let site of siteList?.list.entries" [value]="site.entry.guid">
{{ site.entry.title | translate}}
</mat-option>
</mat-select>
</mat-form-field>

View File

@@ -171,7 +171,25 @@ describe('DropdownSitesComponent', () => {
}));
it('should load custom sites when the \'siteList\' input property is given a value', async(() => {
component.siteList = [{title: 'PERSONAL_FILES', guid: '-my-'}, {title: 'FILE_LIBRARIES', guid: '-mysites-'}];
component.siteList = {
'list': {
'entries': [
{
'entry': {
'guid': '-my-',
'title': 'PERSONAL_FILES'
}
},
{
'entry': {
'guid': '-mysites-',
'title': 'FILE_LIBRARIES'
}
}
]
}
};
fixture.detectChanges();
openSelectbox();
@@ -236,7 +254,7 @@ describe('DropdownSitesComponent', () => {
});
component.change.subscribe((site) => {
expect(site.guid).toBe('fake-1');
expect(site.entry.guid).toBe('fake-1');
done();
});
});

View File

@@ -15,7 +15,8 @@
* limitations under the License.
*/
import { SiteModel, SitesService } from '@alfresco/adf-core';
import { SitesService } from '@alfresco/adf-core';
import { SitePaging, SiteEntry } from 'alfresco-js-api';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
@Component({
@@ -29,13 +30,13 @@ export class DropdownSitesComponent implements OnInit {
hideMyFiles: boolean = false;
@Input()
siteList: any[] = null;
siteList: SitePaging = null;
@Input()
placeholder: string = 'DROPDOWN.PLACEHOLDER_LABEL';
@Output()
change: EventEmitter<SiteModel> = new EventEmitter();
change: EventEmitter<SiteEntry> = new EventEmitter();
public MY_FILES_VALUE = 'default';
@@ -52,15 +53,14 @@ export class DropdownSitesComponent implements OnInit {
selectedSite() {
let siteFound;
if (this.siteSelected === this.MY_FILES_VALUE) {
siteFound = new SiteModel();
siteFound = { entry: {}};
}else {
siteFound = this.siteList.find( site => site.guid === this.siteSelected);
siteFound = this.siteList.list.entries.find( site => site.entry.guid === this.siteSelected);
}
this.change.emit(siteFound);
}
setDefaultSiteList() {
this.siteList = [];
this.sitesService.getSites().subscribe((result) => {
this.siteList = result;
},