mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
fix "ng lint" command (#5012)
* update to latest js-api * fix the "ng lint" command * fix linting issues * fix lint issues * lint fixes * code fixes * fix html * fix html * update tests * test fixes * update tests * fix tests and api * fix code
This commit is contained in:
committed by
Eugenio Romano
parent
140c64b79f
commit
edc0945f39
@@ -7,8 +7,8 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedParameters": false, // The linter is used for these.
|
||||
"noUnusedLocals": false, // The linter is used for these.
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": ".",
|
||||
"skipLibCheck": true,
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import {
|
||||
PresetConfig,
|
||||
ContentMetadataConfig,
|
||||
AspectOrientedConfig,
|
||||
InDifferentConfig,
|
||||
LayoutOrientedConfig
|
||||
} from '../../interfaces/content-metadata.interfaces';
|
||||
|
||||
@@ -60,7 +59,7 @@ export class ContentMetadataConfigFactory {
|
||||
} else if (this.isAspectOrientedPreset(presetConfig)) {
|
||||
config = new AspectOrientedConfigService(<AspectOrientedConfig> presetConfig);
|
||||
} else {
|
||||
config = new IndifferentConfigService(<InDifferentConfig> presetConfig);
|
||||
config = new IndifferentConfigService();
|
||||
}
|
||||
|
||||
Object.freeze(config);
|
||||
|
||||
@@ -21,13 +21,11 @@ import { ContentMetadataConfig, OrganisedPropertyGroup,
|
||||
|
||||
export class IndifferentConfigService implements ContentMetadataConfig {
|
||||
|
||||
constructor(config: any) {}
|
||||
|
||||
public isGroupAllowed(groupName: string): boolean {
|
||||
isGroupAllowed(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||
return Object.keys(propertyGroups)
|
||||
.map((groupName) => {
|
||||
const propertyGroup = propertyGroups[groupName],
|
||||
@@ -39,15 +37,15 @@ export class IndifferentConfigService implements ContentMetadataConfig {
|
||||
});
|
||||
}
|
||||
|
||||
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||
filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||
return propertyGroups;
|
||||
}
|
||||
|
||||
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||
appendAllPreset(): OrganisedPropertyGroup[] {
|
||||
return[];
|
||||
}
|
||||
|
||||
public isIncludeAllEnabled(): boolean {
|
||||
isIncludeAllEnabled(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ describe('ContentNodeDialogService', () => {
|
||||
let testContentNodeSelectorComponentData;
|
||||
|
||||
beforeEach(() => {
|
||||
spyOnDialogOpen.and.callFake((contentNodeSelectorComponent: any, config: any) => {
|
||||
spyOnDialogOpen.and.callFake((_: any, config: any) => {
|
||||
testContentNodeSelectorComponentData = config.data;
|
||||
return { componentInstance: {} };
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ import { ContentService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { Subject, Observable, throwError } from 'rxjs';
|
||||
import { ShareDataRow } from '../document-list/data/share-data-row.model';
|
||||
import { Node, NodeEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { DataColumn, SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core';
|
||||
import { SitesService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../document-list/services/document-list.service';
|
||||
import { ContentNodeSelectorComponent } from './content-node-selector.component';
|
||||
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
|
||||
@@ -222,7 +222,7 @@ export class ContentNodeDialogService {
|
||||
this.dialog.open(ContentNodeSelectorComponent, { data, panelClass: currentPanelClass, width: chosenWidth });
|
||||
}
|
||||
|
||||
private imageResolver(row: ShareDataRow, col: DataColumn): string | null {
|
||||
private imageResolver(row: ShareDataRow): string | null {
|
||||
const entry: Node = row.node.entry;
|
||||
if (!this.contentService.hasAllowableOperations(entry, 'create')) {
|
||||
return this.thumbnailService.getMimeTypeIcon('disable/folder');
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should set library id automatically on title input', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -80,7 +80,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should translate library title space character to dash for library id', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -95,7 +95,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should not change custom library id on title input', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -134,7 +134,7 @@ describe('LibraryDialogComponent', () => {
|
||||
Promise.resolve()
|
||||
);
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -194,10 +194,10 @@ describe('LibraryDialogComponent', () => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
const error = { message: '{ "error": { "statusCode": 409 } }' };
|
||||
spyOn(alfrescoApi.sitesApi, 'createSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject(error));
|
||||
return Promise.reject(error);
|
||||
});
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -218,7 +218,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should not translate library title if value is not a valid id', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -233,7 +233,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should translate library title partially for library id', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -248,7 +248,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should translate library title multiple space character to one dash for library id', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -263,7 +263,7 @@ describe('LibraryDialogComponent', () => {
|
||||
it('should invalidate library title if is too short', fakeAsync(() => {
|
||||
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
return Promise.reject();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
+2
-2
@@ -227,7 +227,7 @@ describe('ContentAction', () => {
|
||||
});
|
||||
|
||||
it('should find document action handler via service', () => {
|
||||
const handler = <ContentActionHandler> function (obj: any, target?: any) {
|
||||
const handler = <ContentActionHandler> function () {
|
||||
};
|
||||
const action = new ContentActionComponent(actionList, documentActions, null);
|
||||
spyOn(documentActions, 'getHandler').and.returnValue(handler);
|
||||
@@ -235,7 +235,7 @@ describe('ContentAction', () => {
|
||||
});
|
||||
|
||||
it('should find folder action handler via service', () => {
|
||||
const handler = <ContentActionHandler> function (obj: any, target?: any) {
|
||||
const handler = <ContentActionHandler> function () {
|
||||
};
|
||||
const action = new ContentActionComponent(actionList, null, folderActions);
|
||||
spyOn(folderActions, 'getHandler').and.returnValue(handler);
|
||||
|
||||
@@ -852,7 +852,7 @@ describe('DocumentList', () => {
|
||||
let called = false;
|
||||
|
||||
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||
documentList.preview.subscribe((val) => called = true);
|
||||
documentList.preview.subscribe(() => called = true);
|
||||
|
||||
documentList.onNodeClick(file);
|
||||
expect(called).toBeFalsy();
|
||||
@@ -1025,7 +1025,7 @@ describe('DocumentList', () => {
|
||||
it('should emit node-click DOM event', (done) => {
|
||||
const node = new NodeMinimalEntry();
|
||||
|
||||
document.addEventListener('node-click', (customEvent: CustomEvent) => {
|
||||
document.addEventListener('node-click', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -1043,7 +1043,7 @@ describe('DocumentList', () => {
|
||||
it('should emit node-dblclick DOM event', (done) => {
|
||||
const node = new NodeMinimalEntry();
|
||||
|
||||
document.addEventListener('node-dblclick', (customEvent: CustomEvent) => {
|
||||
document.addEventListener('node-dblclick', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ export class ShareDataRow implements DataRow {
|
||||
return ObjectUtils.getValue(this.obj.entry, key);
|
||||
}
|
||||
|
||||
imageErrorResolver(event: Event): any {
|
||||
imageErrorResolver(): any {
|
||||
if (this.obj.entry.content) {
|
||||
return this.thumbnailService.getMimeTypeIcon(this.obj.entry.content.mimeType);
|
||||
}
|
||||
|
||||
@@ -38,19 +38,19 @@ class FakeSanitizer extends DomSanitizer {
|
||||
return value;
|
||||
}
|
||||
|
||||
bypassSecurityTrustStyle(value: string): any {
|
||||
bypassSecurityTrustStyle(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustScript(value: string): any {
|
||||
bypassSecurityTrustScript(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustUrl(value: string): any {
|
||||
bypassSecurityTrustUrl(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustResourceUrl(value: string): any {
|
||||
bypassSecurityTrustResourceUrl(): any {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ describe('DocumentActionsService', () => {
|
||||
});
|
||||
|
||||
it('should register custom action handler', () => {
|
||||
const handler: ContentActionHandler = function (obj: any) {
|
||||
const handler: ContentActionHandler = function () {
|
||||
};
|
||||
service.setHandler('<key>', handler);
|
||||
expect(service.getHandler('<key>')).toBe(handler);
|
||||
@@ -68,7 +68,7 @@ describe('DocumentActionsService', () => {
|
||||
});
|
||||
|
||||
it('should be case insensitive for keys', () => {
|
||||
const handler: ContentActionHandler = function (obj: any) {
|
||||
const handler: ContentActionHandler = function () {
|
||||
};
|
||||
service.setHandler('<key>', handler);
|
||||
expect(service.getHandler('<KEY>')).toBe(handler);
|
||||
@@ -94,7 +94,7 @@ describe('DocumentActionsService', () => {
|
||||
});
|
||||
|
||||
it('should set new handler only by key', () => {
|
||||
const handler: ContentActionHandler = function (obj: any) {
|
||||
const handler: ContentActionHandler = function () {
|
||||
};
|
||||
expect(service.setHandler(null, handler)).toBeFalsy();
|
||||
expect(service.setHandler('', handler)).toBeFalsy();
|
||||
|
||||
@@ -89,27 +89,27 @@ export class DocumentActionsService {
|
||||
this.handlers['lock'] = this.lockNode.bind(this);
|
||||
}
|
||||
|
||||
private lockNode(node: NodeEntry, target?: any, permission?: string) {
|
||||
private lockNode(node: NodeEntry) {
|
||||
return this.contentNodeDialogService.openLockNodeDialog(node.entry);
|
||||
}
|
||||
|
||||
private downloadNode(obj: NodeEntry, target?: any, permission?: string) {
|
||||
private downloadNode(obj: NodeEntry) {
|
||||
this.nodeActionsService.downloadNode(obj);
|
||||
}
|
||||
|
||||
private copyNode(node: NodeEntry, target?: any, permission?: string) {
|
||||
private copyNode(node: NodeEntry, _target?: any, permission?: string) {
|
||||
const actionObservable = this.nodeActionsService.copyContent(node.entry, permission);
|
||||
this.prepareHandlers(actionObservable, 'content', 'copy', target, permission);
|
||||
this.prepareHandlers(actionObservable);
|
||||
return actionObservable;
|
||||
}
|
||||
|
||||
private moveNode(node: NodeEntry, target?: any, permission?: string) {
|
||||
private moveNode(node: NodeEntry, _target?: any, permission?: string) {
|
||||
const actionObservable = this.nodeActionsService.moveContent(node.entry, permission);
|
||||
this.prepareHandlers(actionObservable, 'content', 'move', target, permission);
|
||||
this.prepareHandlers(actionObservable);
|
||||
return actionObservable;
|
||||
}
|
||||
|
||||
private prepareHandlers(actionObservable, type: string, action: string, target?: any, permission?: string): void {
|
||||
private prepareHandlers(actionObservable): void {
|
||||
actionObservable.subscribe(
|
||||
(fileOperationMessage) => {
|
||||
this.success.next(fileOperationMessage);
|
||||
@@ -118,7 +118,7 @@ export class DocumentActionsService {
|
||||
);
|
||||
}
|
||||
|
||||
private deleteNode(node: NodeEntry, target?: any, permission?: string): Observable<any> {
|
||||
private deleteNode(node: NodeEntry, _target?: any, permission?: string): Observable<any> {
|
||||
let handlerObservable;
|
||||
|
||||
if (this.canExecuteAction(node)) {
|
||||
|
||||
@@ -92,17 +92,17 @@ export class FolderActionsService {
|
||||
|
||||
private copyNode(nodeEntry: NodeEntry, target?: any, permission?: string) {
|
||||
const actionObservable = this.nodeActionsService.copyFolder(nodeEntry.entry, permission);
|
||||
this.prepareHandlers(actionObservable, 'folder', 'copy', target, permission);
|
||||
this.prepareHandlers(actionObservable, target);
|
||||
return actionObservable;
|
||||
}
|
||||
|
||||
private moveNode(nodeEntry: NodeEntry, target?: any, permission?: string) {
|
||||
const actionObservable = this.nodeActionsService.moveFolder(nodeEntry.entry, permission);
|
||||
this.prepareHandlers(actionObservable, 'folder', 'move', target, permission);
|
||||
this.prepareHandlers(actionObservable, target);
|
||||
return actionObservable;
|
||||
}
|
||||
|
||||
private prepareHandlers(actionObservable, type: string, action: string, target?: any, permission?: string): void {
|
||||
private prepareHandlers(actionObservable, target?: any): void {
|
||||
actionObservable.subscribe(
|
||||
(fileOperationMessage) => {
|
||||
if (target && typeof target.reload === 'function') {
|
||||
|
||||
@@ -104,7 +104,7 @@ describe('NodeActionsService', () => {
|
||||
spyOn(documentListService, 'copyNode').and.returnValue(throwError('FAKE-KO'));
|
||||
spyOn(contentDialogService, 'openCopyMoveDialog').and.returnValue(of([fakeNode]));
|
||||
|
||||
service.copyFolder(fakeNode, '!allowed').subscribe((value) => {
|
||||
service.copyFolder(fakeNode, '!allowed').subscribe(() => {
|
||||
}, (error) => {
|
||||
expect(error).toBe('FAKE-KO');
|
||||
});
|
||||
|
||||
@@ -152,7 +152,7 @@ export let errorJson = {
|
||||
this.message = event;
|
||||
}
|
||||
|
||||
elementClicked(event: any) {
|
||||
elementClicked() {
|
||||
this.message = 'element clicked';
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export let mockError = {
|
||||
export let searchMockApi = {
|
||||
core: {
|
||||
queriesApi: {
|
||||
findNodes: (term, opts) => Promise.resolve(fakeSearch)
|
||||
findNodes: () => Promise.resolve(fakeSearch)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ describe('InheritPermissionDirective', () => {
|
||||
|
||||
it('should be able to add inherited permission', async(() => {
|
||||
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeNoInherit));
|
||||
spyOn(nodeService, 'updateNode').and.callFake((nodeId, nodeBody) => {
|
||||
spyOn(nodeService, 'updateNode').and.callFake((_, nodeBody) => {
|
||||
if (nodeBody.permissions.isInheritanceEnabled) {
|
||||
return of(fakeNodeWithInherit);
|
||||
} else {
|
||||
@@ -77,7 +77,7 @@ describe('InheritPermissionDirective', () => {
|
||||
|
||||
it('should be able to remove inherited permission', async(() => {
|
||||
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNodeWithInherit));
|
||||
spyOn(nodeService, 'updateNode').and.callFake((nodeId, nodeBody) => {
|
||||
spyOn(nodeService, 'updateNode').and.callFake((_, nodeBody) => {
|
||||
if (nodeBody.permissions.isInheritanceEnabled) {
|
||||
return of(fakeNodeWithInherit);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ describe('NodePermissionDialogService', () => {
|
||||
|
||||
it('should return the updated node', (done) => {
|
||||
spyOn(contentService, 'getNode').and.returnValue(of(fakeForbiddenNode));
|
||||
service.updateNodePermissionByDialog('fake-node-id', 'fake-title').subscribe((node) => {
|
||||
service.updateNodePermissionByDialog('fake-node-id', 'fake-title').subscribe(() => {
|
||||
throwError('This call should fail');
|
||||
},
|
||||
(error) => {
|
||||
|
||||
@@ -51,7 +51,7 @@ describe('NodePermissionService', () => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
function returnUpdatedNode(nodeId, nodeBody) {
|
||||
function returnUpdatedNode(_, nodeBody) {
|
||||
const fakeNode: Node = new Node({});
|
||||
fakeNode.id = 'fake-updated-node';
|
||||
fakeNode.permissions = nodeBody.permissions;
|
||||
@@ -185,7 +185,7 @@ describe('NodePermissionService', () => {
|
||||
}];
|
||||
|
||||
service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority, ['Contributor'])
|
||||
.subscribe((node: Node) => {
|
||||
.subscribe(() => {
|
||||
|
||||
}, (errorMessage) => {
|
||||
expect(errorMessage).not.toBeNull();
|
||||
|
||||
@@ -514,7 +514,7 @@ describe('SearchControlComponent', () => {
|
||||
it('should set deactivate the search after element is clicked', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
|
||||
const clickDisposable = component.optionClicked.subscribe((item) => {
|
||||
const clickDisposable = component.optionClicked.subscribe(() => {
|
||||
expect(component.subscriptAnimationState.value).toBe('inactive');
|
||||
clickDisposable.unsubscribe();
|
||||
done();
|
||||
@@ -533,7 +533,7 @@ describe('SearchControlComponent', () => {
|
||||
it('should NOT reset the search term after element is clicked', (done) => {
|
||||
spyOn(component, 'isSearchBarActive').and.returnValue(true);
|
||||
searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results))));
|
||||
const clickDisposable = component.optionClicked.subscribe((item) => {
|
||||
const clickDisposable = component.optionClicked.subscribe(() => {
|
||||
expect(component.searchTerm).not.toBeFalsy();
|
||||
expect(component.searchTerm).toBe('TEST');
|
||||
clickDisposable.unsubscribe();
|
||||
|
||||
@@ -178,14 +178,14 @@ export class SearchTriggerDirective implements ControlValueAccessor, OnDestroy {
|
||||
let isPanelOption: boolean = false;
|
||||
if ( event ) {
|
||||
const clickTarget = event.target as HTMLElement;
|
||||
isPanelOption = !this.isNoResultOption(event) &&
|
||||
isPanelOption = !this.isNoResultOption() &&
|
||||
!!this.searchPanel.panel &&
|
||||
!!this.searchPanel.panel.nativeElement.contains(clickTarget);
|
||||
}
|
||||
return isPanelOption;
|
||||
}
|
||||
|
||||
private isNoResultOption(event: MouseEvent) {
|
||||
private isNoResultOption() {
|
||||
return this.searchPanel.results.list ? this.searchPanel.results.list.entries.length === 0 : true;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ describe('TreeViewComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
fixture = TestBed.createComponent(TreeViewComponent);
|
||||
treeService = TestBed.get(TreeViewService);
|
||||
spyOn(treeService, 'getTreeNodes').and.callFake((nodeId) => throwError('Invalid Node Id'));
|
||||
spyOn(treeService, 'getTreeNodes').and.callFake(() => throwError('Invalid Node Id'));
|
||||
fixture.componentInstance.nodeId = 'Poopoovic';
|
||||
}));
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ export class TreeViewComponent implements OnChanges {
|
||||
|
||||
isExpandable = (node: TreeBaseNode) => node.expandable;
|
||||
|
||||
hasChild = (level: number, nodeData: TreeBaseNode) => nodeData.expandable;
|
||||
hasChild = (_: number, nodeData: TreeBaseNode) => nodeData.expandable;
|
||||
|
||||
private loadTreeNode() {
|
||||
this.treeViewService.getTreeNodes(this.nodeId)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import { Component, Input, ViewEncapsulation, ViewChild, Output, EventEmitter } from '@angular/core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { VersionListComponent } from './version-list.component';
|
||||
import { AppConfigService, ContentService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ContentService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { trigger, state, style, animate, transition } from '@angular/animations';
|
||||
|
||||
@Component({
|
||||
@@ -68,8 +68,7 @@ export class VersionManagerComponent {
|
||||
|
||||
uploadState: string = 'close';
|
||||
|
||||
constructor(config: AppConfigService,
|
||||
private contentService: ContentService,
|
||||
constructor(private contentService: ContentService,
|
||||
private alfrescoApiService: AlfrescoApiService) {
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ describe('WebscriptComponent', () => {
|
||||
it('url should be the one configured by the input param', (done) => {
|
||||
component.scriptPath = 'sample/folder/Company%20Home';
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(jasmine.Ajax.requests.mostRecent().url).toBe('http://localhost:9876/ecm/alfresco/service/sample/folder/Company%20Home');
|
||||
done();
|
||||
@@ -98,7 +98,7 @@ describe('WebscriptComponent', () => {
|
||||
component.scriptPath = 'sample/folder/Company%20Home';
|
||||
component.contentType = 'TEXT';
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#webscript-data-TEXT').innerHTML)
|
||||
.toBe('text test');
|
||||
@@ -116,7 +116,7 @@ describe('WebscriptComponent', () => {
|
||||
component.scriptPath = 'sample/folder/Company%20Home';
|
||||
component.contentType = 'JSON';
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[0].name).toBe('Name 1');
|
||||
expect(JSON.parse(element.querySelector('#webscript-data-JSON').innerHTML)[1].name).toBe('Name 2');
|
||||
@@ -138,7 +138,7 @@ describe('WebscriptComponent', () => {
|
||||
component.scriptPath = 'sample/folder/Company%20Home';
|
||||
component.contentType = 'DATATABLE';
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined();
|
||||
done();
|
||||
@@ -176,7 +176,7 @@ describe('WebscriptComponent', () => {
|
||||
component.scriptPath = 'sample/folder/Company%20Home';
|
||||
component.contentType = 'DATATABLE';
|
||||
|
||||
component.ngOnChanges(null).then(() => {
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#webscript-datatable-wrapper').innerHTML).toBeDefined();
|
||||
done();
|
||||
|
||||
@@ -85,7 +85,7 @@ export class WebscriptComponent implements OnChanges {
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
ngOnChanges() {
|
||||
if (this.showData) {
|
||||
this.clean();
|
||||
}
|
||||
|
||||
+4
-4
@@ -200,7 +200,7 @@ describe('CardViewDateItemComponent', () => {
|
||||
component.onDateChanged({ value: expectedDate });
|
||||
|
||||
fixture.whenStable().then(
|
||||
(updateNotification) => {
|
||||
() => {
|
||||
expect(component.property.value).toEqual(expectedDate.toDate());
|
||||
}
|
||||
);
|
||||
@@ -246,7 +246,7 @@ describe('CardViewDateItemComponent', () => {
|
||||
component.onDateClear();
|
||||
|
||||
fixture.whenStable().then(
|
||||
(updateNotification) => {
|
||||
() => {
|
||||
expect(component.property.value).toBeNull();
|
||||
}
|
||||
);
|
||||
@@ -261,7 +261,7 @@ describe('CardViewDateItemComponent', () => {
|
||||
component.onDateClear();
|
||||
|
||||
fixture.whenStable().then(
|
||||
(updateNotification) => {
|
||||
() => {
|
||||
expect(component.property.default).toBeNull();
|
||||
}
|
||||
);
|
||||
@@ -277,7 +277,7 @@ describe('CardViewDateItemComponent', () => {
|
||||
component.onDateClear();
|
||||
|
||||
fixture.whenStable().then(
|
||||
(updateNotification) => {
|
||||
() => {
|
||||
expect(component.property.value).toBeNull();
|
||||
expect(component.property.default).toBeNull();
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ describe('CommentListComponent', () => {
|
||||
commentList.selectedComment = commentOne;
|
||||
commentList.comments = [commentOne, commentTwo];
|
||||
|
||||
commentList.clickRow.subscribe((selectedComment) => {
|
||||
commentList.clickRow.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
const commentSelectedList = fixture.nativeElement.querySelectorAll('.adf-is-selected');
|
||||
expect(commentSelectedList.length).toBe(1);
|
||||
|
||||
@@ -61,8 +61,8 @@ export class ContextMenuHolderComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize(event) {
|
||||
@HostListener('window:resize')
|
||||
onResize() {
|
||||
if (this.mdMenuElement) {
|
||||
this.updatePosition();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
role="gridcell"
|
||||
class=" adf-datatable-cell adf-datatable-cell--{{col.type || 'text'}} {{col.cssClass}}"
|
||||
[attr.title]="col.title | translate"
|
||||
[attr.data-automation-id]="getAutomationValue(row, col)"
|
||||
[attr.data-automation-id]="getAutomationValue(row)"
|
||||
[attr.aria-selected]="row.isSelected ? true : false"
|
||||
[attr.aria-label]="col.title ? (col.title | translate) : null"
|
||||
tabindex="0"
|
||||
|
||||
@@ -33,7 +33,7 @@ class FakeDataRow implements DataRow {
|
||||
isDropTarget = false;
|
||||
isSelected = true;
|
||||
|
||||
hasValue(key: any) {
|
||||
hasValue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ describe('DataTable', () => {
|
||||
|
||||
dataTable.ngOnChanges({});
|
||||
|
||||
dataTable.rowClick.subscribe((event) => {
|
||||
dataTable.rowClick.subscribe(() => {
|
||||
expect(rows[0].isSelected).toBeFalsy();
|
||||
expect(rows[1].isSelected).toBeTruthy();
|
||||
done();
|
||||
@@ -396,7 +396,7 @@ describe('DataTable', () => {
|
||||
|
||||
dataTable.ngOnChanges({});
|
||||
|
||||
dataTable.rowClick.subscribe((event) => {
|
||||
dataTable.rowClick.subscribe(() => {
|
||||
expect(rows[0].isSelected).toBeFalsy();
|
||||
expect(rows[1].isSelected).toBeTruthy();
|
||||
done();
|
||||
@@ -463,7 +463,7 @@ describe('DataTable', () => {
|
||||
const rows = dataTable.data.getRows();
|
||||
dataTable.ngOnChanges({});
|
||||
|
||||
dataTable.rowClick.subscribe((event) => {
|
||||
dataTable.rowClick.subscribe(() => {
|
||||
expect(rows[0].isSelected).toBeTruthy();
|
||||
expect(rows[1].isSelected).toBeFalsy();
|
||||
done();
|
||||
@@ -827,49 +827,49 @@ describe('DataTable', () => {
|
||||
it('should use special material url scheme', () => {
|
||||
const column = <DataColumn> {};
|
||||
|
||||
const row = {
|
||||
getValue: function (key: string) {
|
||||
const row: any = {
|
||||
getValue: function () {
|
||||
return 'material-icons://android';
|
||||
}
|
||||
};
|
||||
|
||||
expect(dataTable.isIconValue(<DataRow> row, column)).toBeTruthy();
|
||||
expect(dataTable.isIconValue(row, column)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not use special material url scheme', () => {
|
||||
const column = <DataColumn> {};
|
||||
|
||||
const row = {
|
||||
getValue: function (key: string) {
|
||||
const row: any = {
|
||||
getValue: function () {
|
||||
return 'http://www.google.com';
|
||||
}
|
||||
};
|
||||
|
||||
expect(dataTable.isIconValue(<DataRow> row, column)).toBeFalsy();
|
||||
expect(dataTable.isIconValue(row, column)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should parse icon value', () => {
|
||||
const column = <DataColumn> {};
|
||||
|
||||
const row = {
|
||||
getValue: function (key: string) {
|
||||
const row: any = {
|
||||
getValue: function () {
|
||||
return 'material-icons://android';
|
||||
}
|
||||
};
|
||||
|
||||
expect(dataTable.asIconValue(<DataRow> row, column)).toBe('android');
|
||||
expect(dataTable.asIconValue(row, column)).toBe('android');
|
||||
});
|
||||
|
||||
it('should not parse icon value', () => {
|
||||
const column = <DataColumn> {};
|
||||
|
||||
const row = {
|
||||
getValue: function (key: string) {
|
||||
const row: any = {
|
||||
getValue: function () {
|
||||
return 'http://www.google.com';
|
||||
}
|
||||
};
|
||||
|
||||
expect(dataTable.asIconValue(<DataRow> row, column)).toBe(null);
|
||||
expect(dataTable.asIconValue(row, column)).toBe(null);
|
||||
});
|
||||
|
||||
it('should parse icon values to a valid i18n key', () => {
|
||||
@@ -966,8 +966,8 @@ describe('DataTable', () => {
|
||||
});
|
||||
|
||||
const column = <DataColumn> {};
|
||||
const row = <DataRow> {
|
||||
getValue: function (key: string) {
|
||||
const row: any = {
|
||||
getValue: function () {
|
||||
return 'id';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -701,7 +701,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
});
|
||||
}
|
||||
|
||||
getAutomationValue(row: DataRow, col: DataColumn) {
|
||||
getAutomationValue(row: DataRow): any {
|
||||
const name = this.getNameColumnValue();
|
||||
return name ? row.getValue(name.key) : '';
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export class ObjectDataRow implements DataRow {
|
||||
return this.getValue(key) !== undefined;
|
||||
}
|
||||
|
||||
imageErrorResolver(event: Event): string {
|
||||
imageErrorResolver(): string {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import { TranslationMock } from '../mock/translation.service.mock';
|
||||
@Component({
|
||||
template: `
|
||||
<div id="delete-component" [adf-delete]="selection"
|
||||
(delete)="onDelete($event)">
|
||||
(delete)="onDelete()">
|
||||
</div>`
|
||||
})
|
||||
class TestComponent {
|
||||
@@ -38,7 +38,7 @@ class TestComponent {
|
||||
@ViewChild(NodeDeleteDirective)
|
||||
deleteDirective: NodeDeleteDirective;
|
||||
|
||||
onDelete(event) {
|
||||
onDelete() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ describe('UploadDirective', () => {
|
||||
it('should update drag status on dragenter', () => {
|
||||
expect(directive.isDragging).toBeFalsy();
|
||||
directive.enabled = true;
|
||||
directive.onDragEnter(null);
|
||||
directive.onDragEnter();
|
||||
expect(directive.isDragging).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not update drag status on dragenter when disabled', () => {
|
||||
expect(directive.isDragging).toBeFalsy();
|
||||
directive.enabled = false;
|
||||
directive.onDragEnter(null);
|
||||
directive.onDragEnter();
|
||||
expect(directive.isDragging).toBeFalsy();
|
||||
});
|
||||
|
||||
@@ -75,14 +75,14 @@ describe('UploadDirective', () => {
|
||||
it('should update drag status on dragleave', () => {
|
||||
directive.enabled = true;
|
||||
directive.isDragging = true;
|
||||
directive.onDragLeave(null);
|
||||
directive.onDragLeave();
|
||||
expect(directive.isDragging).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not update drag status on dragleave when disabled', () => {
|
||||
directive.enabled = false;
|
||||
directive.isDragging = true;
|
||||
directive.onDragLeave(null);
|
||||
directive.onDragLeave();
|
||||
expect(directive.isDragging).toBeTruthy();
|
||||
});
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ export class UploadDirective implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onDragEnter(event: Event) {
|
||||
onDragEnter() {
|
||||
if (this.isDropMode()) {
|
||||
this.element.classList.add(this.cssClassName);
|
||||
this.isDragging = true;
|
||||
@@ -124,7 +124,7 @@ export class UploadDirective implements OnInit, OnDestroy {
|
||||
return false;
|
||||
}
|
||||
|
||||
onDragLeave(event) {
|
||||
onDragLeave() {
|
||||
if (this.isDropMode()) {
|
||||
this.element.classList.remove(this.cssClassName);
|
||||
this.isDragging = false;
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('TaskAttachmentList', () => {
|
||||
{ name: 'FakeName-2', lastUpdatedByFullName: 'FakeUser-2', lastUpdated: '2017-01-03' }
|
||||
]));
|
||||
|
||||
component.ngOnChanges({});
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { FormService } from './../services/form.service';
|
||||
|
||||
@Component({
|
||||
@@ -33,7 +33,7 @@ export class FormListComponent implements OnChanges {
|
||||
constructor(protected formService: FormService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
ngOnChanges() {
|
||||
this.getForms();
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ describe('ContentWidgetComponent', () => {
|
||||
const change = new SimpleChange(null, contentId, true);
|
||||
component.ngOnChanges({ 'id': change });
|
||||
|
||||
component.contentLoaded.subscribe((res) => {
|
||||
component.contentLoaded.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable()
|
||||
.then(() => {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { ValidateFormFieldEvent } from './../../../events/validate-form-field.event';
|
||||
import { ValidateFormEvent } from './../../../events/validate-form.event';
|
||||
import { FormService } from './../../../services/form.service';
|
||||
import { ContainerModel } from './container.model';
|
||||
import { FormFieldTypes } from './form-field-types';
|
||||
@@ -298,7 +297,7 @@ describe('FormModel', () => {
|
||||
|
||||
let validated = false;
|
||||
|
||||
formService.validateForm.subscribe((event: ValidateFormEvent) => {
|
||||
formService.validateForm.subscribe(() => {
|
||||
validated = true;
|
||||
});
|
||||
|
||||
@@ -316,7 +315,7 @@ describe('FormModel', () => {
|
||||
|
||||
let validated = false;
|
||||
|
||||
formService.validateFormField.subscribe((event: ValidateFormFieldEvent) => {
|
||||
formService.validateFormField.subscribe(() => {
|
||||
validated = true;
|
||||
});
|
||||
|
||||
@@ -333,7 +332,7 @@ describe('FormModel', () => {
|
||||
|
||||
let validated = false;
|
||||
|
||||
formService.validateFormField.subscribe((event: ValidateFormFieldEvent) => {
|
||||
formService.validateFormField.subscribe(() => {
|
||||
validated = true;
|
||||
});
|
||||
|
||||
@@ -385,10 +384,10 @@ describe('FormModel', () => {
|
||||
spyOn(form, 'getFormFields').and.returnValue([testField]);
|
||||
|
||||
const validator = <FormFieldValidator> {
|
||||
isSupported(field: FormFieldModel): boolean {
|
||||
isSupported(): boolean {
|
||||
return true;
|
||||
},
|
||||
validate(field: FormFieldModel): boolean {
|
||||
validate(): boolean {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -60,10 +60,10 @@ describe('RowEditorComponent', () => {
|
||||
spyOn(component.table, 'validateRow').and.returnValue(
|
||||
<DynamicRowValidationSummary> {isValid: true, message: null}
|
||||
);
|
||||
component.save.subscribe((e) => {
|
||||
expect(e.table).toBe(component.table);
|
||||
expect(e.row).toBe(component.row);
|
||||
expect(e.column).toBe(component.column);
|
||||
component.save.subscribe((event) => {
|
||||
expect(event.table).toBe(component.table);
|
||||
expect(event.row).toBe(component.row);
|
||||
expect(event.column).toBe(component.column);
|
||||
done();
|
||||
});
|
||||
component.onSaveChanges();
|
||||
@@ -74,7 +74,7 @@ describe('RowEditorComponent', () => {
|
||||
<DynamicRowValidationSummary> {isValid: false, message: 'error'}
|
||||
);
|
||||
let raised = false;
|
||||
component.save.subscribe((e) => raised = true);
|
||||
component.save.subscribe(() => raised = true);
|
||||
component.onSaveChanges();
|
||||
expect(raised).toBeFalsy();
|
||||
});
|
||||
|
||||
@@ -179,7 +179,7 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
expect(element.querySelector('#radio-id')).not.toBeNull();
|
||||
expect(option).not.toBeNull();
|
||||
option.click();
|
||||
widget.fieldChanged.subscribe((field) => {
|
||||
widget.fieldChanged.subscribe(() => {
|
||||
expect(element.querySelector('#radio-id')).toBeNull();
|
||||
expect(element.querySelector('#radio-id-opt-1-input')).toBeNull();
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ describe('TabsWidgetComponent', () => {
|
||||
|
||||
tick(500);
|
||||
|
||||
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
||||
tabWidgetComponent.formTabChanged.subscribe(() => {
|
||||
tabWidgetComponent.tabs[1].isVisible = true;
|
||||
|
||||
tick(500);
|
||||
@@ -144,7 +144,7 @@ describe('TabsWidgetComponent', () => {
|
||||
|
||||
tick(500);
|
||||
|
||||
tabWidgetComponent.formTabChanged.subscribe((res) => {
|
||||
tabWidgetComponent.formTabChanged.subscribe(() => {
|
||||
tabWidgetComponent.tabs[0].isVisible = false;
|
||||
|
||||
tick(500);
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('Form service', () => {
|
||||
const simpleResponseBody = { id: 1, modelType: 'test' };
|
||||
|
||||
it('should fetch and parse process definitions', (done) => {
|
||||
service.getProcessDefinitions().subscribe((result) => {
|
||||
service.getProcessDefinitions().subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/process-definitions')).toBeTruthy();
|
||||
expect( [ { id: '1' }, { id: '2' } ]).toEqual(JSON.parse(jasmine.Ajax.requests.mostRecent().response).data);
|
||||
done();
|
||||
@@ -107,7 +107,7 @@ describe('Form service', () => {
|
||||
});
|
||||
|
||||
it('should fetch and parse tasks', (done) => {
|
||||
service.getTasks().subscribe((result) => {
|
||||
service.getTasks().subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/tasks/query')).toBeTruthy();
|
||||
expect( [ { id: '1' }, { id: '2' } ]).toEqual(JSON.parse(jasmine.Ajax.requests.mostRecent().response).data);
|
||||
done();
|
||||
@@ -240,7 +240,7 @@ describe('Form service', () => {
|
||||
});
|
||||
processApiSpy.getProcessDefinitionStartForm.and.returnValue(Promise.resolve({ id: '1' }));
|
||||
|
||||
service.getStartFormDefinition('myprocess:1').subscribe((result) => {
|
||||
service.getStartFormDefinition('myprocess:1').subscribe(() => {
|
||||
expect(processApiSpy.getProcessDefinitionStartForm).toHaveBeenCalledWith('myprocess:1');
|
||||
done();
|
||||
});
|
||||
@@ -344,7 +344,7 @@ describe('Form service', () => {
|
||||
});
|
||||
|
||||
it('should create a Form with modelType=2', (done) => {
|
||||
service.createForm('testName').subscribe((result) => {
|
||||
service.createForm('testName').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/models')).toBeTruthy();
|
||||
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).modelType).toEqual(2);
|
||||
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toEqual('testName');
|
||||
|
||||
@@ -161,7 +161,7 @@ describe('NodeService', () => {
|
||||
testdata: 'testdata'
|
||||
};
|
||||
|
||||
service.createNodeMetadata('typeTest', EcmModelService.MODEL_NAMESPACE, data, '/Sites/swsdp/documentLibrary').subscribe((result) => {
|
||||
service.createNodeMetadata('typeTest', EcmModelService.MODEL_NAMESPACE, data, '/Sites/swsdp/documentLibrary').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('-root-/children')).toBeTruthy();
|
||||
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toBeDefined();
|
||||
done();
|
||||
|
||||
@@ -268,7 +268,7 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
|
||||
it('should retrieve the value for the right field when it is a process variable', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.rightValue = 'test_value_2';
|
||||
const rightValue = service.getRightValue(formTest, visibilityObjTest);
|
||||
|
||||
@@ -286,7 +286,7 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
|
||||
it('should retrieve the value for the left field when it is a process variable', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.leftValue = 'TEST_VAR_2';
|
||||
visibilityObjTest.leftType = WidgetTypeEnum.field;
|
||||
const leftValue = service.getLeftValue(formTest, visibilityObjTest);
|
||||
@@ -305,7 +305,7 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
|
||||
it('should evaluate the visibility for the field between form value and process var', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.leftType = 'LEFT_FORM_FIELD_ID';
|
||||
visibilityObjTest.operator = '!=';
|
||||
visibilityObjTest.rightValue = 'TEST_VAR_2';
|
||||
@@ -324,7 +324,7 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
|
||||
it('should evaluate visibility with multiple conditions', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.leftType = 'field';
|
||||
visibilityObjTest.leftValue = 'TEST_VAR_2';
|
||||
visibilityObjTest.operator = '!=';
|
||||
|
||||
@@ -252,7 +252,7 @@ describe('WidgetVisibilityService', () => {
|
||||
|
||||
it('should retrieve the value for the right field when it is a process variable', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
|
||||
const rightValue = service.getRightValue(formTest, visibilityObjTest);
|
||||
|
||||
@@ -270,7 +270,7 @@ describe('WidgetVisibilityService', () => {
|
||||
|
||||
it('should retrieve the value for the left field when it is a process variable', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.leftRestResponseId = 'TEST_VAR_2';
|
||||
const leftValue = service.getLeftValue(formTest, visibilityObjTest);
|
||||
|
||||
@@ -288,7 +288,7 @@ describe('WidgetVisibilityService', () => {
|
||||
|
||||
it('should evaluate the visibility for the field between form value and process var', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
|
||||
visibilityObjTest.operator = '!=';
|
||||
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
|
||||
@@ -307,7 +307,7 @@ describe('WidgetVisibilityService', () => {
|
||||
|
||||
it('should evaluate visibility with multiple conditions', (done) => {
|
||||
service.getTaskProcessVariable('9999').subscribe(
|
||||
(res: TaskProcessVariableModel[]) => {
|
||||
() => {
|
||||
visibilityObjTest.leftFormFieldId = 'LEFT_FORM_FIELD_ID';
|
||||
visibilityObjTest.operator = '!=';
|
||||
visibilityObjTest.rightRestResponseId = 'TEST_VAR_2';
|
||||
|
||||
@@ -282,7 +282,7 @@ export class WidgetVisibilityService {
|
||||
this.processVarList = <TaskProcessVariableModel[]> jsonRes;
|
||||
return jsonRes;
|
||||
}),
|
||||
catchError((err) => this.handleError(err))
|
||||
catchError(() => this.handleError())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ export class WidgetVisibilityService {
|
||||
return !!(condition && condition.operator);
|
||||
}
|
||||
|
||||
private handleError(err) {
|
||||
private handleError() {
|
||||
this.logService.error('Error while performing a call');
|
||||
return throwError('Error while performing a call - Server error');
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
/* tslint:disable:adf-file-name */
|
||||
export class AlfrescoApiMock {
|
||||
|
||||
login(username: string, password: string) {
|
||||
login() {
|
||||
return new Promise((resolve) => {
|
||||
resolve('TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1');
|
||||
});
|
||||
|
||||
@@ -132,7 +132,7 @@ export let deleteGroupMappingApi = {
|
||||
|
||||
export let returnCallQueryParameters = {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl, operation, context, queryParams) => {
|
||||
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
|
||||
return Promise.resolve(queryParams);
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export let returnCallQueryParameters = {
|
||||
|
||||
export let returnCallUrl = {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl, operation, context, queryParams) => {
|
||||
callCustomApi: (queryUrl) => {
|
||||
return Promise.resolve(queryUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export let mockError = {
|
||||
export let searchMockApi = {
|
||||
core: {
|
||||
queriesApi: {
|
||||
findNodes: (term, opts) => Promise.resolve(fakeSearch)
|
||||
findNodes: () => Promise.resolve(fakeSearch)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -42,11 +42,11 @@ export class TranslationMock implements TranslationService {
|
||||
|
||||
loadTranslation() {}
|
||||
|
||||
get(key: string | Array<string>, interpolateParams?: Object): Observable<string | any> {
|
||||
get(key: string | Array<string>): Observable<string | any> {
|
||||
return of(key);
|
||||
}
|
||||
|
||||
instant(key: string | Array<string>, interpolateParams?: Object): string | any {
|
||||
instant(key: string | Array<string>): string | any {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ export class PaginationComponent implements OnInit, OnDestroy, PaginationCompone
|
||||
get pages(): number[] {
|
||||
return Array(this.lastPage)
|
||||
.fill('n')
|
||||
.map((item, index) => (index + 1));
|
||||
.map((_, index) => (index + 1));
|
||||
}
|
||||
|
||||
goNext() {
|
||||
|
||||
@@ -33,19 +33,19 @@ class FakeSanitizer extends DomSanitizer {
|
||||
return value;
|
||||
}
|
||||
|
||||
bypassSecurityTrustStyle(value: string): any {
|
||||
bypassSecurityTrustStyle(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustScript(value: string): any {
|
||||
bypassSecurityTrustScript(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustUrl(value: string): any {
|
||||
bypassSecurityTrustUrl(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustResourceUrl(value: string): any {
|
||||
bypassSecurityTrustResourceUrl(): any {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export class AuthGuardBpm extends AuthGuardBase {
|
||||
super(authenticationService, router, appConfigService);
|
||||
}
|
||||
|
||||
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
if (this.authenticationService.isBpmLoggedIn() || this.withCredentials) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export class AuthGuardEcm extends AuthGuardBase {
|
||||
super(authenticationService, router, appConfigService);
|
||||
}
|
||||
|
||||
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
if (this.authenticationService.isEcmLoggedIn() || this.withCredentials) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
router.data = { 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeTruthy();
|
||||
expect(authGuard.canActivate(router)).toBeTruthy();
|
||||
}));
|
||||
|
||||
it('Should canActivate be false if the Role is not present int the JWT token', async(() => {
|
||||
@@ -56,7 +56,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
router.data = { 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(router)).toBeFalsy();
|
||||
}));
|
||||
|
||||
it('Should not redirect if canActivate is', async(() => {
|
||||
@@ -67,7 +67,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
router.data = { 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeTruthy();
|
||||
expect(authGuard.canActivate(router)).toBeTruthy();
|
||||
expect(routerService.navigate).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(router)).toBeFalsy();
|
||||
}));
|
||||
|
||||
it('Should canActivate return false if the realm_access is not present', async(() => {
|
||||
@@ -86,7 +86,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(router)).toBeFalsy();
|
||||
}));
|
||||
|
||||
it('Should redirect to the redirectURL if canActivate is false and redirectUrl is in data', async(() => {
|
||||
@@ -97,7 +97,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
router.data = { 'roles': ['role1', 'role2'], 'redirectUrl': 'no-role-url' };
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(router)).toBeFalsy();
|
||||
expect(routerService.navigate).toHaveBeenCalledWith(['/no-role-url']);
|
||||
}));
|
||||
|
||||
@@ -109,7 +109,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot();
|
||||
router.data = { 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(router, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(router)).toBeFalsy();
|
||||
expect(routerService.navigate).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
@@ -121,7 +121,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
route.params = { appName: 'fakeapp' };
|
||||
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(route, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(route)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Should canActivate be false if hasRealm is false and hasClientRole is true', () => {
|
||||
@@ -132,7 +132,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
route.params = { appName: 'fakeapp' };
|
||||
route.data = { 'clientRoles': ['fakeapp'], 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(route, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(route)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Should canActivate be true if both Real Role and Client Role are present int the JWT token', () => {
|
||||
@@ -147,7 +147,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
route.params = { appName: 'fakeapp' };
|
||||
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(route, null)).toBeTruthy();
|
||||
expect(authGuard.canActivate(route)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('Should canActivate be false if the Client Role is not present int the JWT token with the correct role', () => {
|
||||
@@ -162,7 +162,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
route.params = { appName: 'fakeapp' };
|
||||
route.data = { 'clientRoles': ['appName'], 'roles': ['role1', 'role2'] };
|
||||
|
||||
expect(authGuard.canActivate(route, null)).toBeFalsy();
|
||||
expect(authGuard.canActivate(route)).toBeFalsy();
|
||||
});
|
||||
|
||||
describe('ClientRole ', () => {
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthGuardSsoRoleService implements CanActivate {
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
canActivate(route: ActivatedRouteSnapshot): boolean {
|
||||
let hasRole;
|
||||
let hasRealmRole = false;
|
||||
let hasClientRole = true;
|
||||
|
||||
@@ -66,7 +66,7 @@ export class AuthGuard extends AuthGuardBase {
|
||||
window.removeEventListener('storage', this.ticketChangeBind);
|
||||
}
|
||||
|
||||
checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable<boolean> | Promise<boolean> | boolean {
|
||||
if (this.authenticationService.isLoggedIn() || this.withCredentials) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ describe('AuthenticationService', () => {
|
||||
});
|
||||
|
||||
it('[BPM] should return an BPM ticket after the login done', (done) => {
|
||||
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe((response) => {
|
||||
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(() => {
|
||||
expect(authService.isLoggedIn()).toBe(true);
|
||||
// cspell: disable-next
|
||||
expect(authService.getTicketBpm()).toEqual('Basic ZmFrZS11c2VybmFtZTpmYWtlLXBhc3N3b3Jk');
|
||||
@@ -247,7 +247,7 @@ describe('AuthenticationService', () => {
|
||||
|
||||
it('[BPM] should return an error when the logout return error', (done) => {
|
||||
authService.logout().subscribe(
|
||||
(res) => {
|
||||
() => {
|
||||
},
|
||||
(err: any) => {
|
||||
expect(err).toBeDefined();
|
||||
@@ -344,9 +344,8 @@ describe('AuthenticationService', () => {
|
||||
|
||||
it('[ECM] should not save the remember me cookie after failed login', (done) => {
|
||||
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
|
||||
(res) => {
|
||||
},
|
||||
(err: any) => {
|
||||
() => {},
|
||||
() => {
|
||||
expect(cookie['ALFRESCO_REMEMBER_ME']).toBeUndefined();
|
||||
disposableLogin.unsubscribe();
|
||||
done();
|
||||
@@ -401,9 +400,8 @@ describe('AuthenticationService', () => {
|
||||
|
||||
it('[ALL] should return login fail if only ECM call fail', (done) => {
|
||||
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
|
||||
(res) => {
|
||||
},
|
||||
(err: any) => {
|
||||
() => {},
|
||||
() => {
|
||||
expect(authService.isLoggedIn()).toBe(false, 'isLoggedIn');
|
||||
expect(authService.getTicketEcm()).toBe(null, 'getTicketEcm');
|
||||
// cspell: disable-next
|
||||
@@ -424,9 +422,8 @@ describe('AuthenticationService', () => {
|
||||
|
||||
it('[ALL] should return login fail if only BPM call fail', (done) => {
|
||||
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
|
||||
(res) => {
|
||||
},
|
||||
(err: any) => {
|
||||
() => {},
|
||||
() => {
|
||||
expect(authService.isLoggedIn()).toBe(false);
|
||||
expect(authService.getTicketEcm()).toBe(null);
|
||||
expect(authService.getTicketBpm()).toBe(null);
|
||||
@@ -448,9 +445,8 @@ describe('AuthenticationService', () => {
|
||||
|
||||
it('[ALL] should return ticket undefined when the credentials are wrong', (done) => {
|
||||
const disposableLogin = authService.login('fake-username', 'fake-password').subscribe(
|
||||
(res) => {
|
||||
},
|
||||
(err: any) => {
|
||||
() => {},
|
||||
() => {
|
||||
expect(authService.isLoggedIn()).toBe(false);
|
||||
expect(authService.getTicketEcm()).toBe(null);
|
||||
expect(authService.getTicketBpm()).toBe(null);
|
||||
|
||||
@@ -179,7 +179,7 @@ describe('Log Service', () => {
|
||||
appConfigService.config['logLevel'] = 'trace';
|
||||
providesLogComponent = TestBed.createComponent(ProvidesLogComponent);
|
||||
|
||||
providesLogComponent.componentInstance.logService.onMessage.subscribe((message) => {
|
||||
providesLogComponent.componentInstance.logService.onMessage.subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('RenditionsService', () => {
|
||||
});
|
||||
|
||||
it('Create rendition service should call the server with the ID passed and the asked encoding', (done) => {
|
||||
service.createRendition('fake-node-id', 'pdf').subscribe((res) => {
|
||||
service.createRendition('fake-node-id', 'pdf').subscribe(() => {
|
||||
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
|
||||
expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions');
|
||||
done();
|
||||
@@ -114,8 +114,8 @@ describe('RenditionsService', () => {
|
||||
});
|
||||
|
||||
it('Get rendition service should catch the error', (done) => {
|
||||
service.getRenditionsListByNodeId('fake-node-id').subscribe((res) => {
|
||||
}, (res) => {
|
||||
service.getRenditionsListByNodeId('fake-node-id').subscribe(() => {
|
||||
}, () => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ export class SharedLinksApiService {
|
||||
* @returns The shared link just created
|
||||
*/
|
||||
createSharedLinks(nodeId: string, options: any = {}): Observable<SharedLinkEntry> {
|
||||
const promise = this.sharedLinksApi.addSharedLink({ nodeId: nodeId });
|
||||
const promise = this.sharedLinksApi.addSharedLink({ nodeId: nodeId }, options);
|
||||
|
||||
return from(promise).pipe(
|
||||
catchError((err) => of(err))
|
||||
|
||||
@@ -158,7 +158,7 @@ export class TranslateLoaderService implements TranslateLoader {
|
||||
observer.complete();
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
() => {
|
||||
observer.error('Failed to load some resources');
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -222,8 +222,7 @@ export class UploadService {
|
||||
emitter.emit({ value: data });
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
});
|
||||
.catch(() => {});
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('ErrorContentComponent', () => {
|
||||
}));
|
||||
|
||||
it('should hide secondary button if this one has no value', async(() => {
|
||||
spyOn(translateService, 'instant').and.callFake((inputString) => {
|
||||
spyOn(translateService, 'instant').and.callFake(() => {
|
||||
return '';
|
||||
});
|
||||
fixture.detectChanges();
|
||||
@@ -100,7 +100,7 @@ describe('ErrorContentComponent', () => {
|
||||
}));
|
||||
|
||||
it('should render secondary button with its value from the translate file', async(() => {
|
||||
spyOn(translateService, 'instant').and.callFake((inputString) => {
|
||||
spyOn(translateService, 'instant').and.callFake(() => {
|
||||
return 'Secondary Button';
|
||||
});
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -46,19 +46,19 @@ class FakeSanitizer extends DomSanitizer {
|
||||
return value;
|
||||
}
|
||||
|
||||
bypassSecurityTrustStyle(value: string): any {
|
||||
bypassSecurityTrustStyle(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustScript(value: string): any {
|
||||
bypassSecurityTrustScript(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustUrl(value: string): any {
|
||||
bypassSecurityTrustUrl(): any {
|
||||
return null;
|
||||
}
|
||||
|
||||
bypassSecurityTrustResourceUrl(value: string): any {
|
||||
bypassSecurityTrustResourceUrl(): any {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ describe('IdentityGroupService', () => {
|
||||
|
||||
it('should be able to create group', (done) => {
|
||||
const createCustomApiSpy = spyOn(apiService, 'getInstance').and.returnValue(createGroupMappingApi);
|
||||
service.createGroup(mockIdentityGroup1).subscribe((res) => {
|
||||
service.createGroup(mockIdentityGroup1).subscribe(() => {
|
||||
expect(createCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -390,7 +390,7 @@ describe('IdentityGroupService', () => {
|
||||
|
||||
it('should be able to update group', (done) => {
|
||||
const updateCustomApiSpy = spyOn(apiService, 'getInstance').and.returnValue(updateGroupMappingApi);
|
||||
service.updateGroup('mock-group-id', mockIdentityGroup1).subscribe((res) => {
|
||||
service.updateGroup('mock-group-id', mockIdentityGroup1).subscribe(() => {
|
||||
expect(updateCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -420,7 +420,7 @@ describe('IdentityGroupService', () => {
|
||||
|
||||
it('should be able to delete group', (done) => {
|
||||
const deleteCustomApiSpy = spyOn(apiService, 'getInstance').and.returnValue(deleteGroupMappingApi);
|
||||
service.deleteGroup('mock-group-id').subscribe((res) => {
|
||||
service.deleteGroup('mock-group-id').subscribe(() => {
|
||||
expect(deleteCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -330,7 +330,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to create user', (done) => {
|
||||
const createCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(createUserMockApi);
|
||||
service.createUser(mockIdentityUser1).subscribe((res) => {
|
||||
service.createUser(mockIdentityUser1).subscribe(() => {
|
||||
expect(createCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -360,7 +360,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to update user', (done) => {
|
||||
const updateCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(updateUserMockApi);
|
||||
service.updateUser('mock-id-2', mockIdentityUser2).subscribe((res) => {
|
||||
service.updateUser('mock-id-2', mockIdentityUser2).subscribe(() => {
|
||||
expect(updateCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -390,7 +390,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to delete group', (done) => {
|
||||
const deleteCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(deleteUserMockApi);
|
||||
service.deleteUser('mock-user-id').subscribe((res) => {
|
||||
service.deleteUser('mock-user-id').subscribe(() => {
|
||||
expect(deleteCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -456,7 +456,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to join the group', (done) => {
|
||||
const joinGroupCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(joinGroupMockApi);
|
||||
service.joinGroup(mockJoinGroupRequest).subscribe((res) => {
|
||||
service.joinGroup(mockJoinGroupRequest).subscribe(() => {
|
||||
expect(joinGroupCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -486,7 +486,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to leave the group', (done) => {
|
||||
const leaveGroupCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(leaveGroupMockApi);
|
||||
service.leaveGroup('mock-user-id', 'mock-group-id').subscribe((res) => {
|
||||
service.leaveGroup('mock-user-id', 'mock-group-id').subscribe(() => {
|
||||
expect(leaveGroupCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -630,7 +630,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to assign roles to the user', (done) => {
|
||||
const assignRolesCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(assignRolesMockApi);
|
||||
service.assignRoles('mock-user-id', [mockIdentityRole]).subscribe((res) => {
|
||||
service.assignRoles('mock-user-id', [mockIdentityRole]).subscribe(() => {
|
||||
expect(assignRolesCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
@@ -660,7 +660,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
it('should be able to remove roles', (done) => {
|
||||
const removeRolesCustomApiSpy = spyOn(alfrescoApiService, 'getInstance').and.returnValue(removeRolesMockApi);
|
||||
service.removeRoles('mock-user-id', [mockIdentityRole]).subscribe((res) => {
|
||||
service.removeRoles('mock-user-id', [mockIdentityRole]).subscribe(() => {
|
||||
expect(removeRolesCustomApiSpy).toHaveBeenCalled();
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -39,8 +39,7 @@ export class PdfThumbComponent implements OnInit {
|
||||
private getThumb(page): Promise<string> {
|
||||
const viewport = page.getViewport(1);
|
||||
|
||||
const pageRatio = viewport.width / viewport.height;
|
||||
const canvas = this.getCanvas(pageRatio);
|
||||
const canvas = this.getCanvas();
|
||||
const scale = Math.min((canvas.height / viewport.height), (canvas.width / viewport.width));
|
||||
|
||||
return page.render({
|
||||
@@ -53,7 +52,7 @@ export class PdfThumbComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private getCanvas(pageRatio): HTMLCanvasElement {
|
||||
private getCanvas(): HTMLCanvasElement {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = this.page.getWidth();
|
||||
canvas.height = this.page.getHeight();
|
||||
|
||||
@@ -47,7 +47,7 @@ describe('PdfThumbListComponent', () => {
|
||||
return this._currentPageNumber;
|
||||
},
|
||||
pdfDocument: {
|
||||
getPage: (pageNum) => Promise.resolve({
|
||||
getPage: () => Promise.resolve({
|
||||
getViewport: () => ({ height: 421, width: 335 }),
|
||||
render: jasmine.createSpy('render').and.returnValue(Promise.resolve())
|
||||
})
|
||||
|
||||
@@ -43,8 +43,8 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ContentChild(TemplateRef)
|
||||
template: any;
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize(event) {
|
||||
@HostListener('window:resize')
|
||||
onResize() {
|
||||
this.calculateItems();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.pdfViewer.eventBus.off('pagechange', this.onPageChange);
|
||||
}
|
||||
|
||||
trackByFn(index: number, item: any): number {
|
||||
trackByFn(_: number, item: any): number {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
|
||||
@@ -336,7 +336,7 @@ describe('Test PdfViewer component', () => {
|
||||
fixtureUrlTestPasswordComponent = TestBed.createComponent(UrlTestPasswordComponent);
|
||||
componentUrlTestPasswordComponent = fixtureUrlTestPasswordComponent.componentInstance;
|
||||
|
||||
spyOn(dialog, 'open').and.callFake((comp, context) => {
|
||||
spyOn(dialog, 'open').and.callFake((_, context) => {
|
||||
if (context.data.reason === pdfjsLib.PasswordResponses.NEED_PASSWORD) {
|
||||
return {
|
||||
afterClosed: () => of('wrong_password')
|
||||
|
||||
@@ -487,7 +487,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
onPagesLoaded(event) {
|
||||
onPagesLoaded() {
|
||||
this.isPanelDisabled = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ describe('ViewerComponent', () => {
|
||||
|
||||
it('should extension file pdf be loaded', (done) => {
|
||||
component.urlFile = 'fake-test-file.pdf';
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -182,7 +182,7 @@ describe('ViewerComponent', () => {
|
||||
|
||||
it('should extension file png be loaded', (done) => {
|
||||
component.urlFile = 'fake-url-file.png';
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -194,7 +194,7 @@ describe('ViewerComponent', () => {
|
||||
|
||||
it('should extension file mp4 be loaded', (done) => {
|
||||
component.urlFile = 'fake-url-file.mp4';
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -206,7 +206,7 @@ describe('ViewerComponent', () => {
|
||||
|
||||
it('should extension file txt be loaded', (done) => {
|
||||
component.urlFile = 'fake-test-file.txt';
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -219,7 +219,7 @@ describe('ViewerComponent', () => {
|
||||
it('should display [unknown format] for unsupported extensions', (done) => {
|
||||
component.urlFile = 'fake-url-file.unsupported';
|
||||
component.mimeType = '';
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -240,7 +240,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-content-img';
|
||||
component.mimeType = 'image/png';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -253,7 +253,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-content-img.bin';
|
||||
component.mimeType = 'image/png';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -266,7 +266,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-content-txt.bin';
|
||||
component.mimeType = 'text/plain';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -292,7 +292,7 @@ describe('ViewerComponent', () => {
|
||||
component.displayName = null;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('adf-viewer-unknown-format')).toBeDefined();
|
||||
@@ -304,7 +304,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-content-video.bin';
|
||||
component.mimeType = 'video/mp4';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -317,7 +317,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-content-video';
|
||||
component.mimeType = 'video/mp4';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -330,7 +330,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-content-pdf';
|
||||
component.mimeType = 'application/pdf';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -343,7 +343,7 @@ describe('ViewerComponent', () => {
|
||||
it('should display a PDF file identified by mimetype when the file extension is wrong', (done) => {
|
||||
component.urlFile = 'fake-content-pdf.bin';
|
||||
component.mimeType = 'application/pdf';
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -366,13 +366,13 @@ describe('ViewerComponent', () => {
|
||||
component.showViewer = true;
|
||||
|
||||
component.nodeId = 'id1';
|
||||
component.ngOnChanges({});
|
||||
component.ngOnChanges();
|
||||
tick();
|
||||
|
||||
expect(component.fileTitle).toBe('file1');
|
||||
|
||||
component.nodeId = 'id2';
|
||||
component.ngOnChanges({});
|
||||
component.ngOnChanges();
|
||||
tick();
|
||||
|
||||
expect(component.fileTitle).toBe('file2');
|
||||
@@ -601,7 +601,7 @@ describe('ViewerComponent', () => {
|
||||
};
|
||||
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.nodeEntry).toBe(node);
|
||||
@@ -642,7 +642,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = null;
|
||||
component.mimeType = null;
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('[data-automation-id="adf-toolbar-back"]')).toBeNull();
|
||||
@@ -666,7 +666,7 @@ describe('ViewerComponent', () => {
|
||||
});
|
||||
|
||||
it('should Name File be present if is overlay mode ', (done) => {
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -733,7 +733,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = undefined;
|
||||
|
||||
expect(() => {
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
@@ -743,7 +743,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = undefined;
|
||||
|
||||
expect(() => {
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
@@ -752,7 +752,7 @@ describe('ViewerComponent', () => {
|
||||
component.nodeId = undefined;
|
||||
|
||||
expect(() => {
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
@@ -778,7 +778,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = null;
|
||||
component.mimeType = null;
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
|
||||
@@ -794,7 +794,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = null;
|
||||
component.mimeType = null;
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
|
||||
@@ -815,7 +815,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = null;
|
||||
component.mimeType = null;
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
});
|
||||
|
||||
});
|
||||
@@ -831,7 +831,7 @@ describe('ViewerComponent', () => {
|
||||
|
||||
component.urlFile = 'fake-url-file.png';
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -841,7 +841,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-test-file.pdf';
|
||||
component.displayName = 'test name';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -854,7 +854,7 @@ describe('ViewerComponent', () => {
|
||||
component.urlFile = 'fake-test-file.pdf';
|
||||
component.displayName = null;
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -870,7 +870,7 @@ describe('ViewerComponent', () => {
|
||||
component.displayName = 'blob file display name';
|
||||
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -883,7 +883,7 @@ describe('ViewerComponent', () => {
|
||||
component.displayName = null;
|
||||
component.blobFile = new Blob(['This is my blob content'], { type: 'text/plain' });
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -911,7 +911,7 @@ describe('ViewerComponent', () => {
|
||||
component.displayName = null;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.returnValue(alfrescoApiInstanceMock);
|
||||
|
||||
component.ngOnChanges(null);
|
||||
component.ngOnChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#adf-viewer-display-name').textContent).toEqual(displayName);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import {
|
||||
Component, ContentChild, EventEmitter, HostListener, ElementRef,
|
||||
Input, OnChanges, Output, SimpleChanges, TemplateRef,
|
||||
Input, OnChanges, Output, TemplateRef,
|
||||
ViewEncapsulation, OnInit, OnDestroy
|
||||
} from '@angular/core';
|
||||
import { RenditionPaging, SharedLinkEntry, Node, RenditionEntry, NodeEntry } from '@alfresco/js-api';
|
||||
@@ -278,7 +278,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
ngOnChanges() {
|
||||
if (this.showViewer) {
|
||||
if (!this.isSourceDefined()) {
|
||||
throw new Error('A content source attribute value is missing.');
|
||||
@@ -299,7 +299,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
this.isLoading = false;
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
() => {
|
||||
this.isLoading = false;
|
||||
this.logService.error('This node does not exist');
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
SimpleChanges,
|
||||
OnChanges,
|
||||
SimpleChange,
|
||||
ComponentFactoryResolver
|
||||
@@ -40,7 +39,7 @@ export class TestComponent implements OnChanges {
|
||||
@Input() data: any;
|
||||
public onChangesCalled = 0;
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
ngOnChanges() {
|
||||
this.onChangesCalled++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
/**
|
||||
* Reload the component
|
||||
*/
|
||||
reload(reportId?) {
|
||||
reload(reportId?: number) {
|
||||
this.reset();
|
||||
this.getReportList(this.appId, reportId);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
/**
|
||||
* Get the report list
|
||||
*/
|
||||
getReportList(appId: number, reportId?: string) {
|
||||
getReportList(appId: number, reportId?: number) {
|
||||
this.analyticsService.getReportList(appId).subscribe(
|
||||
(res: ReportParametersModel[]) => {
|
||||
if (res && res.length === 0) {
|
||||
@@ -152,7 +152,7 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
this.reportClick.emit(report);
|
||||
}
|
||||
|
||||
public selectReportByReportId(reportId) {
|
||||
public selectReportByReportId(reportId: number) {
|
||||
const reportFound = this.reports.find((report) => report.id === reportId);
|
||||
if (reportFound) {
|
||||
this.currentReport = reportFound;
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ describe('AnalyticsReportParametersComponent', () => {
|
||||
});
|
||||
|
||||
it('Should create an empty valid form when there are no parameters definitions', () => {
|
||||
component.success.subscribe((res) => {
|
||||
component.success.subscribe(() => {
|
||||
expect(component.reportForm).toBeDefined();
|
||||
expect(component.reportForm.valid).toEqual(true);
|
||||
expect(component.reportForm.controls).toEqual({});
|
||||
|
||||
@@ -199,7 +199,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
||||
});
|
||||
this.reportForm = this.formBuilder.group(formBuilderGroup);
|
||||
this.reportForm.valueChanges.subscribe((data) => this.onValueChanged(data));
|
||||
this.reportForm.statusChanges.subscribe((data) => this.onStatusChanged(data));
|
||||
this.reportForm.statusChanges.subscribe(() => this.onStatusChanged());
|
||||
}
|
||||
|
||||
public getReportParams(reportId: string) {
|
||||
@@ -251,7 +251,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On
|
||||
}
|
||||
}
|
||||
|
||||
onStatusChanged(status: any) {
|
||||
onStatusChanged() {
|
||||
if (this.reportForm && !this.reportForm.pending && this.reportForm.dirty) {
|
||||
this.formValidState = this.reportForm.valid;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ReportQuery } from '../../diagram/models/report/reportQuery.model';
|
||||
import { AnalyticsGeneratorComponent } from './analytics-generator.component';
|
||||
|
||||
@@ -50,7 +50,7 @@ export class AnalyticsComponent implements OnChanges {
|
||||
|
||||
reportParamQuery: ReportQuery;
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
ngOnChanges() {
|
||||
this.analyticsGenerator.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { DiagramElementModel } from '../models/diagram/diagramElement.model';
|
||||
import { DiagramModel } from '../models/diagram/diagram.model';
|
||||
import { DiagramColorService } from '../services/diagram-color.service';
|
||||
@@ -65,7 +65,7 @@ export class DiagramComponent implements OnChanges {
|
||||
private diagramsService: DiagramsService) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
ngOnChanges() {
|
||||
this.reset();
|
||||
this.diagramColorService.setTotalColors(this.metricColor);
|
||||
if (this.processDefinitionId) {
|
||||
|
||||
@@ -32,7 +32,7 @@ export class Polyline {
|
||||
isDefaultConditionAvailable: any = false;
|
||||
closePath: any = false;
|
||||
|
||||
constructor(uuid, points, strokeWidth, paper) {
|
||||
constructor(_uuid, points, strokeWidth, paper) {
|
||||
/* Array on coordinates:
|
||||
* points: [{x: 410, y: 110}, 1
|
||||
* {x: 570, y: 110}, 1 2
|
||||
@@ -192,7 +192,7 @@ export class Polyline {
|
||||
return null;
|
||||
}
|
||||
|
||||
addNewPoint(position, x, y) {
|
||||
addNewPoint(_position, x, y) {
|
||||
//
|
||||
for (var i = 0; i < this.getLinesCount(); i++) {
|
||||
var line = this.getLine(i);
|
||||
|
||||
@@ -59,7 +59,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
|
||||
this.apps$ = this.appsProcessCloudService.getDeployedApplicationsByStatus(AppListCloudComponent.RUNNING_STATUS)
|
||||
.pipe(
|
||||
catchError((error) => {
|
||||
catchError(() => {
|
||||
this.loadingError$.next(true);
|
||||
return of();
|
||||
})
|
||||
|
||||
@@ -86,7 +86,7 @@ describe('AppsProcessCloudService', () => {
|
||||
spyOn(service, 'getDeployedApplicationsByStatus').and.returnValue(throwError(errorResponse));
|
||||
service.getDeployedApplicationsByStatus('fake')
|
||||
.subscribe(
|
||||
(users) => fail('expected an error, not applications'),
|
||||
() => fail('expected an error, not applications'),
|
||||
(error) => {
|
||||
expect(error.status).toEqual(404);
|
||||
expect(error.statusText).toEqual('Not Found');
|
||||
|
||||
@@ -317,7 +317,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
let saved = false;
|
||||
formComponent.form = formModel;
|
||||
formComponent.formSaved.subscribe((v) => saved = true);
|
||||
formComponent.formSaved.subscribe(() => saved = true);
|
||||
spyOn(formComponent, 'completeTaskForm').and.stub();
|
||||
|
||||
const result = formComponent.onOutcomeClicked(outcome);
|
||||
@@ -368,7 +368,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
let saved = false;
|
||||
formComponent.form = formModel;
|
||||
formComponent.formSaved.subscribe((v) => saved = true);
|
||||
formComponent.formSaved.subscribe(() => saved = true);
|
||||
|
||||
const result = formComponent.onOutcomeClicked(outcome);
|
||||
expect(result).toBeTruthy();
|
||||
|
||||
@@ -178,8 +178,8 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
return taskRepresentation.processDefinitionId && taskRepresentation.processDefinitionDeploymentId !== 'null';
|
||||
}
|
||||
|
||||
getFormByTaskId(appName, taskId: string): Promise<FormCloud> {
|
||||
return new Promise<FormCloud>((resolve, reject) => {
|
||||
getFormByTaskId(appName: string, taskId: string): Promise<FormCloud> {
|
||||
return new Promise<FormCloud>(resolve => {
|
||||
forkJoin(this.formCloudService.getTaskForm(appName, taskId),
|
||||
this.formCloudService.getTaskVariables(appName, taskId))
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
@@ -261,7 +261,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
() => {
|
||||
this.onTaskSaved(this.form);
|
||||
},
|
||||
(error) => this.onTaskSavedError(this.form, error)
|
||||
(error) => this.onTaskSavedError(error)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -275,7 +275,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
() => {
|
||||
this.onTaskCompleted(this.form);
|
||||
},
|
||||
(error) => this.onTaskCompletedError(this.form, error)
|
||||
(error) => this.onTaskCompletedError(error)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -328,7 +328,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
this.formSaved.emit(form);
|
||||
}
|
||||
|
||||
protected onTaskSavedError(form: FormCloud, error: any) {
|
||||
protected onTaskSavedError(error: any) {
|
||||
this.handleError(error);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
this.formCompleted.emit(form);
|
||||
}
|
||||
|
||||
protected onTaskCompletedError(form: FormCloud, error: any) {
|
||||
protected onTaskCompletedError(error: any) {
|
||||
this.handleError(error);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ export class ContentCloudNodeSelectorService {
|
||||
private dialog: MatDialog) {
|
||||
}
|
||||
|
||||
openUploadFileDialog(contentHost: string, title?: string, actionName?: string): Observable<Node[]> {
|
||||
openUploadFileDialog(contentHost: string): Observable<Node[]> {
|
||||
const changedConfig = this.apiService.lastConfig;
|
||||
changedConfig.provider = 'ALL';
|
||||
changedConfig.hostEcm = contentHost.replace('/alfresco', '');
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<mat-accordion [hideToggle]="isLoading">
|
||||
<mat-expansion-panel (afterExpand)="onExpand($event)" (closed)="onClose($event)">
|
||||
<mat-expansion-panel (afterExpand)="onExpand()" (closed)="onClose()">
|
||||
<mat-expansion-panel-header *ngIf="processFilter" id="adf-edit-process-filter-expansion-header">
|
||||
<ng-container *ngIf="!isLoading; else loadingTemplate">
|
||||
<mat-panel-title fxLayoutAlign="space-between center" id="adf-edit-process-filter-title-id">{{processFilter.name | translate}}</mat-panel-title>
|
||||
|
||||
+1
-1
@@ -559,7 +559,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
second: 59
|
||||
});
|
||||
|
||||
component.filterChange.subscribe((res) => {
|
||||
component.filterChange.subscribe(() => {
|
||||
expect(component.changedProcessFilter.lastModifiedTo.toISOString()).toEqual(lastModifiedToFilter.toISOString());
|
||||
done();
|
||||
});
|
||||
|
||||
+2
-2
@@ -395,11 +395,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
return this.showFilterActions;
|
||||
}
|
||||
|
||||
onExpand(event: any) {
|
||||
onExpand() {
|
||||
this.toggleFilterActions = true;
|
||||
}
|
||||
|
||||
onClose(event: any) {
|
||||
onClose() {
|
||||
this.toggleFilterActions = false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
observer.complete();
|
||||
});
|
||||
|
||||
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
|
||||
const fakeGlobalFilterPromise = new Promise(function (resolve) {
|
||||
resolve(fakeGlobalFilter);
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
function returnCallQueryParameters() {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl, operation, context, queryParams) => {
|
||||
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
|
||||
return Promise.resolve(queryParams);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ describe('Activiti ProcessList Cloud Service', () => {
|
||||
function returnCallUrl() {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl, operation, context, queryParams) => {
|
||||
callCustomApi: (queryUrl) => {
|
||||
return Promise.resolve(queryUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
* @param appName Name of the target app
|
||||
* @returns List of local preferences
|
||||
*/
|
||||
getPreferences(appName: string, key: string): Observable<any> {
|
||||
getPreferences(_: string, key: string): Observable<any> {
|
||||
if (key || key === '') {
|
||||
return of(this.prepareLocalPreferenceResponse(key));
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
* @param key Key of the target preference
|
||||
* @returns Observable of local preference
|
||||
*/
|
||||
getPreferenceByKey(appName: string, key: string): Observable<any> {
|
||||
getPreferenceByKey(_: string, key: string): Observable<any> {
|
||||
return of(JSON.parse(this.storage.getItem(key)) || []);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
* @newPreference Details of new local preference
|
||||
* @returns Observable of created local preferences
|
||||
*/
|
||||
createPreference(appName: string, key: string, newPreference: any): Observable<any> {
|
||||
createPreference(_: string, key: string, newPreference: any): Observable<any> {
|
||||
const storedFilters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||
storedFilters.push(...newPreference);
|
||||
this.storage.setItem(key, JSON.stringify(storedFilters));
|
||||
@@ -67,7 +67,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
* @param updatedPreference Details of updated preference
|
||||
* @returns Observable of updated local preferences
|
||||
*/
|
||||
updatePreference(appName: string, key: string, updatedPreference: any): Observable<any> {
|
||||
updatePreference(_: string, key: string, updatedPreference: any): Observable<any> {
|
||||
if (key) {
|
||||
this.storage.setItem(key, JSON.stringify(updatedPreference));
|
||||
return of(updatedPreference);
|
||||
|
||||
@@ -92,7 +92,7 @@ describe('PreferenceService', () => {
|
||||
getInstanceSpy.and.returnValue(apiErrorMock);
|
||||
service.getPreferences('mock-app-name')
|
||||
.subscribe(
|
||||
(preferences) => fail('expected an error, not preferences'),
|
||||
() => fail('expected an error, not preferences'),
|
||||
(error) => {
|
||||
expect(error.state).toEqual(404);
|
||||
expect(error.stateText).toEqual('Not Found');
|
||||
@@ -119,7 +119,7 @@ describe('PreferenceService', () => {
|
||||
getInstanceSpy.and.returnValue(apiErrorMock);
|
||||
service.getPreferenceByKey('mock-app-name', 'mock-preference-key')
|
||||
.subscribe(
|
||||
(preference) => fail('expected an error, not preference'),
|
||||
() => fail('expected an error, not preference'),
|
||||
(error) => {
|
||||
expect(error.state).toEqual(404);
|
||||
expect(error.stateText).toEqual('Not Found');
|
||||
@@ -144,7 +144,7 @@ describe('PreferenceService', () => {
|
||||
getInstanceSpy.and.returnValue(apiErrorMock);
|
||||
service.createPreference('mock-app-name', 'mock-preference-key', createMockPreference)
|
||||
.subscribe(
|
||||
(preference) => fail('expected an error, not to create preference'),
|
||||
() => fail('expected an error, not to create preference'),
|
||||
(error) => {
|
||||
expect(error.state).toEqual(404);
|
||||
expect(error.stateText).toEqual('Not Found');
|
||||
@@ -169,7 +169,7 @@ describe('PreferenceService', () => {
|
||||
getInstanceSpy.and.returnValue(apiErrorMock);
|
||||
service.createPreference('mock-app-name', 'mock-preference-key', updateMockPreference)
|
||||
.subscribe(
|
||||
(preference) => fail('expected an error, not to update preference'),
|
||||
() => fail('expected an error, not to update preference'),
|
||||
(error) => {
|
||||
expect(error.state).toEqual(404);
|
||||
expect(error.stateText).toEqual('Not Found');
|
||||
@@ -190,7 +190,7 @@ describe('PreferenceService', () => {
|
||||
getInstanceSpy.and.returnValue(apiErrorMock);
|
||||
service.deletePreference('mock-app-name', 'mock-preference-key')
|
||||
.subscribe(
|
||||
(preference) => fail('expected an error, not to delete preference'),
|
||||
() => fail('expected an error, not to delete preference'),
|
||||
(error) => {
|
||||
expect(error.state).toEqual(404);
|
||||
expect(error.stateText).toEqual('Not Found');
|
||||
|
||||
@@ -26,7 +26,7 @@ import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock';
|
||||
describe('ClaimTaskDirective', () => {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-test-component',
|
||||
selector: 'adf-cloud-claim-test-component',
|
||||
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameMock"></button>'
|
||||
})
|
||||
class TestComponent {
|
||||
@@ -70,7 +70,7 @@ describe('ClaimTaskDirective', () => {
|
||||
describe('Claim Task Directive validation errors', () => {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-no-fields-validation-component',
|
||||
selector: 'adf-cloud-claim-no-fields-validation-component',
|
||||
template: '<button adf-cloud-claim-task></button>'
|
||||
})
|
||||
class ClaimTestMissingInputDirectiveComponent {
|
||||
@@ -84,7 +84,7 @@ describe('Claim Task Directive validation errors', () => {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-no-taskid-validation-component',
|
||||
selector: 'adf-cloud-claim-no-taskid-validation-component',
|
||||
template: '<button adf-cloud-claim-task [appName]="appName"></button>'
|
||||
})
|
||||
class ClaimTestMissingTaskIdDirectiveComponent {
|
||||
@@ -96,7 +96,7 @@ describe('Claim Task Directive validation errors', () => {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-undefined-appname-component',
|
||||
selector: 'adf-cloud-claim-undefined-appname-component',
|
||||
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameUndefined"></button>'
|
||||
})
|
||||
class ClaimTestInvalidAppNameUndefineddDirectiveComponent {
|
||||
@@ -109,7 +109,7 @@ describe('Claim Task Directive validation errors', () => {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-null-appname-component',
|
||||
selector: 'adf-cloud-claim-null-appname-component',
|
||||
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameNull"></button>'
|
||||
})
|
||||
class ClaimTestInvalidAppNameNulldDirectiveComponent {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { IdentityUserService } from '@alfresco/adf-core';
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
|
||||
@Directive({
|
||||
// tslint:disable-next-line: directive-selector
|
||||
selector: '[adf-cloud-claim-task]'
|
||||
})
|
||||
export class ClaimTaskDirective implements OnInit {
|
||||
|
||||
@@ -26,7 +26,7 @@ import { TaskCloudService } from '../services/task-cloud.service';
|
||||
describe('CompleteTaskDirective', () => {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-test-component',
|
||||
selector: 'adf-cloud-test-component',
|
||||
template: `<button adf-cloud-complete-task [taskId]='taskMock' [appName]='appNameMock' (success)="onCompleteTask($event)"></button>`
|
||||
})
|
||||
class TestComponent {
|
||||
@@ -73,7 +73,7 @@ describe('CompleteTaskDirective', () => {
|
||||
describe('Complete Task Directive validation errors', () => {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-no-fields-validation-component',
|
||||
selector: 'adf-cloud-no-fields-validation-component',
|
||||
template: '<button adf-cloud-complete-task (success)="onCompleteTask($event)"></button>'
|
||||
})
|
||||
class TestMissingInputDirectiveComponent {
|
||||
@@ -91,7 +91,7 @@ describe('Complete Task Directive validation errors', () => {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-no-taskid-validation-component',
|
||||
selector: 'adf-cloud-no-taskid-validation-component',
|
||||
template: '<button adf-cloud-complete-task [appName]="appName" (success)="onCompleteTask($event)"></button>'
|
||||
})
|
||||
class TestMissingTaskIdDirectiveComponent {
|
||||
@@ -107,7 +107,7 @@ describe('Complete Task Directive validation errors', () => {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-undefined-appname-component',
|
||||
selector: 'adf-cloud-undefined-appname-component',
|
||||
template: '<button adf-cloud-complete-task [taskId]="taskMock" [appName]="appNameUndefined" (success)="onCompleteTask($event)"></button>'
|
||||
})
|
||||
class TestInvalidAppNameUndefineddDirectiveComponent {
|
||||
@@ -124,7 +124,7 @@ describe('Complete Task Directive validation errors', () => {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-null-appname-component',
|
||||
selector: 'adf-cloud-null-appname-component',
|
||||
template: '<button adf-cloud-complete-task [taskId]="taskMock" [appName]="appNameNull" (success)="onCompleteTask($event)"></button>'
|
||||
})
|
||||
class TestInvalidAppNameNulldDirectiveComponent {
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@a
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
|
||||
@Directive({
|
||||
// tslint:disable-next-line: directive-selector
|
||||
selector: '[adf-cloud-complete-task]'
|
||||
})
|
||||
export class CompleteTaskDirective implements OnInit {
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Directive, Input, HostListener, Output, EventEmitter, OnInit } from '@a
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
|
||||
@Directive({
|
||||
// tslint:disable-next-line: directive-selector
|
||||
selector: '[adf-cloud-unclaim-task]'
|
||||
})
|
||||
export class UnClaimTaskDirective implements OnInit {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user