[ADF-1873] Remove all deprecated code from ADF (#4145)

* remove deprecated code part 1

* remove deprecation step 2

* fix spellcheck

* fix

* fix lint

* fix not used import

* remove deprecation

* fix test first part after remove deprecation

* fix test

* fix sidebar demo shell
This commit is contained in:
Eugenio Romano
2019-01-15 15:36:01 +00:00
committed by GitHub
parent 24a7c939e6
commit 7d061b2c11
109 changed files with 351 additions and 1106 deletions
@@ -1,15 +1,15 @@
<header
mat-dialog-title
data-automation-id="content-node-selector-title">{{title || data?.title}}
data-automation-id="content-node-selector-title">{{data?.title}}
</header>
<mat-dialog-content>
<adf-content-node-selector-panel
[currentFolderId]="currentFolderId || data?.currentFolderId"
[dropdownHideMyFiles]="dropdownHideMyFiles || data?.dropdownHideMyFiles"
[dropdownSiteList]="dropdownSiteList || data?.dropdownSiteList"
[rowFilter]="rowFilter || data?.rowFilter"
[imageResolver]="imageResolver || data?.imageResolver"
[currentFolderId]="data?.currentFolderId"
[dropdownHideMyFiles]="data?.dropdownHideMyFiles"
[dropdownSiteList]="data?.dropdownSiteList"
[rowFilter]="data?.rowFilter"
[imageResolver]="data?.imageResolver"
[isSelectionValid]="data?.isSelectionValid"
[breadcrumbTransform]="data?.breadcrumbTransform"
[excludeSiteContent]="data?.excludeSiteContent"
@@ -15,12 +15,10 @@
* limitations under the License.
*/
import { Component, Inject, ViewEncapsulation, Input } from '@angular/core';
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { Node, SitePaging } from '@alfresco/js-api';
import { Node } from '@alfresco/js-api';
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
import { RowFilter } from '../document-list/data/row-filter.model';
import { ImageResolver } from '../document-list/data/image-resolver.model';
@Component({
selector: 'adf-content-node-selector',
@@ -30,48 +28,6 @@ import { ImageResolver } from '../document-list/data/image-resolver.model';
})
export class ContentNodeSelectorComponent {
/**
* @deprecated in 2.1.0
*/
@Input()
title: string = null;
/**
* @deprecated in 2.1.0
*/
@Input()
currentFolderId: string = null;
/**
* @deprecated in 2.1.0
*/
@Input()
dropdownHideMyFiles: boolean = false;
/**
* @deprecated in 2.1.0
*/
@Input()
dropdownSiteList: SitePaging = null;
/**
* @deprecated in 2.1.0
*/
@Input()
rowFilter: RowFilter = null;
/**
* @deprecated in 2.1.0
*/
@Input()
imageResolver: ImageResolver = null;
/**
* @deprecated in 2.1.0
*/
@Input()
pageSize: number;
buttonActionName: string;
chosenNode: Node[];
@@ -147,7 +147,7 @@ describe('ShareDialogComponent', () => {
it('should open a confirmation dialog when unshare button is triggered', () => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink');
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = {
@@ -167,7 +167,7 @@ describe('ShareDialogComponent', () => {
it('should unshare file when confirmation dialog returns true', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(true) });
spyOn(sharedLinksApiService, 'deleteSharedLink');
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = {
@@ -187,7 +187,7 @@ describe('ShareDialogComponent', () => {
it('should not unshare file when confirmation dialog returns false', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink');
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = {
@@ -72,6 +72,7 @@ describe('DocumentList', () => {
customResourcesService = TestBed.get(CustomResourcesService);
documentList.ngOnInit();
documentList.currentFolderId = 'no-node';
spyGetSites = spyOn(apiService.sitesApi, 'getSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
spyFavorite = spyOn(apiService.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve({ list: [] }));
@@ -246,20 +247,17 @@ describe('DocumentList', () => {
expect(documentList.dataTable.resetSelection).toHaveBeenCalled();
});
it('should empty template be present when no element are present', (done) => {
fixture.detectChanges();
documentList.folderNode = new NodeMinimal();
documentList.folderNode.id = '1d26e465-dea3-42f3-b415-faa8364b9692';
it('should empty template be present when no element are present', () => {
spyOn(documentList, 'loadFolderNodesByFolderNodeId').and.returnValue(Promise.resolve(''));
spyOn(documentList, 'loadFolder').and.callThrough();
spyOn(documentListService, 'getFolderNode').and.returnValue(of({ entry: { id: 'fake-node' } }));
spyOn(documentListService, 'getFolder').and.returnValue(of(fakeNodeAnswerWithNOEntries));
let disposableReady = documentList.ready.subscribe(() => {
expect(element.querySelector('#adf-document-list-empty')).toBeDefined();
disposableReady.unsubscribe();
done();
});
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
fixture.detectChanges();
documentList.reload();
expect(element.querySelector('#adf-document-list-empty')).toBeDefined();
});
it('should not execute action without node provided', () => {
@@ -959,10 +957,9 @@ describe('DocumentList', () => {
});
it('should load folder by ID on init', () => {
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve());
documentList.ngOnChanges({ folderNode: new SimpleChange(null, documentList.currentFolderId, true) });
documentList.ngOnChanges({ currentFolderId: new SimpleChange(null, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
expect(documentList.loadFolder).toHaveBeenCalled();
});
@@ -1294,7 +1291,6 @@ describe('DocumentList', () => {
spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 0;
documentList.skipCount = 0;
documentList.updatePagination({
maxItems: 10,
@@ -1313,32 +1309,6 @@ describe('DocumentList', () => {
expect(documentList.reload).not.toHaveBeenCalled();
});
it('should NOT reload data on ngOnChanges upon reset of skipCount to 0', () => {
spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 10;
documentList.skipCount = 10;
const firstChange = true;
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 0, !firstChange) });
expect(documentList.reload).not.toHaveBeenCalled();
});
it('should reload data upon changing pagination setting skipCount to 0', () => {
spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 5;
documentList.skipCount = 5;
documentList.updatePagination({
maxItems: 5,
skipCount: 0
});
expect(documentList.reload).toHaveBeenCalled();
});
it('should add includeFields in the server request when present', () => {
fixture.detectChanges();
documentList.currentFolderId = 'fake-id';
@@ -173,13 +173,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
currentFolderId: string = null;
/**
* Currently displayed folder node
* @deprecated 2.3.0 - use currentFolderId or node
*/
@Input()
folderNode: Node = null;
/** The Document list will show all the nodes contained in the NodePaging entity */
@Input()
node: NodePaging = null;
@@ -188,20 +181,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
maxItems: number;
/**
* Number of elements to skip over for pagination purposes
* @deprecated 2.3.0 - define it in pagination
*/
@Input()
skipCount: number = 0;
/**
* Set document list to work in infinite scrolling mode
* @deprecated 2.3.0
*/
@Input()
enableInfiniteScrolling: boolean = false;
/** Emitted when the user clicks a list node */
@Output()
nodeClick: EventEmitter<NodeEntityEvent> = new EventEmitter<NodeEntityEvent>();
@@ -239,6 +218,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
data: ShareDataTableAdapter;
noPermission: boolean = false;
selection = new Array<NodeEntry>();
folderNode: Node = null;
private _pagination: BehaviorSubject<PaginationModel>;
private layoutPresets = {};
@@ -272,11 +252,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
return null;
}
/** @deprecated 2.3.0 define it in pagination */
get supportedPageSizes(): number[] {
return this.preferences.getDefaultPageSizes();
}
get hasCustomLayout(): boolean {
return this.columnList && this.columnList.columns && this.columnList.columns.length > 0;
}
@@ -296,7 +271,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
get pagination(): BehaviorSubject<PaginationModel> {
if (!this._pagination) {
let maxItems = this.maxItems || this.preferences.paginationSize;
let maxItems = this.maxItems || this.preferences.paginationSize;
let defaultPagination = <PaginationModel> {
maxItems: maxItems,
skipCount: 0,
@@ -337,7 +312,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
ngOnInit() {
this.rowMenuCache = {};
this.loadLayoutPresets();
this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, null, this.getDefaultSorting(), this.sortingMode);
this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, this.contentService, null, this.getDefaultSorting(), this.sortingMode);
this.data.thumbnails = this.thumbnails;
this.data.permissionsStyle = this.permissionsStyle;
@@ -375,7 +350,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
if (!this.data) {
this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, schema, this.getDefaultSorting(), this.sortingMode);
this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, this.contentService, schema, this.getDefaultSorting(), this.sortingMode);
} else if (schema && schema.length > 0) {
this.data.setColumns(schema);
}
@@ -404,11 +379,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
}
if (changes.folderNode && changes.folderNode.currentValue) {
this.currentFolderId = changes.folderNode.currentValue.id;
this.resetNewFolderPagination();
this.loadFolder();
} else if (changes.currentFolderId &&
if (changes.currentFolderId &&
changes.currentFolderId.currentValue &&
changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) {
this.resetNewFolderPagination();
@@ -600,12 +571,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
this.setupDefaultColumns(this.currentFolderId);
}
if (this.folderNode) {
return this.loadFolderNodesByFolderNodeId(this.folderNode.id, this.pagination.getValue())
.catch((err) => this.handleError(err));
} else {
this.loadFolderByNodeId(this.currentFolderId);
}
this.loadFolderByNodeId(this.currentFolderId);
}
loadFolderByNodeId(nodeId: string) {
@@ -15,10 +15,9 @@
* limitations under the License.
*/
import { DataRow, ObjectUtils, ThumbnailService } from '@alfresco/adf-core';
import { DataRow, ObjectUtils, ThumbnailService, ContentService } from '@alfresco/adf-core';
import { MinimalNode, NodeEntry } from '@alfresco/js-api';
import { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service';
export class ShareDataRow implements DataRow {
@@ -34,7 +33,7 @@ export class ShareDataRow implements DataRow {
}
constructor(private obj: NodeEntry,
private documentListService: DocumentListService,
private contentService: ContentService,
private permissionsStyle: PermissionStyleModel[],
private thumbnailService?: ThumbnailService) {
if (!obj) {
@@ -55,7 +54,7 @@ export class ShareDataRow implements DataRow {
if (this.applyPermissionStyleToFolder(nodeEntity.entry, currentPermissionsStyle) || this.applyPermissionStyleToFile(nodeEntity.entry, currentPermissionsStyle)) {
if (this.documentListService.hasPermission(nodeEntity.entry, currentPermissionsStyle.permission)) {
if (this.contentService.hasPermission(nodeEntity.entry, currentPermissionsStyle.permission)) {
permissionsClasses += ` ${currentPermissionsStyle.css}`;
}
}
@@ -74,7 +73,7 @@ export class ShareDataRow implements DataRow {
}
isFolderAndHasPermissionToUpload(nodeEntry: NodeEntry): boolean {
return this.isFolder(nodeEntry) && this.documentListService.hasPermission(nodeEntry.entry, 'create');
return this.isFolder(nodeEntry) && this.contentService.hasPermission(nodeEntry.entry, 'create');
}
isFolder(nodeEntry: NodeEntry): boolean {
@@ -24,21 +24,22 @@ import { ShareDataTableAdapter } from './share-datatable-adapter';
describe('ShareDataTableAdapter', () => {
let documentListService: DocumentListService;
let contentService: ContentService;
beforeEach(() => {
let imageUrl: string = 'http://<addresss>';
let contentService = new ContentService(null, null, null, null);
contentService = new ContentService(null, null, null, null);
documentListService = new DocumentListService(null, contentService, null, null, null);
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
});
it('should use client sorting by default', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, []);
const adapter = new ShareDataTableAdapter(documentListService, null, contentService, []);
expect(adapter.sortingMode).toBe('client');
});
it('should not be case sensitive for sorting mode value', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, []);
const adapter = new ShareDataTableAdapter(documentListService, null, contentService, []);
adapter.sortingMode = 'CLIENT';
expect(adapter.sortingMode).toBe('client');
@@ -48,7 +49,7 @@ describe('ShareDataTableAdapter', () => {
});
it('should fallback to client sorting for unknown values', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, []);
const adapter = new ShareDataTableAdapter(documentListService, null, contentService, []);
adapter.sortingMode = 'SeRvEr';
expect(adapter.sortingMode).toBe('server');
@@ -59,27 +60,27 @@ describe('ShareDataTableAdapter', () => {
it('should setup rows and columns with constructor', () => {
let schema = [<DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, schema);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, schema);
expect(adapter.getRows()).toEqual([]);
expect(adapter.getColumns()).toEqual(schema);
});
it('should setup columns when constructor is missing schema', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, null);
const adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
expect(adapter.getColumns()).toEqual([]);
});
it('should set new columns', () => {
let columns = [<DataColumn> {}, <DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.setColumns(columns);
expect(adapter.getColumns()).toEqual(columns);
});
it('should reset columns', () => {
let columns = [<DataColumn> {}, <DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, columns);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, columns);
expect(adapter.getColumns()).toEqual(columns);
adapter.setColumns(null);
@@ -88,7 +89,7 @@ describe('ShareDataTableAdapter', () => {
it('should set new rows', () => {
let rows = [<DataRow> {}, <DataRow> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
expect(adapter.getRows()).toEqual([]);
adapter.setRows(rows);
@@ -97,7 +98,7 @@ describe('ShareDataTableAdapter', () => {
it('should reset rows', () => {
let rows = [<DataRow> {}, <DataRow> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.setRows(rows);
expect(adapter.getRows()).toEqual(rows);
@@ -107,7 +108,7 @@ describe('ShareDataTableAdapter', () => {
});
it('should sort new rows', () => {
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
spyOn(adapter, 'sort').and.callThrough();
let rows = [<DataRow> {}];
@@ -117,7 +118,7 @@ describe('ShareDataTableAdapter', () => {
});
it('should fail when getting value for missing row', () => {
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let check = () => {
return adapter.getValue(null, <DataColumn> {});
};
@@ -125,7 +126,7 @@ describe('ShareDataTableAdapter', () => {
});
it('should fail when getting value for missing column', () => {
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let check = () => {
return adapter.getValue(<DataRow> {}, null);
};
@@ -143,8 +144,8 @@ describe('ShareDataTableAdapter', () => {
type: 'string'
};
let row = new ShareDataRow(file, documentListService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let row = new ShareDataRow(file, contentService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let value = adapter.getValue(row, col);
expect(value).toBe(rawValue);
@@ -153,12 +154,12 @@ describe('ShareDataTableAdapter', () => {
it('should generate fallback icon for a file thumbnail with missing mime type', () => {
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode();
file.entry.content.mimeType = null;
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -169,12 +170,12 @@ describe('ShareDataTableAdapter', () => {
it('should generate fallback icon for a file with no content entry', () => {
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode();
file.entry.content = null;
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -188,8 +189,8 @@ describe('ShareDataTableAdapter', () => {
let file = new FileNode();
file.entry['icon'] = imageUrl;
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let row = new ShareDataRow(file, documentListService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: 'icon' };
let value = adapter.getValue(row, col);
@@ -199,9 +200,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new FolderNode(), documentListService, null);
let row = new ShareDataRow(new FolderNode(), contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -212,9 +213,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve smart folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_smart_folder.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new SmartFolderNode(), documentListService, null);
let row = new ShareDataRow(new SmartFolderNode(), contentService, null);
let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -225,9 +226,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve link folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_shortcut_link.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new LinkFolderNode(), documentListService, null);
let row = new ShareDataRow(new LinkFolderNode(), contentService, null);
let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -238,9 +239,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve rule folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_rule.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new RuleFolderNode(), documentListService, null);
let row = new ShareDataRow(new RuleFolderNode(), contentService, null);
let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -250,11 +251,11 @@ describe('ShareDataTableAdapter', () => {
it('should resolve file thumbnail', () => {
let imageUrl = 'http://<addresss>';
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.thumbnails = true;
let file = new FileNode();
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -265,14 +266,14 @@ describe('ShareDataTableAdapter', () => {
it('should resolve fallback file icon for unknown node', () => {
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode();
file.entry.isFile = false;
file.entry.isFolder = false;
file.entry.content = null;
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -282,14 +283,14 @@ describe('ShareDataTableAdapter', () => {
it('should resolve file icon for content type', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_raster_image.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode();
file.entry.isFile = false;
file.entry.isFolder = false;
file.entry.content.mimeType = 'image/png';
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col);
@@ -303,13 +304,13 @@ describe('ShareDataTableAdapter', () => {
let folder = new FolderNode();
let col = <DataColumn> { key: 'name' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setSorting(new DataSorting('name', 'asc'));
adapter.setRows([
new ShareDataRow(file2, documentListService, null),
new ShareDataRow(file1, documentListService, null),
new ShareDataRow(folder, documentListService, null)
new ShareDataRow(file2, contentService, null),
new ShareDataRow(file1, contentService, null),
new ShareDataRow(folder, contentService, null)
]);
let sorted = adapter.getRows();
@@ -326,11 +327,11 @@ describe('ShareDataTableAdapter', () => {
file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2);
let col = <DataColumn> { key: 'dateProp' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([
new ShareDataRow(file2, documentListService, null),
new ShareDataRow(file1, documentListService, null)
new ShareDataRow(file2, contentService, null),
new ShareDataRow(file1, contentService, null)
]);
adapter.sort('dateProp', 'asc');
@@ -356,13 +357,13 @@ describe('ShareDataTableAdapter', () => {
file4.entry.content.sizeInBytes = 2852791665; // 2.66 GB
let col = <DataColumn> { key: 'content.sizeInBytes' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([
new ShareDataRow(file3, documentListService, null),
new ShareDataRow(file4, documentListService, null),
new ShareDataRow(file1, documentListService, null),
new ShareDataRow(file2, documentListService, null)
new ShareDataRow(file3, contentService, null),
new ShareDataRow(file4, contentService, null),
new ShareDataRow(file1, contentService, null),
new ShareDataRow(file2, contentService, null)
]);
adapter.sort('content.sizeInBytes', 'asc');
@@ -389,15 +390,15 @@ describe('ShareDataTableAdapter', () => {
let file6 = new FileNode('b');
let col = <DataColumn> { key: 'name' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([
new ShareDataRow(file4, documentListService, null),
new ShareDataRow(file6, documentListService, null),
new ShareDataRow(file3, documentListService, null),
new ShareDataRow(file1, documentListService, null),
new ShareDataRow(file2, documentListService, null),
new ShareDataRow(file5, documentListService, null)
new ShareDataRow(file4, contentService, null),
new ShareDataRow(file6, contentService, null),
new ShareDataRow(file3, contentService, null),
new ShareDataRow(file1, contentService, null),
new ShareDataRow(file2, contentService, null),
new ShareDataRow(file5, contentService, null)
]);
adapter.sort('name', 'asc');
@@ -423,25 +424,25 @@ describe('ShareDataTableAdapter', () => {
it('should wrap node', () => {
let file = new FileNode();
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.node).toBe(file);
});
it('should require object source', () => {
expect(() => {
return new ShareDataRow(null, documentListService, null);
return new ShareDataRow(null, contentService, null);
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
});
it('should resolve value from node entry', () => {
let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.getValue('name')).toBe('test');
});
it('should check value', () => {
let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.hasValue('name')).toBeTruthy();
expect(row.hasValue('missing')).toBeFalsy();
@@ -450,21 +451,21 @@ describe('ShareDataTableAdapter', () => {
it('should be set as drop target when user has permission for that node', () => {
let file = new FolderNode('test');
file.entry['allowableOperations'] = ['create'];
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeTruthy();
});
it('should not be set as drop target when user has permission for that node', () => {
let file = new FolderNode('test');
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeFalsy();
});
it('should not be set as drop target when element is not a Folder', () => {
let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeFalsy();
});
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { DataColumn, DataRow, DataSorting, DataTableAdapter, ThumbnailService } from '@alfresco/adf-core';
import { DataColumn, DataRow, DataSorting, DataTableAdapter, ThumbnailService, ContentService } from '@alfresco/adf-core';
import { NodePaging } from '@alfresco/js-api';
import { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service';
@@ -52,6 +52,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
constructor(private documentListService: DocumentListService,
private thumbnailService: ThumbnailService,
private contentService: ContentService,
schema: DataColumn[] = [],
sorting?: DataSorting,
sortingMode: string = 'client') {
@@ -241,7 +242,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
if (page && page.list) {
let data = page.list.entries;
if (data && data.length > 0) {
rows = data.map((item) => new ShareDataRow(item, this.documentListService, this.permissionsStyle, this.thumbnailService));
rows = data.map((item) => new ShareDataRow(item, this.contentService, this.permissionsStyle, this.thumbnailService));
if (this.filter) {
rows = rows.filter(this.filter);
@@ -16,8 +16,7 @@
*/
import {
AlfrescoApiService, AuthenticationService, ContentService, LogService,
PermissionsEnum, ThumbnailService
AlfrescoApiService, AuthenticationService, ContentService, LogService, ThumbnailService
} from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
@@ -179,17 +178,6 @@ export class DocumentListService {
return this.thumbnailService.getDefaultMimeTypeIcon();
}
/**
* Checks if a node has the specified permission.
* @deprecated 2.3.0 - use the equivalent in the content service
* @param node Target node
* @param permission Permission level to query
* @returns True if the node has the permission, false otherwise
*/
hasPermission(node: any, permission: PermissionsEnum | string): boolean {
return this.contentService.hasPermission(node, permission);
}
private handleError(error: any) {
this.logService.error(error);
return throwError(error || 'Server error');
@@ -1,57 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
AlfrescoApiService, AuthenticationService, ContentService,
SettingsService, LogService, ThumbnailService
} from '@alfresco/adf-core';
import { Observable, throwError } from 'rxjs';
import { NodePaging, DocumentListService } from '../document-list';
import { PageNode } from './document-library.model.mock';
export class DocumentListServiceMock extends DocumentListService {
getFolderResult: NodePaging = new PageNode();
getFolderReject: boolean = false;
getFolderRejectError: string = 'Error';
constructor(settings?: SettingsService,
authService?: AuthenticationService,
contentService?: ContentService,
apiService?: AlfrescoApiService,
logService?: LogService,
thumbnailService?: ThumbnailService) {
super(authService, contentService, apiService, logService, thumbnailService);
}
getFolder(folder: string) {
if (this.getFolderReject) {
return throwError(this.getFolderRejectError);
}
return new Observable((observer) => {
observer.next(this.getFolderResult);
observer.complete();
});
}
deleteNode(nodeId: string) {
return new Observable((observer) => {
observer.next();
observer.complete();
});
}
}
-1
View File
@@ -17,6 +17,5 @@
export * from './document-library.model.mock';
export * from './document-list.component.mock';
export * from './document-list.service.mock';
export * from './search.component.mock';
export * from './search.service.mock';
@@ -118,7 +118,7 @@ export let errorJson = {
@Component({
template: `
<adf-search [searchTerm]="searchedWord" [queryBody]="searchNode" [maxResults]="maxResults"
<adf-search [searchTerm]="searchedWord" [maxResults]="maxResults"
(error)="showSearchResult('ERROR')"
(success)="showSearchResult('success')" #search>
<ng-template let-data>
@@ -32,8 +32,7 @@
<adf-search #search
#auto="searchAutocomplete"
class="adf-search-result-autocomplete"
[maxResults]="liveSearchMaxResults"
[queryBody]="customQueryBody">
[maxResults]="liveSearchMaxResults">
<ng-template let-data>
<mat-list *ngIf="isSearchBarActive()" id="autocomplete-search-result-list">
<mat-list-item
@@ -19,7 +19,7 @@ import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output,
QueryList, ViewEncapsulation, ViewChild, ViewChildren, ElementRef, TemplateRef, ContentChild } from '@angular/core';
import { NodeEntry, QueryBody } from '@alfresco/js-api';
import { NodeEntry } from '@alfresco/js-api';
import { Observable, Subject } from 'rxjs';
import { SearchComponent } from './search.component';
import { MatListItem } from '@angular/material';
@@ -72,10 +72,6 @@ export class SearchControlComponent implements OnInit, OnDestroy {
@Input()
liveSearchMaxResults: number = 5;
/** @deprecated in 2.1.0 */
@Input()
customQueryBody: QueryBody;
/** Emitted when the search is submitted by pressing the ENTER key.
* The search term is provided as the value of the event.
*/
@@ -17,22 +17,10 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchService, setupTestBed, CoreModule } from '@alfresco/adf-core';
import { QueryBody } from '@alfresco/js-api';
import { differentResult, folderResult, result, SimpleSearchTestComponent } from '../../mock';
import { Observable, of, throwError } from 'rxjs';
import { differentResult, result, SimpleSearchTestComponent } from '../../mock';
import { of, throwError } from 'rxjs';
import { SearchModule } from '../search.module';
function fakeNodeResultSearch(searchNode: QueryBody): Observable<any> {
if (searchNode && searchNode.query.query === 'FAKE_SEARCH_EXMPL') {
return of(differentResult);
}
if (searchNode && searchNode.filterQueries.length === 1 &&
searchNode.filterQueries[0].query === "TYPE:'cm:folder'") {
return of(folderResult);
}
return of(result);
}
describe('SearchComponent', () => {
let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement;
@@ -131,30 +119,6 @@ describe('SearchComponent', () => {
describe('search node', () => {
it('should perform a search based on the query node given', (done) => {
spyOn(searchService, 'searchByQueryBody')
.and.callFake((searchObj) => fakeNodeResultSearch(searchObj));
let fakeSearchNode: QueryBody = {
query: {
query: 'TEST-FAKE-NODE'
},
filterQueries: [
{ 'query': "TYPE:'cm:folder'" }
]
};
component.setSearchWordTo('searchTerm');
component.setSearchNodeTo(fakeSearchNode);
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let optionShowed = element.querySelectorAll('#autocomplete-search-result-list > li').length;
expect(optionShowed).toBe(1);
let folderOption: HTMLElement = <HTMLElement> element.querySelector('#result_option_0');
expect(folderOption.textContent.trim()).toBe('MyFolder');
done();
});
});
it('should perform a search with a defaultNode if no search node is given', (done) => {
spyOn(searchService, 'search').and.returnValue(of(result));
component.setSearchWordTo('searchTerm');
@@ -168,29 +132,5 @@ describe('SearchComponent', () => {
done();
});
});
it('should perform a search with the searchNode given', (done) => {
spyOn(searchService, 'searchByQueryBody')
.and.callFake((searchObj) => fakeNodeResultSearch(searchObj));
let fakeSearchNode: QueryBody = {
query: {
query: 'FAKE_SEARCH_EXMPL'
},
filterQueries: [
{ 'query': "TYPE:'cm:folder'" }
]
};
component.setSearchWordTo('searchTerm');
component.setSearchNodeTo(fakeSearchNode);
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let optionShowed = element.querySelectorAll('#autocomplete-search-result-list > li').length;
expect(optionShowed).toBe(1);
let folderOption: HTMLElement = <HTMLElement> element.querySelector('#result_option_0');
expect(folderOption.textContent.trim()).toBe('TEST_DOC');
done();
});
});
});
});
@@ -29,7 +29,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { NodePaging, QueryBody } from '@alfresco/js-api';
import { NodePaging } from '@alfresco/js-api';
import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@@ -64,10 +64,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
@Input()
skipResults: number = 0;
/** @deprecated in 2.1.0 */
@Input()
queryBody: QueryBody;
/** Search term to use when executing the search. Updating this value will
* run a new search and update the results.
*/
@@ -129,10 +125,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
}
ngOnChanges(changes) {
if (changes.queryBody &&
this.hasDifferentQueryBody(changes.queryBody.previousValue, changes.queryBody.currentValue)) {
this.loadSearchResults();
}
if (changes.searchTerm && changes.searchTerm.currentValue) {
this.loadSearchResults(changes.searchTerm.currentValue);
}
@@ -147,10 +139,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
this.loadSearchResults(this.searchTerm);
}
private hasDifferentQueryBody(previousQueryBody: QueryBody, currentQueryBody: QueryBody) {
return JSON.stringify(previousQueryBody) !== JSON.stringify(currentQueryBody);
}
private cleanResults() {
if (this.results) {
this.results = {};
@@ -160,17 +148,10 @@ export class SearchComponent implements AfterContentInit, OnChanges {
private loadSearchResults(searchTerm?: string) {
this.resetResults();
if (searchTerm) {
if (this.queryBody) {
this.searchService.searchByQueryBody(this.queryBody).subscribe(
(result) => this.onSearchDataLoaded(result),
(err) => this.onSearchDataError(err)
);
} else {
this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
(result) => this.onSearchDataLoaded(result),
(err) => this.onSearchDataError(err)
);
}
this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
(result) => this.onSearchDataLoaded(result),
(err) => this.onSearchDataError(err)
);
} else {
this.cleanResults();
}
@@ -63,13 +63,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
@Output()
success = new EventEmitter();
/**
* Emitted when a folder is created.
* @deprecated 2.4.0 No longer used by the framework
*/
@Output()
createFolder = new EventEmitter();
/** Emitted when an error occurs. */
@Output()
error = new EventEmitter();
@@ -23,9 +23,8 @@ import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, O
import { Subscription, merge } from 'rxjs';
import { FileUploadingListComponent } from './file-uploading-list.component';
// @deprecated file-uploading-dialog TODO remove in 3.0.0
@Component({
selector: 'adf-file-uploading-dialog, file-uploading-dialog',
selector: 'adf-file-uploading-dialog',
templateUrl: './file-uploading-dialog.component.html',
styleUrls: ['./file-uploading-dialog.component.scss']
})
@@ -151,18 +151,7 @@ describe('UploadDragAreaComponent', () => {
spyOn(uploadService, 'uploadFilesInTheQueue');
fixture.detectChanges();
let itemEntity = {
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
relativeFolder: '/',
name: 'file-fake.png',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.addToQueue).not.toHaveBeenCalled();
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalled();
@@ -270,19 +259,9 @@ describe('UploadDragAreaComponent', () => {
component.success = null;
component.acceptedFilesType = '.png';
fixture.detectChanges();
let itemEntity = {
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
name: 'file-fake.png',
relativeFolder: '/',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
fixture.whenStable().then(() => {
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null);
});
}));
@@ -293,19 +272,8 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue');
let itemEntity = {
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
relativeFolder: '/',
name: 'file-fake.png',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
fixture.whenStable().then(() => {
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalledWith(null);
});
}));
@@ -315,18 +283,7 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue');
let itemEntity = {
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
name: 'file-fake.png',
relativeFolder: '/',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null);
}));
@@ -19,7 +19,7 @@ import {
EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, NodePermissionSubject,
NotificationService, TranslationService, UploadService, ContentService, PermissionsEnum
} from '@alfresco/adf-core';
import { Component, forwardRef, Input, ViewEncapsulation, NgZone } from '@angular/core';
import { Component, forwardRef, ViewEncapsulation, NgZone } from '@angular/core';
import { UploadBase } from './base-upload/upload-base';
@Component({
@@ -34,15 +34,6 @@ import { UploadBase } from './base-upload/upload-base';
})
export class UploadDragAreaComponent extends UploadBase implements NodePermissionSubject {
/**
* ID of parent folder node
* @deprecated 2.4.0 - use rootFolderId ID of parent folder node
*/
@Input()
set parentId(nodeId: string) {
this.rootFolderId = nodeId;
}
constructor(protected uploadService: UploadService,
protected translationService: TranslationService,
private notificationService: NotificationService,
@@ -62,21 +53,6 @@ export class UploadDragAreaComponent extends UploadBase implements NodePermissio
}
}
/**
* Called when the file are dropped in the drag area.
* @deprecated in 2.4.0: use `onFilesDropped` instead
* @param item - FileEntity
*/
onFilesEntityDropped(item: any): void {
if (!this.disabled) {
item.file((file: File) => {
// const fileModel = this.createFileModel(file, this.rootFolderId, item.fullPath.replace(item.name, ''));
this.uploadFiles([file]);
});
}
}
/**
* Called when a folder are dropped in the drag area
*
@@ -35,13 +35,6 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
@Output()
filesDropped: EventEmitter<File[]> = new EventEmitter<File[]>();
/**
* Emitted when one or more files are dragged and dropped onto the draggable element.
* @deprecated in 2.4.0: use `filesDropped` instead
*/
@Output()
filesEntityDropped: EventEmitter<any> = new EventEmitter();
/** Emitted when a directory is dragged and dropped onto the draggable element. */
@Output()
folderEntityDropped: EventEmitter<any> = new EventEmitter();
@@ -36,10 +36,6 @@ export class VersionListComponent implements OnChanges {
versions: VersionEntry[] = [];
isLoading = true;
/** @deprecated in 2.3.0 */
@Input()
id: string;
/** The target node. */
@Input()
node: Node;
@@ -23,7 +23,7 @@ import moment from 'moment-es6';
import { Moment } from 'moment';
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { UserPreferencesService } from '../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../utils/moment-date-formats.model';
@@ -58,13 +58,14 @@ export class CardViewDateItemComponent implements OnInit {
constructor(private cardViewUpdateService: CardViewUpdateService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
(<MomentDateAdapter> this.dateAdapter).overrideDisplayFormat = this.SHOW_FORMAT;
if (this.property.value) {
@@ -22,11 +22,8 @@ import { MatMenuTrigger } from '@angular/material';
import { Subscription } from 'rxjs';
import { ContextMenuService } from './context-menu.service';
/**
* @deprecated: context-menu-holder is deprecated, use adf-context-menu-holder instead.
*/
@Component({
selector: 'adf-context-menu-holder, context-menu-holder',
selector: 'adf-context-menu-holder',
template: `
<button mat-button [matMenuTriggerFor]="contextMenu"></button>
<mat-menu #contextMenu="matMenu" class="context-menu">
@@ -20,9 +20,8 @@
import { Directive, HostListener, Input } from '@angular/core';
import { ContextMenuOverlayService } from './context-menu-overlay.service';
// @deprecated 2.3.0 context-menu tag removed
@Directive({
selector: '[adf-context-menu], [context-menu]'
selector: '[context-menu]'
})
export class ContextMenuDirective {
/** Items for the menu. */
@@ -40,13 +40,6 @@ export class NodeRestoreDirective {
@Input('adf-restore')
selection: DeletedNodeEntry[];
/**
* Path to restored node.
* @deprecated 2.4.0
*/
@Input()
location: string = '';
/** Emitted when restoration is complete. */
@Output()
restore: EventEmitter<RestoreMessageModel> = new EventEmitter();
+2 -3
View File
@@ -158,10 +158,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
/**
* Emitted when any error occurs.
* @deprecated in 2.4.0, will be renamed as "error" in 3.x.x
*/
@Output()
onError: EventEmitter<any> = new EventEmitter<any>();
error: EventEmitter<any> = new EventEmitter<any>();
debugMode: boolean = false;
@@ -458,7 +457,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
handleError(err: any): any {
this.onError.emit(err);
this.error.emit(err);
}
parseForm(json: any): FormModel {
@@ -23,7 +23,7 @@ import { DatetimeAdapter, MAT_DATETIME_FORMATS } from '@mat-datetimepicker/core'
import { MomentDatetimeAdapter, MAT_MOMENT_DATETIME_FORMATS } from '@mat-datetimepicker/moment';
import moment from 'moment-es6';
import { Moment } from 'moment';
import { UserPreferencesService } from '../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { FormService } from './../../../services/form.service';
@@ -49,14 +49,15 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
super(formService);
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
@@ -46,14 +46,15 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
super(formService);
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core';
@@ -55,13 +55,14 @@ export class DateEditorComponent implements OnInit {
maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core';
@@ -60,13 +60,14 @@ export class DateTimeEditorComponent implements OnInit {
maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
@@ -57,7 +57,6 @@ export class WidgetComponent implements AfterViewInit {
/**
* Emitted when a field value changes.
* @deprecated Used only to trigger visibility engine; components should do that internally if needed.
*/
@Output()
fieldChanged: EventEmitter<FormFieldModel> = new EventEmitter<FormFieldModel>();
@@ -96,12 +95,10 @@ export class WidgetComponent implements AfterViewInit {
this.fieldChanged.emit(this.field);
}
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
checkVisibility(field: FormFieldModel) {
this.fieldChanged.emit(field);
}
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
onFieldChanged(field: FormFieldModel) {
this.fieldChanged.emit(field);
}
@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing';
import { Response, ResponseOptions } from '@angular/http';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { FormDefinitionModel } from '../models/form-definition.model';
import { formModelTabs, AlfrescoApiServiceMock } from '../../mock';
import { FormService } from './form.service';
import { setupTestBed } from '../../testing/setupTestBed';
@@ -359,25 +358,6 @@ describe('Form service', () => {
});
});
it('should add form fields to a form', (done) => {
let formId = 100;
let name = 'testName';
let data = [{ name: 'name' }, { name: 'email' }];
let formDefinitionModel = new FormDefinitionModel(formId.toString(), name, 'testUserName', '2016-09-05T14:41:19.049Z', data);
service.addFieldsToAForm(formId, formDefinitionModel).subscribe((result) => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/form-models/' + formId)).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).formRepresentation.name).toEqual(name);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(simpleResponseBody)
});
});
it('should return list of people', (done) => {
spyOn(service, 'getUserProfileImageApi').and.returnValue('/app/rest/users/2002/picture');
let fakeFilter: string = 'whatever';
+3 -14
View File
@@ -129,7 +129,9 @@ export class FormService {
this.ecmModelService.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe(
(customType) => {
let formDefinitionModel = new FormDefinitionModel(form.id, form.name, form.lastUpdatedByFullName, form.lastUpdated, customType.entry.properties);
this.addFieldsToAForm(form.id, formDefinitionModel).subscribe((formData) => {
from(
this.editorApi.saveForm(form.id, formDefinitionModel)
).subscribe((formData) => {
observer.next(formData);
observer.complete();
}, (err) => this.handleError(err));
@@ -170,19 +172,6 @@ export class FormService {
);
}
/**
* Add Fields to a form
* @deprecated in 1.7.0, use saveForm API instead
* @param formId ID of the form
* @param formModel Form definition
*/
addFieldsToAForm(formId: number, formModel: FormDefinitionModel): Observable<any> {
this.logService.log('addFieldsToAForm is deprecated in 1.7.0, use saveForm API instead');
return from(
this.editorApi.saveForm(formId, formModel)
);
}
/**
* Searches for a form by name.
* @param name The form name to search for
@@ -90,7 +90,6 @@ describe('LoginComponent', () => {
});
function loginWithCredentials(username, password, providers: string = 'ECM') {
component.providers = providers;
usernameInput.value = username;
passwordInput.value = password;
@@ -116,6 +115,8 @@ describe('LoginComponent', () => {
});
it('should redirect to previous route state on successful login', () => {
appConfigService.config.providers = 'ECM';
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
const redirect = '/home';
component.successRoute = redirect;
@@ -393,7 +394,6 @@ describe('LoginComponent', () => {
it('should return success event after the login have succeeded', (done) => {
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
component.providers = 'ECM';
expect(component.isError).toBe(false);
component.success.subscribe(() => {
@@ -409,7 +409,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong username', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -424,8 +423,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -440,8 +437,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong username and password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -462,7 +457,6 @@ describe('LoginComponent', () => {
message: 'ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin'
}
}));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -480,7 +474,6 @@ describe('LoginComponent', () => {
it('should return CSRF error when server CSRF error occurs', async(() => {
spyOn(authService, 'login')
.and.returnValue(throwError({ message: 'ERROR: Invalid CSRF-token', status: 403 }));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -502,7 +495,6 @@ describe('LoginComponent', () => {
status: 403
}
));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -516,8 +508,6 @@ describe('LoginComponent', () => {
}));
it('should emit success event after the login has succeeded and discard password', async(() => {
component.providers = 'ECM';
component.success.subscribe((event) => {
fixture.detectChanges();
@@ -532,7 +522,6 @@ describe('LoginComponent', () => {
it('should emit error event after the login has failed', async(() => {
spyOn(authService, 'login').and.returnValue(throwError('Fake server error'));
component.providers = 'ECM';
component.error.subscribe((error) => {
fixture.detectChanges();
+2 -23
View File
@@ -25,7 +25,6 @@ import { AuthenticationService } from '../../services/authentication.service';
import { LogService } from '../../services/log.service';
import { TranslationService } from '../../services/translation.service';
import { UserPreferencesService } from '../../services/user-preferences.service';
import { SettingsService } from '../../services/settings.service';
import { LoginErrorEvent } from '../models/login-error.event';
import { LoginSubmitEvent } from '../models/login-submit.event';
@@ -91,24 +90,10 @@ export class LoginComponent implements OnInit {
@Input()
copyrightText: string = '\u00A9 2016 Alfresco Software, Inc. All Rights Reserved.';
/**
* Possible valid values are ECM, BPM or ALL.
* @deprecated 3.0.0 - use the providers property in the the app.config.json
*/
@Input()
providers: string;
/** Custom validation rules for the login form. */
@Input()
fieldsValidation: any;
/**
* Prevents the CSRF Token from being submitted. Only valid for Alfresco Process Services.
* @deprecated 3.0.0
*/
@Input()
disableCsrf: boolean;
/** Route to redirect to on successful login. */
@Input()
successRoute: string = null;
@@ -154,8 +139,7 @@ export class LoginComponent implements OnInit {
private logService: LogService,
private router: Router,
private appConfig: AppConfigService,
private userPreferences: UserPreferencesService,
private settingsService: SettingsService
private userPreferences: UserPreferencesService
) {
this.initFormError();
this.initFormFieldsMessages();
@@ -188,9 +172,6 @@ export class LoginComponent implements OnInit {
* @param event
*/
onSubmit(values: any) {
this.settingsService.setProviders(this.providers);
this.settingsService.csrfDisabled = this.disableCsrf;
this.disableError();
const args = new LoginSubmitEvent({
controls: { username: this.form.controls.username }
@@ -242,9 +223,7 @@ export class LoginComponent implements OnInit {
.login(values.username, values.password, this.rememberMe)
.subscribe(
(token: any) => {
const redirectUrl = this.authService.getRedirect(
this.providers
);
const redirectUrl = this.authService.getRedirect();
this.actualLoginStep = LoginSteps.Welcome;
this.userPreferences.setStoragePrefix(values.username);
-41
View File
@@ -1,41 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CommentRepresentation, LightUserRepresentation } from '@alfresco/js-api';
/**
* @deprecated
* CommentProcessModel
* (this model is deprecated in 2.3.0 in favour of CommentModel and will be removed in future revisions)
*/
export class CommentProcessModel implements CommentRepresentation {
id: number;
message: string;
created: Date;
createdBy: LightUserRepresentation;
isSelected: boolean;
constructor(obj?: any) {
if (obj) {
this.id = obj.id;
this.message = obj.message;
this.created = obj.created;
this.createdBy = obj.createdBy;
this.isSelected = obj.isSelected ? obj.isSelected : false;
}
}
}
-1
View File
@@ -22,6 +22,5 @@ export * from './user-process.model';
export * from './comment.model';
export * from './ecm-company.model';
export * from './redirection.model';
export * from './comment-process.model';
export * from './pagination.model';
export * from './oauth-config.model';
@@ -1,4 +1,5 @@
<div *ngIf="pagination?.hasMoreItems || isLoading" class="adf-infinite-pagination">
isLoading : {{isLoading}}
<button mat-button
*ngIf="!isLoading"
class="adf-infinite-pagination-load-more"
@@ -23,6 +23,33 @@ import { PaginatedComponent } from './paginated-component.interface';
import { BehaviorSubject } from 'rxjs';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreTestingModule } from '../testing/core.testing.module';
import { Component } from '@angular/core';
import { PaginationModel } from '../models/pagination.model';
@Component({
template: ``
})
class TestPaginatedComponent implements PaginatedComponent {
private _pagination: BehaviorSubject<PaginationModel>;
get pagination(): BehaviorSubject<PaginationModel> {
if (!this._pagination) {
let defaultPagination = <PaginationModel> {
maxItems: 10,
skipCount: 0,
totalItems: 0,
hasMoreItems: false
};
this._pagination = new BehaviorSubject<PaginationModel>(defaultPagination);
}
return this._pagination;
}
updatePagination(pagination: PaginationModel) {
this.pagination.next(pagination);
}
}
describe('InfinitePaginationComponent', () => {
@@ -31,13 +58,17 @@ describe('InfinitePaginationComponent', () => {
let pagination: Pagination;
setupTestBed({
imports: [CoreTestingModule]
imports: [CoreTestingModule],
declarations: [
TestPaginatedComponent
]
});
beforeEach(() => {
fixture = TestBed.createComponent(InfinitePaginationComponent);
component = fixture.componentInstance;
component.target = TestBed.createComponent(TestPaginatedComponent).componentInstance;
pagination = {
skipCount: 0,
hasMoreItems: false
@@ -48,12 +79,12 @@ describe('InfinitePaginationComponent', () => {
fixture.destroy();
});
describe('Standalone', () => {
describe('View', () => {
it('should show the loading spinner if loading', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.isLoading = true;
component.target = null;
fixture.detectChanges();
let loadingSpinner = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-spinner"]'));
@@ -62,7 +93,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show the loading spinner if NOT loading', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
fixture.detectChanges();
@@ -72,7 +103,7 @@ describe('InfinitePaginationComponent', () => {
it('should show the load more button if NOT loading and has more items', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
fixture.detectChanges();
@@ -82,7 +113,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show anything if pagination has NO more items', () => {
pagination.hasMoreItems = false;
component.pagination = pagination;
component.target.updatePagination(pagination);
fixture.detectChanges();
let loadMoreButton = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]'));
@@ -94,7 +125,7 @@ describe('InfinitePaginationComponent', () => {
it('should trigger the loadMore event with the proper pagination object', (done) => {
pagination.hasMoreItems = true;
pagination.skipCount = 5;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
component.pageSize = 5;
fixture.detectChanges();
@@ -111,22 +142,16 @@ describe('InfinitePaginationComponent', () => {
describe('Target', () => {
let testTarget: PaginatedComponent;
let spyTarget;
beforeEach(() => {
pagination = { maxItems: 444, skipCount: 0, totalItems: 888, hasMoreItems: true };
testTarget = {
pagination: new BehaviorSubject<Pagination>(pagination),
supportedPageSizes: [],
updatePagination() {}
};
spyOn(testTarget, 'updatePagination');
spyTarget = spyOn(component.target, 'updatePagination').and.callThrough();
});
it('should subscribe to target\'s pagination observable to update pagination and pagesize correctly', () => {
component.target = testTarget;
component.target.updatePagination(pagination);
fixture.detectChanges();
expect(component.pagination).toBe(pagination);
@@ -134,32 +159,44 @@ describe('InfinitePaginationComponent', () => {
});
it('should call the target\'s updatePagination on invoking the onLoadMore', () => {
component.target = testTarget;
component.target.updatePagination(pagination);
fixture.detectChanges();
component.onLoadMore();
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444 + 25, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true });
expect(spyTarget).toHaveBeenCalledWith({
maxItems: 444 + 25,
skipCount: 0,
totalItems: 888,
hasMoreItems: true,
merge: true
});
});
it('should call the target\'s updatePagination on invoking the onLoadMore with a specific pageSize', () => {
component.target = testTarget;
component.pageSize = 7;
component.target.updatePagination(pagination);
fixture.detectChanges();
component.onLoadMore();
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444 + component.pageSize, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true });
expect(spyTarget).toHaveBeenCalledWith({
maxItems: 444 + component.pageSize,
skipCount: 0,
totalItems: 888,
hasMoreItems: true,
merge: true
});
});
it('should unsubscribe from the target\'s pagination on onDestroy', () => {
component.target = testTarget;
fixture.detectChanges();
fixture.destroy();
const emitNewPaginationEvent = () => {
let newPagination = { maxItems: 1, skipCount: 0, totalItems: 2, hasMoreItems: true };
testTarget.pagination.next(newPagination);
component.target.pagination.next(newPagination);
};
expect(emitNewPaginationEvent).not.toThrow();
@@ -39,24 +39,12 @@ import { UserPreferencesService } from '../services/user-preferences.service';
})
export class InfinitePaginationComponent implements OnInit, OnDestroy, PaginationComponentInterface {
/**
* @deprecated 3.0.0 - uses paginationSize's default in UserPreferencesService
*/
static DEFAULT_PAGE_SIZE: number = 25;
static DEFAULT_PAGINATION: PaginationModel = {
skipCount: 0,
hasMoreItems: false,
merge: true
};
/**
* Pagination object.
* @deprecated 2.3.0
*/
@Input()
pagination: PaginationModel;
/** Component that provides custom pagination support. */
@Input()
target: PaginatedComponent;
@@ -73,6 +61,8 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
@Output()
loadMore: EventEmitter<PaginationModel> = new EventEmitter<PaginationModel>();
pagination: PaginationModel;
private paginationSubscription: Subscription;
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {
@@ -20,10 +20,5 @@ import { BehaviorSubject } from 'rxjs';
export interface PaginatedComponent {
pagination: BehaviorSubject<PaginationModel>;
/**
* @deprecated 2.3.0 : the supported page size should be retrieved via the user preferences
* and given to the pagination component, and not retrieved by the paginated object
*/
supportedPageSizes?: number[];
updatePagination(pagination: PaginationModel);
}
+2 -19
View File
@@ -50,10 +50,6 @@ export class AlfrescoApiService {
return this.getInstance().activiti.taskApi;
}
// get modelsApi(): Core.ModelsApi {
// return this.getInstance().activiti.modelsApi;
// }
get contentApi(): ContentApi {
return this.getInstance().content;
}
@@ -120,13 +116,13 @@ export class AlfrescoApiService {
}
const config = {
provider: this.getProvider(),
provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST),
authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'),
contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM),
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
disableCsrf: this.getDisableCSRF(),
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
oauth2: oauth
};
@@ -137,17 +133,4 @@ export class AlfrescoApiService {
}
}
// @deprecated 3.0.0 get only from app config
private getDisableCSRF(): boolean {
if (this.storage.getItem(AppConfigValues.DISABLECSRF) === 'true') {
return true;
} else {
return this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF);
}
}
// @deprecated 3.0.0 get only from app config
private getProvider() {
return this.storage.getItem(AppConfigValues.PROVIDERS) || this.appConfig.get<string>(AppConfigValues.PROVIDERS);
}
}
@@ -40,6 +40,8 @@ describe('AuthGuardService BPM', () => {
authGuard = TestBed.get(AuthGuardBpm);
routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'BPM';
});
it('if the alfresco js api is logged in should canActivate be true', async(() => {
@@ -78,7 +80,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: 'some-url'
});
expect(authService.getRedirect('BPM')).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: 'some-url;q=123'
});
expect(authService.getRedirect('BPM')).toEqual('some-url;q=123');
expect(authService.getRedirect()).toEqual('some-url;q=123');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: '/'
});
expect(authService.getRedirect('BPM')).toEqual('/');
expect(authService.getRedirect()).toEqual('/');
}));
it('should get redirect url from config if there is one configured', async(() => {
@@ -40,6 +40,8 @@ describe('AuthGuardService ECM', () => {
authGuard = TestBed.get(AuthGuardEcm);
routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'ECM';
});
it('if the alfresco js api is logged in should canActivate be true', async(() => {
@@ -78,7 +80,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: 'some-url'
});
expect(authService.getRedirect('ECM')).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: 'some-url;q=123'
});
expect(authService.getRedirect('ECM')).toEqual('some-url;q=123');
expect(authService.getRedirect()).toEqual('some-url;q=123');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: '/'
});
expect(authService.getRedirect('ECM')).toEqual('/');
expect(authService.getRedirect()).toEqual('/');
}));
it('should get redirect url from config if there is one configured', async(() => {
@@ -144,19 +144,19 @@ describe('AuthenticationService', () => {
it('[ECM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ECM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ECM] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ECM] should return isECMProvider true', () => {
@@ -260,19 +260,19 @@ describe('AuthenticationService', () => {
it('[BPM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[BPM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[BPM] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[BPM] should return isECMProvider false', () => {
@@ -469,25 +469,25 @@ describe('AuthenticationService', () => {
it('[ALL] should set/get redirectUrl when provider is ALL', () => {
authService.setRedirect({ provider: 'ALL', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ALL] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ALL] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ALL] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ALL] should return isECMProvider false', () => {
+2 -2
View File
@@ -244,10 +244,10 @@ export class AuthenticationService {
}
/** Gets the URL to redirect to after login.
* @param provider Service provider. Can be "ECM", "BPM" or "ALL".
* @returns The redirect URL
*/
getRedirect(provider: string): string {
getRedirect(): string {
let provider = <string> this.appConfig.get(AppConfigValues.PROVIDERS);
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
}
+2 -8
View File
@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing';
import { CookieServiceMock } from '../mock/cookie.service.mock';
import { ContentService } from './content.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
@@ -37,7 +36,6 @@ describe('ContentService', () => {
let contentService: ContentService;
let authService: AuthenticationService;
let settingsService: SettingsService;
let storage: StorageService;
let node: any;
@@ -56,7 +54,6 @@ describe('ContentService', () => {
beforeEach(() => {
authService = TestBed.get(AuthenticationService);
settingsService = TestBed.get(SettingsService);
contentService = TestBed.get(ContentService);
storage = TestBed.get(StorageService);
storage.clear();
@@ -71,7 +68,8 @@ describe('ContentService', () => {
let appConfig: AppConfigService = TestBed.get(AppConfigService);
appConfig.config = {
ecmHost: 'http://localhost:9876/ecm'
ecmHost: 'http://localhost:9876/ecm',
provider: 'ECM'
};
});
@@ -79,10 +77,6 @@ describe('ContentService', () => {
jasmine.Ajax.uninstall();
});
beforeEach(() => {
settingsService.setProviders('ECM');
});
it('should return a valid content URL', (done) => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(contentService.getContentUrl(node)).toBe('http://localhost:9876/ecm/alfresco/api/' +
-1
View File
@@ -17,7 +17,6 @@
export * from './authentication.service';
export * from './alfresco-api.service';
export * from './settings.service';
export * from './content.service';
export * from './auth-guard.service';
export * from './auth-guard-ecm.service';
-8
View File
@@ -51,7 +51,6 @@ export class RenditionsService {
);
}
/** @deprecated */
isRenditionAvailable(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe(
@@ -71,7 +70,6 @@ export class RenditionsService {
});
}
/** @deprecated */
isConversionPossible(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe(
@@ -87,27 +85,22 @@ export class RenditionsService {
});
}
/** @deprecated */
getRenditionUrl(nodeId: string, encoding: string): string {
return this.apiService.contentApi.getRenditionUrl(nodeId, encoding);
}
/** @deprecated */
getRendition(nodeId: string, encoding: string): Observable<RenditionEntry> {
return from(this.apiService.renditionsApi.getRendition(nodeId, encoding));
}
/** @deprecated */
getRenditionsListByNodeId(nodeId: string): Observable<RenditionPaging> {
return from(this.apiService.renditionsApi.getRenditions(nodeId));
}
/** @deprecated */
createRendition(nodeId: string, encoding: string): Observable<{}> {
return from(this.apiService.renditionsApi.createRendition(nodeId, { id: encoding }));
}
/** @deprecated */
convert(nodeId: string, encoding: string, pollingInterval: number = 1000, retries: number = 5) {
return this.createRendition(nodeId, encoding)
.pipe(
@@ -115,7 +108,6 @@ export class RenditionsService {
);
}
/** @deprecated */
private pollRendition(nodeId: string, encoding: string, intervalSize: number = 1000, retries: number = 5) {
let attempts = 0;
return interval(intervalSize)
@@ -1,38 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestBed } from '@angular/core/testing';
import { SettingsService } from './settings.service';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreTestingModule } from '../testing/core.testing.module';
describe('SettingsService', () => {
let service: SettingsService;
setupTestBed({
imports: [CoreTestingModule]
});
beforeEach(() => {
service = TestBed.get(SettingsService);
});
it('should be exposed by the module', () => {
expect(service).toBeDefined();
});
});
-82
View File
@@ -1,82 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
@Injectable({
providedIn: 'root'
})
export class SettingsService {
constructor(private appConfig: AppConfigService,
private logService: LogService,
private storage: StorageService) {
}
/** @deprecated in 1.6.0 */
public get ecmHost(): string {
this.logService.log('SettingsService.ecmHost is deprecated. Use AppConfigService instead.');
return this.appConfig.get<string>(AppConfigValues.ECMHOST);
}
/** @deprecated in 1.7.0 */
public set csrfDisabled(csrfDisabled: boolean) {
this.logService.log(`SettingsService.csrfDisabled is deprecated. Use UserPreferencesService.disableCSRF instead.`);
if (csrfDisabled !== null && csrfDisabled !== undefined) {
this.storage.setItem(AppConfigValues.DISABLECSRF, csrfDisabled.toString());
}
}
/** @deprecated in 1.6.0 */
public set ecmHost(ecmHostUrl: string) {
this.logService.log('SettingsService.ecmHost is deprecated. Use AppConfigService instead.');
}
/** @deprecated in 1.6.0 */
public get bpmHost(): string {
this.logService.log('SettingsService.bpmHost is deprecated. Use AppConfigService instead.');
return this.appConfig.get<string>(AppConfigValues.BPMHOST);
}
/** @deprecated in 1.6.0 */
public set bpmHost(bpmHostUrl: string) {
this.logService.log('SettingsService.bpmHost is deprecated. Use AppConfigService instead.');
}
/** @deprecated in 1.6.0 */
public getBPMApiBaseUrl(): string {
this.logService.log('SettingsService.getBPMApiBaseUrl is deprecated.');
return this.bpmHost + '/activiti-app';
}
/** @deprecated in 1.7.0 */
public getProviders(): string {
this.logService.log(`SettingsService.getProviders is deprecated. Use UserPreferencesService.authType instead.`);
return this.storage.getItem(AppConfigValues.PROVIDERS) || this.appConfig.get<string>(AppConfigValues.PROVIDERS);
}
/** @deprecated in 1.7.0 */
public setProviders(providers: string) {
this.logService.log(`SettingsService.setProviders is deprecated. Use the app-config.json`);
if (providers) {
this.storage.setItem(AppConfigValues.PROVIDERS, providers);
}
}
}
+4 -5
View File
@@ -19,7 +19,7 @@ import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from './user-preferences.service';
export const TRANSLATION_PROVIDER = new InjectionToken('Injection token for translation providers.');
@@ -37,7 +37,7 @@ export class TranslationService {
customLoader: TranslateLoaderService;
constructor(public translate: TranslateService,
userPreference: UserPreferencesService,
userPreferencesService: UserPreferencesService,
@Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) {
this.customLoader = <TranslateLoaderService> this.translate.currentLoader;
@@ -51,10 +51,9 @@ export class TranslationService {
}
}
userPreference.locale$.subscribe((locale) => {
userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.userLang = locale;
this.use(this.userLang);
});
this.use(this.userLang); });
}
/**
+2 -2
View File
@@ -103,7 +103,7 @@ export class UploadService {
/**
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
* @param emitter (Deprecated) Emitter to invoke on file status change
* @param emitter Emitter to invoke on file status change
*/
uploadFilesInTheQueue(emitter?: EventEmitter<any>): void {
if (!this.activeTask) {
@@ -197,7 +197,7 @@ export class UploadService {
}
}
private beginUpload(file: FileModel, /* @deprecated */emitter: EventEmitter<any>): any {
private beginUpload(file: FileModel, emitter: EventEmitter<any>): any {
let promise = this.getUploadPromise(file);
+1 -12
View File
@@ -40,13 +40,6 @@ export class UserPreferencesService {
};
private userPreferenceStatus: any = this.defaults;
/**
* @deprecated we are grouping every value changed on the user preference in a single stream : userPreferenceValue$
*/
locale$: Observable<string>;
private localeSubject: BehaviorSubject<string>;
private onChangeSubject: BehaviorSubject<any>;
onChange: Observable<any>;
@@ -54,8 +47,6 @@ export class UserPreferencesService {
private appConfig: AppConfigService,
private storage: StorageService) {
this.appConfig.onLoad.subscribe(this.initUserPreferenceStatus.bind(this));
this.localeSubject = new BehaviorSubject(this.get(UserPreferenceValues.Locale, this.getDefaultLocale()));
this.locale$ = this.localeSubject.asObservable();
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
this.onChange = this.onChangeSubject.asObservable();
}
@@ -169,12 +160,10 @@ export class UserPreferencesService {
/** Current locale setting. */
get locale(): string {
const locale = this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
return locale;
return this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
}
set locale(value: string) {
this.localeSubject.next(value);
this.set(UserPreferenceValues.Locale, value);
}
@@ -50,12 +50,6 @@ export class HostSettingsComponent implements OnInit {
@Output()
error = new EventEmitter<string>();
/** Emitted when the ecm host URL is changed.
* @deprecated in 2.4.0
*/
@Output()
ecmHostChange = new EventEmitter<string>();
/** Emitted when the user cancels the changes. */
@Output()
cancel = new EventEmitter<boolean>();
@@ -64,12 +58,6 @@ export class HostSettingsComponent implements OnInit {
@Output()
success = new EventEmitter<boolean>();
/** Emitted when the bpm host URL is changed.
* @deprecated in 2.4.0
*/
@Output()
bpmHostChange = new EventEmitter<string>();
constructor(private formBuilder: FormBuilder,
private storageService: StorageService,
private alfrescoApiService: AlfrescoApiService,
@@ -114,14 +114,14 @@
</mat-menu>
</ng-container>
<ng-container *ngIf="allowSidebar">
<ng-container *ngIf="allowRightSidebar">
<adf-toolbar-divider></adf-toolbar-divider>
<button
mat-icon-button
title="{{ 'ADF_VIEWER.ACTIONS.INFO' | translate }}"
data-automation-id="adf-toolbar-sidebar"
[color]="showSidebar ? 'accent' : 'default'"
[color]="showRightSidebar ? 'accent' : 'default'"
(click)="toggleSidebar()">
<mat-icon>info_outline</mat-icon>
</button>
@@ -132,12 +132,12 @@
</ng-container>
<div fxLayout="row" fxFlex="1 1 auto">
<ng-container *ngIf="allowSidebar && showSidebar">
<ng-container *ngIf="allowRightSidebar && showRightSidebar">
<div class="adf-viewer__sidebar" [ngClass]="'adf-viewer__sidebar__right'" fxFlexOrder="4" id="adf-right-sidebar" >
<ng-container *ngIf="sidebarTemplate">
<ng-container *ngTemplateOutlet="sidebarTemplate;context:sidebarTemplateContext"></ng-container>
<ng-container *ngIf="sidebarRightTemplate">
<ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext"></ng-container>
</ng-container>
<ng-content *ngIf="!sidebarTemplate" select="adf-viewer-sidebar"></ng-content>
<ng-content *ngIf="!sidebarRightTemplate" select="adf-viewer-sidebar"></ng-content>
</div>
</ng-container>
@@ -150,7 +150,7 @@
</div>
</ng-container>
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto">
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container">
<ng-container *ngIf="isLoading">
@@ -166,7 +166,7 @@
</div>
</div>
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto">
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container" [ngSwitch]="viewerType">
<ng-container *ngSwitchCase="'pdf'">
@@ -467,8 +467,8 @@ describe('ViewerComponent', () => {
describe('SideBar Test', () => {
it('should NOT display sidebar if is not allowed', (done) => {
component.showSidebar = true;
component.allowSidebar = false;
component.showRightSidebar = true;
component.allowRightSidebar = false;
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -479,8 +479,8 @@ describe('ViewerComponent', () => {
});
it('should display sidebar on the right side', (done) => {
component.allowSidebar = true;
component.showSidebar = true;
component.allowRightSidebar = true;
component.showRightSidebar = true;
fixture.detectChanges();
fixture.whenStable().then(() => {
+13 -28
View File
@@ -129,40 +129,25 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
@Input()
allowLeftSidebar = false;
/** Allow the right sidebar.
* @deprecated 2.5.0 - will be renamed allowRightSidebar in 3.0.0
*/
/** Allow the right sidebar. */
@Input()
allowSidebar = false;
allowRightSidebar = false;
/** Toggles PDF thumbnails. */
@Input()
allowThumbnails = true;
/**
* Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`.
* @deprecated 2.5.0 - will be renamed showRightSidebar in 3.0.0
*/
/** Toggles right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. */
@Input()
showSidebar = false;
showRightSidebar = false;
/** Toggles left sidebar visibility. Requires `allowSidebar` to be set to `true`. */
/** Toggles left sidebar visibility. Requires `allowLeftSidebar` to be set to `true`. */
@Input()
showLeftSidebar = false;
/**
* The position of the sidebar. Can be `left` or `right`.
* @deprecated 2.5.0 use sidebarTemplateLeft
*/
/** The template for the right sidebar. The template context contains the loaded node data. */
@Input()
sidebarPosition = 'right';
/**
* The template for the sidebar. The template context contains the loaded node data.
* @deprecated 2.5.0 renamed as sidebarRight
*/
@Input()
sidebarTemplate: TemplateRef<any> = null;
sidebarRightTemplate: TemplateRef<any> = null;
/** The template for the left sidebar. The template context contains the loaded node data. */
@Input()
@@ -223,7 +208,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
urlFileContent: string;
otherMenu: any;
extension: string;
sidebarTemplateContext: { node: Node } = { node: null };
sidebarRightTemplateContext: { node: Node } = { node: null };
sidebarLeftTemplateContext: { node: Node } = { node: null };
fileTitle: string;
@@ -376,7 +361,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
this.extensionChange.emit(this.extension);
this.sidebarTemplateContext.node = data;
this.sidebarRightTemplateContext.node = data;
this.sidebarLeftTemplateContext.node = data;
this.scrollTop();
@@ -404,18 +389,18 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
toggleSidebar() {
this.showSidebar = !this.showSidebar;
if (this.showSidebar && this.nodeId) {
this.showRightSidebar = !this.showRightSidebar;
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarTemplateContext.node = nodeEntry.entry;
this.sidebarRightTemplateContext.node = nodeEntry.entry;
});
}
}
toggleLeftSidebar() {
this.showLeftSidebar = !this.showLeftSidebar;
if (this.showSidebar && this.nodeId) {
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarLeftTemplateContext.node = nodeEntry.entry;
@@ -21,9 +21,8 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
import { AnalyticsService } from '../services/analytics.service';
import { share } from 'rxjs/operators';
// @deprecated 2.3.0 analytics-report-list tag removed
@Component({
selector: 'adf-analytics-report-list, analytics-report-list',
selector: 'adf-analytics-report-list',
templateUrl: './analytics-report-list.component.html',
styleUrls: ['./analytics-report-list.component.scss'],
encapsulation: ViewEncapsulation.None
@@ -38,9 +38,8 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
import { ReportQuery } from '../../diagram/models/report/reportQuery.model';
import { AnalyticsService } from '../services/analytics.service';
// @deprecated 2.3.0 analytics-report-parameters tag removed
@Component({
selector: 'adf-analytics-report-parameters, analytics-report-parameters',
selector: 'adf-analytics-report-parameters',
templateUrl: './analytics-report-parameters.component.html',
styleUrls: ['./analytics-report-parameters.component.scss'],
encapsulation: ViewEncapsulation.None
@@ -1,12 +1,12 @@
<div class="adf-analytics-container">
<analytics-report-parameters [appId]="appId" [reportId]="reportId"
<adf-analytics-report-parameters [appId]="appId" [reportId]="reportId"
[hideComponent]="hideParameters"
(formValueChanged)="reset()"
(success)="showReport($event)"
(saveReportSuccess)="onSaveReportSuccess($event)"
(deleteReportSuccess)="onDeleteReportSuccess()"
(edit)="onEditReport($event)">
</analytics-report-parameters>
</adf-analytics-report-parameters>
<adf-analytics-generator [reportId]="reportId"
[reportParamQuery]="reportParamQuery"
@@ -17,7 +17,7 @@
/* tslint:disable:no-input-rename */
import { MOMENT_DATE_FORMATS, MomentDateAdapter, UserPreferencesService } from '@alfresco/adf-core';
import { MOMENT_DATE_FORMATS, MomentDateAdapter, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material';
@@ -54,13 +54,14 @@ export class DateRangeWidgetComponent implements OnInit {
constructor(
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe( (locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.SHOW_FORMAT;
@@ -17,9 +17,8 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
// @deprecated 2.3.0 diagram-alfresco-publish-task tag removed
@Component({
selector: 'adf-diagram-publish-task, diagram-alfresco-publish-task',
selector: 'adf-diagram-publish-task',
templateUrl: './diagram-alfresco-publish-task.component.html'
})
export class DiagramAlfrescoPublishTaskComponent implements OnInit {
@@ -17,9 +17,8 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
// @deprecated 2.3.0 diagram-sequence-flow tag removed
@Component({
selector: 'adf-diagram-sequence-flow, diagram-sequence-flow',
selector: 'adf-diagram-sequence-flow',
templateUrl: './diagram-sequence-flow.component.html'
})
export class DiagramSequenceFlowComponent implements OnInit {
@@ -69,7 +69,7 @@ describe('Diagrams flows', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(res).not.toBeNull();
let shape: any = element.querySelector('diagram-sequence-flow > raphael-flow-arrow');
let shape: any = element.querySelector('adf-diagram-sequence-flow > raphael-flow-arrow');
expect(shape).not.toBeNull();
let tooltip: any = element.querySelector('diagram-tooltip > div');
@@ -90,7 +90,7 @@ describe('Diagrams flows', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(res).not.toBeNull();
let shape: any = element.querySelector('diagram-sequence-flow > raphael-flow-arrow');
let shape: any = element.querySelector('adf-diagram-sequence-flow > raphael-flow-arrow');
expect(shape).not.toBeNull();
let tooltip: any = element.querySelector('diagram-tooltip > div');
@@ -57,7 +57,7 @@
<div *ngFor="let flow of diagram.flows">
<div [ngSwitch]="flow.type">
<div *ngSwitchCase="'sequenceFlow'">
<diagram-sequence-flow [flow]="flow"></diagram-sequence-flow>
<adf-diagram-sequence-flow [flow]="flow"></adf-diagram-sequence-flow>
</div>
</div>
</div>
@@ -27,7 +27,8 @@ import {
LogService,
UserPreferencesService,
IdentityUserService,
IdentityUserModel
IdentityUserModel,
UserPreferenceValues
} from '@alfresco/adf-core';
import { PeopleCloudComponent } from './people-cloud/people-cloud.component';
@@ -95,16 +96,17 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
constructor(private taskService: StartTaskCloudService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService,
private userPreferencesService: UserPreferencesService,
private formBuilder: FormBuilder,
private identityUserService: IdentityUserService,
private logService: LogService) {
}
ngOnInit() {
this.localeSub = this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
this.loadCurrentUser();
this.buildForm();
}
-7
View File
@@ -15,13 +15,6 @@
* limitations under the License.
*/
/** @deprecated in 2.3.0, part of the module moved in the core */
export { CommentsModule } from '@alfresco/adf-core';
/** @deprecated in 2.3.0, component moved in the core */
export { CommentListComponent } from '@alfresco/adf-core';
/** @deprecated in 2.3.0, component moved in the core */
export { CommentsComponent } from '@alfresco/adf-core';
export * from './process-list/index';
export * from './task-list/index';
export * from './app-list/index';
@@ -116,7 +116,6 @@ describe('ProcessInstanceListComponent', () => {
let emitSpy = spyOn(component.success, 'emit');
component.appId = 1;
component.state = 'open';
component.processDefinitionKey = null;
fixture.detectChanges();
tick();
expect(emitSpy).toHaveBeenCalledWith(fakeProcessInstance);
@@ -131,7 +130,6 @@ describe('ProcessInstanceListComponent', () => {
);
component.appId = 1;
component.state = 'open';
component.processDefinitionKey = null;
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.rows).toBeDefined();
@@ -147,7 +145,6 @@ describe('ProcessInstanceListComponent', () => {
getProcessInstancesSpy = getProcessInstancesSpy.and.returnValue(of(fakeProcessInstancesWithNoName));
component.appId = 1;
component.state = 'open';
component.processDefinitionKey = 'fakeprocess';
component.success.subscribe( (res) => {
expect(component.rows[0]['name']).toEqual('Fake Process Name - Nov 9, 2017, 12:36:14 PM');
expect(component.rows[1]['name']).toEqual('Fake Process Name - Nov 9, 2017, 12:37:25 PM');
@@ -198,7 +195,6 @@ describe('ProcessInstanceListComponent', () => {
it('should emit onSuccess event when reload() called', fakeAsync(() => {
component.appId = 1;
component.state = 'open';
component.processDefinitionKey = null;
fixture.detectChanges();
tick();
let emitSpy = spyOn(component.success, 'emit');
@@ -308,22 +304,6 @@ describe('ProcessInstanceListComponent', () => {
component.ngOnChanges({'appId': change});
});
it('should reload the list when the processDefinitionKey parameter changes', (done) => {
const processDefinitionKey = 'fakeprocess';
let change = new SimpleChange(null, processDefinitionKey, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.rows).toBeDefined();
expect(component.isListEmpty()).not.toBeTruthy();
expect(component.rows.length).toEqual(2);
expect(component.rows[0]['name']).toEqual('Process 773443333');
done();
});
component.ngOnChanges({'processDefinitionKey': change});
});
it('should reload the list when the state parameter changes', (done) => {
const state = 'open';
let change = new SimpleChange(null, state, true);
@@ -356,38 +336,6 @@ describe('ProcessInstanceListComponent', () => {
component.ngOnChanges({'sort': change});
});
it('should reload the process list when the processDefinitionKey parameter changes', (done) => {
const processDefinitionKey = 'SimpleProcess';
let change = new SimpleChange(null, processDefinitionKey, true);
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.rows).toBeDefined();
expect(component.isListEmpty()).not.toBeTruthy();
expect(component.rows.length).toEqual(2);
expect(component.rows[0].name).toEqual('Process 773443333');
done();
});
component.ngOnChanges({'processDefinitionKey': change});
});
it('should reload the process list when the processDefinitionKey parameter changes to null', (done) => {
const processDefinitionKey = null;
let change = new SimpleChange('SimpleProcess', processDefinitionKey, false);
component.success.subscribe((res) => {
expect(res).toBeDefined();
expect(component.rows).toBeDefined();
expect(component.isListEmpty()).not.toBeTruthy();
expect(component.rows.length).toEqual(2);
expect(component.rows[0].name).toEqual('Process 773443333');
done();
});
component.ngOnChanges({'processDefinitionKey': change});
});
it('should reload the process list when the processDefinitionId parameter changes', (done) => {
const processDefinitionId = 'SimpleProcess:1:10';
let change = new SimpleChange(null, processDefinitionId, true);
@@ -62,12 +62,6 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
@Input()
appId: number;
/** The Definition Key of the process.
* @deprecated 2.4.0
*/
@Input()
processDefinitionKey: string;
/** The Definition Id of the process. */
@Input()
processDefinitionId: string;
@@ -175,7 +169,6 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
let changed: boolean = false;
let appId = changes['appId'];
let processDefinitionKey = changes['processDefinitionKey'];
let processDefinitionId = changes['processDefinitionId'];
let processInstanceId = changes['processInstanceId'];
let state = changes['state'];
@@ -185,8 +178,6 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
if (appId && appId.currentValue) {
changed = true;
} else if (processDefinitionKey) {
changed = true;
} else if (processDefinitionId) {
changed = true;
} else if (processInstanceId) {
@@ -210,7 +201,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
private load(requestNode: ProcessFilterParamRepresentationModel) {
this.isLoading = true;
this.processService.getProcesses(requestNode, this.processDefinitionKey)
this.processService.getProcesses(requestNode)
.subscribe(
(response) => {
this.rows = this.optimizeProcessDetails(response.data);
@@ -66,7 +66,7 @@ export class ProcessService {
* @returns List of processes
*/
getProcesses(requestNode: ProcessFilterParamRepresentationModel, processDefinitionKey?: string): Observable<ProcessListModel> {
return this.getProcessInstances(requestNode, processDefinitionKey || null)
return this.getProcessInstances(requestNode, processDefinitionKey)
.pipe(catchError(() => {
return of(new ProcessListModel({}));
}));
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { LogService, UserPreferencesService, UserProcessModel, FormFieldModel, FormModel } from '@alfresco/adf-core';
import { LogService, UserPreferencesService, UserPreferenceValues, UserProcessModel, FormFieldModel, FormModel } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import { MOMENT_DATE_FORMATS, MomentDateAdapter } from '@alfresco/adf-core';
@@ -79,7 +79,7 @@ export class StartTaskComponent implements OnInit {
*/
constructor(private taskService: TaskListService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService,
private userPreferencesService: UserPreferencesService,
private formBuilder: FormBuilder,
private logService: LogService) {
}
@@ -92,7 +92,7 @@ export class StartTaskComponent implements OnInit {
this.validateMaxTaskNameLength();
this.field = new FormFieldModel(new FormModel(), { id: this.assigneeId, value: this.assigneeId, placeholder: 'Assignee' });
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
@@ -23,11 +23,8 @@ import { TaskFilterService } from './../services/task-filter.service';
import { TaskListService } from './../services/tasklist.service';
import { IconModel } from '../../app-list/icon.model';
/**
* @deprecated: in 2.4.0 'adf-filters' selector was deprecated, use adf-task-filters instead.
*/
@Component({
selector: 'adf-task-filters, adf-filters',
selector: 'adf-task-filters',
templateUrl: './task-filters.component.html',
styleUrls: ['task-filters.component.scss']
})
@@ -56,13 +56,6 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
@Input()
processDefinitionId: string;
/**
* The Definition Key of the process.
* @deprecated 2.4.0
*/
@Input()
processDefinitionKey: string;
/** Current state of the process. Possible values are: `completed`, `active`. */
@Input()
state: string;
@@ -373,7 +366,6 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
dueBefore: this.dueBefore ? moment(this.dueBefore).toDate() : null,
processInstanceId: this.processInstanceId,
processDefinitionId: this.processDefinitionId,
processDefinitionKey: this.processDefinitionKey,
text: this.name,
assignment: this.assignment,
state: this.state,