diff --git a/demo-shell/package.json b/demo-shell/package.json index ff144d604e..f5f11d076e 100644 --- a/demo-shell/package.json +++ b/demo-shell/package.json @@ -1,7 +1,7 @@ { "name": "Alfresco-ADF-Angular-Demo", "description": "Demo shell for Alfresco Angular components", - "version": "2.7.0-beta5", + "version": "3.0.0-beta1", "author": "Alfresco Software, Ltd.", "repository": { "type": "git", diff --git a/lib/content-services/breadcrumb/breadcrumb.component.spec.ts b/lib/content-services/breadcrumb/breadcrumb.component.spec.ts index 8f4742b5bc..ecc8b9a057 100644 --- a/lib/content-services/breadcrumb/breadcrumb.component.spec.ts +++ b/lib/content-services/breadcrumb/breadcrumb.component.spec.ts @@ -62,7 +62,7 @@ describe('Breadcrumb', () => { it('should emit navigation event', (done) => { let node = { id: '-id-', name: 'name' }; - component.navigate.subscribe(val => { + component.navigate.subscribe((val) => { expect(val).toBe(node); done(); }); diff --git a/lib/content-services/breadcrumb/breadcrumb.component.ts b/lib/content-services/breadcrumb/breadcrumb.component.ts index a2064afcfc..f0164849e9 100644 --- a/lib/content-services/breadcrumb/breadcrumb.component.ts +++ b/lib/content-services/breadcrumb/breadcrumb.component.ts @@ -153,7 +153,7 @@ export class BreadcrumbComponent implements OnInit, OnChanges { let result: number = -1; if (route && route.length > 0 && nodeId) { - result = route.findIndex(el => el.id === nodeId); + result = route.findIndex((el) => el.id === nodeId); } return result; diff --git a/lib/content-services/breadcrumb/dropdown-breadcrumb.component.spec.ts b/lib/content-services/breadcrumb/dropdown-breadcrumb.component.spec.ts index d0e9bfbce2..0d6620801b 100644 --- a/lib/content-services/breadcrumb/dropdown-breadcrumb.component.spec.ts +++ b/lib/content-services/breadcrumb/dropdown-breadcrumb.component.spec.ts @@ -140,7 +140,7 @@ describe('DropdownBreadcrumb', () => { openSelect(); fixture.whenStable().then(() => { - component.navigate.subscribe(val => { + component.navigate.subscribe((val) => { expect(val).toEqual({ id: '1', name: 'Stark Industries' }); done(); }); diff --git a/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts b/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts index f7932ce1f0..7835438e8a 100644 --- a/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts +++ b/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts @@ -79,11 +79,11 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy { switchMap(this.saveNode.bind(this)) ) .subscribe( - updatedNode => { + (updatedNode) => { Object.assign(this.node, updatedNode); this.alfrescoApiService.nodeUpdated.next(this.node); }, - error => this.logService.error(error) + (error) => this.logService.error(error) ); this.loadProperties(this.node); diff --git a/lib/content-services/content-metadata/services/config/aspect-oriented-config.service.ts b/lib/content-services/content-metadata/services/config/aspect-oriented-config.service.ts index 07bc7e3cd0..7e556b38e9 100644 --- a/lib/content-services/content-metadata/services/config/aspect-oriented-config.service.ts +++ b/lib/content-services/content-metadata/services/config/aspect-oriented-config.service.ts @@ -36,7 +36,7 @@ export class AspectOrientedConfigService implements ContentMetadataConfig { const newGroup = this.getOrganisedPropertyGroup(propertyGroups, aspectName); return groupAccumulator.concat(newGroup); }, []) - .filter(organisedPropertyGroup => organisedPropertyGroup.properties.length > 0); + .filter((organisedPropertyGroup) => organisedPropertyGroup.properties.length > 0); } private getOrganisedPropertyGroup(propertyGroups, aspectName) { @@ -52,7 +52,7 @@ export class AspectOrientedConfigService implements ContentMetadataConfig { } else { properties = ( aspectProperties) .map((propertyName) => getProperty(propertyGroups, aspectName, propertyName)) - .filter(props => props !== undefined); + .filter((props) => props !== undefined); } newGroup = [ { title: group.title, properties } ]; diff --git a/lib/content-services/content-metadata/services/config/indifferent-config.service.ts b/lib/content-services/content-metadata/services/config/indifferent-config.service.ts index eac65429da..f61192a0e6 100644 --- a/lib/content-services/content-metadata/services/config/indifferent-config.service.ts +++ b/lib/content-services/content-metadata/services/config/indifferent-config.service.ts @@ -34,7 +34,7 @@ export class IndifferentConfigService implements ContentMetadataConfig { properties = propertyGroup.properties; return Object.assign({}, propertyGroup, { - properties: Object.keys(properties).map(propertyName => properties[propertyName]) + properties: Object.keys(properties).map((propertyName) => properties[propertyName]) }); }); } diff --git a/lib/content-services/content-metadata/services/config/layout-oriented-config.service.ts b/lib/content-services/content-metadata/services/config/layout-oriented-config.service.ts index d37003a691..921725c6cd 100644 --- a/lib/content-services/content-metadata/services/config/layout-oriented-config.service.ts +++ b/lib/content-services/content-metadata/services/config/layout-oriented-config.service.ts @@ -51,7 +51,7 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig { private flattenItems(items) { return items.reduce((accumulator, item) => { const properties = Array.isArray(item.properties) ? item.properties : [item.properties]; - const flattenedProperties = properties.map(propertyName => { + const flattenedProperties = properties.map((propertyName) => { return { groupName: item.aspect || item.type, propertyName @@ -64,7 +64,7 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig { private getMatchingGroups(groupName: string): LayoutOrientedConfigItem[] { return this.config - .map(layoutBlock => layoutBlock.items) + .map((layoutBlock) => layoutBlock.items) .reduce((accumulator, items) => accumulator.concat(items), []) .filter((item) => item.aspect === groupName || item.type === groupName); } diff --git a/lib/content-services/content-metadata/services/config/property-group-reader.ts b/lib/content-services/content-metadata/services/config/property-group-reader.ts index cf7d91f7f1..8171c7cf2a 100644 --- a/lib/content-services/content-metadata/services/config/property-group-reader.ts +++ b/lib/content-services/content-metadata/services/config/property-group-reader.ts @@ -22,7 +22,7 @@ const emptyGroup = { }; function convertObjectToArray(object: any): Property[] { - return Object.keys(object).map(key => object[key]); + return Object.keys(object).map((key) => object[key]); } export function getGroup(propertyGroups: PropertyGroupContainer, groupName: string): PropertyGroup | undefined { diff --git a/lib/content-services/content-metadata/services/content-metadata.service.ts b/lib/content-services/content-metadata/services/content-metadata.service.ts index 68885d91eb..58894e8fb6 100644 --- a/lib/content-services/content-metadata/services/content-metadata.service.ts +++ b/lib/content-services/content-metadata/services/content-metadata.service.ts @@ -48,13 +48,13 @@ export class ContentMetadataService { const config = this.contentMetadataConfigFactory.get(presetName), groupNames = node.aspectNames .concat(node.nodeType) - .filter(groupName => config.isGroupAllowed(groupName)); + .filter((groupName) => config.isGroupAllowed(groupName)); if (groupNames.length > 0) { groupedProperties = this.propertyDescriptorsService.load(groupNames).pipe( - map(groups => config.reorganiseByConfig(groups)), - map(groups => this.setTitleToNameIfNotSet(groups)), - map(groups => this.propertyGroupTranslatorService.translateToCardViewGroups(groups, node.properties)) + map((groups) => config.reorganiseByConfig(groups)), + map((groups) => this.setTitleToNameIfNotSet(groups)), + map((groups) => this.propertyGroupTranslatorService.translateToCardViewGroups(groups, node.properties)) ); } } @@ -63,7 +63,7 @@ export class ContentMetadataService { } setTitleToNameIfNotSet(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] { - propertyGroups.map(propertyGroup => { + propertyGroups.map((propertyGroup) => { propertyGroup.title = propertyGroup.title || propertyGroup.name; }); return propertyGroups; diff --git a/lib/content-services/content-metadata/services/property-descriptors.service.ts b/lib/content-services/content-metadata/services/property-descriptors.service.ts index 834cbe0f5a..108bee867f 100644 --- a/lib/content-services/content-metadata/services/property-descriptors.service.ts +++ b/lib/content-services/content-metadata/services/property-descriptors.service.ts @@ -30,8 +30,8 @@ export class PropertyDescriptorsService { load(groupNames: string[]): Observable { const groupFetchStreams = groupNames - .map(groupName => groupName.replace(':', '_')) - .map(groupName => defer( () => this.alfrescoApiService.classesApi.getClass(groupName)) ); + .map((groupName) => groupName.replace(':', '_')) + .map((groupName) => defer( () => this.alfrescoApiService.classesApi.getClass(groupName)) ); return forkJoin(groupFetchStreams).pipe( map(this.convertToObject) diff --git a/lib/content-services/content-metadata/services/property-groups-translator.service.ts b/lib/content-services/content-metadata/services/property-groups-translator.service.ts index 9503696ad2..aa1309e4b9 100644 --- a/lib/content-services/content-metadata/services/property-groups-translator.service.ts +++ b/lib/content-services/content-metadata/services/property-groups-translator.service.ts @@ -50,7 +50,7 @@ export class PropertyGroupTranslatorService { } public translateToCardViewGroups(propertyGroups: OrganisedPropertyGroup[], propertyValues): CardViewGroup[] { - return propertyGroups.map(propertyGroup => { + return propertyGroups.map((propertyGroup) => { const translatedPropertyGroup: any = Object.assign({}, propertyGroup); translatedPropertyGroup.properties = this.translateArray(propertyGroup.properties, propertyValues); return translatedPropertyGroup; @@ -58,7 +58,7 @@ export class PropertyGroupTranslatorService { } private translateArray(properties: Property[], propertyValues: any): CardViewItem[] { - return properties.map(property => { + return properties.map((property) => { return this.translate(property, propertyValues); }); } diff --git a/lib/content-services/content-node-selector/content-node-selector-panel.component.spec.ts b/lib/content-services/content-node-selector/content-node-selector-panel.component.spec.ts index 481e0de059..b60d197b62 100644 --- a/lib/content-services/content-node-selector/content-node-selector-panel.component.spec.ts +++ b/lib/content-services/content-node-selector/content-node-selector-panel.component.spec.ts @@ -298,7 +298,7 @@ describe('ContentNodeSelectorComponent', () => { const customResourcesService = TestBed.get(CustomResourcesService); getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and - .callFake(id => { + .callFake((id) => { if (id === '-sites-') { return of(['123456testId', '09876543testId']); } diff --git a/lib/content-services/content-node-selector/content-node-selector-panel.component.ts b/lib/content-services/content-node-selector/content-node-selector-panel.component.ts index 8d7699e10f..5ef8d4f3c2 100644 --- a/lib/content-services/content-node-selector/content-node-selector-panel.component.ts +++ b/lib/content-services/content-node-selector/content-node-selector-panel.component.ts @@ -259,7 +259,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, PaginatedCompo if (this.customResourcesService.hasCorrespondingNodeIds(this.siteId)) { this.customResourcesService.getCorrespondingNodeIds(this.siteId) - .subscribe(nodeIds => { + .subscribe((nodeIds) => { this.contentNodeSelectorService.search(this.searchTerm, this.siteId, this.skipCount, this.pageSize, nodeIds) .subscribe(this.showSearchResults.bind(this)); }, @@ -380,7 +380,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, PaginatedCompo }; this.apiService.nodesApi.getNode(node.guid, options) - .then(documentLibrary => { + .then((documentLibrary) => { this.documentList.performCustomSourceNavigation(documentLibrary); }); } diff --git a/lib/content-services/content-node-selector/content-node-selector.service.ts b/lib/content-services/content-node-selector/content-node-selector.service.ts index 632b43b243..bcdcc4830a 100644 --- a/lib/content-services/content-node-selector/content-node-selector.service.ts +++ b/lib/content-services/content-node-selector/content-node-selector.service.ts @@ -48,8 +48,8 @@ export class ContentNodeSelectorService { if (extraNodeIds && extraNodeIds.length) { extraNodeIds - .filter(id => id !== rootNodeId) - .forEach(extraId => { + .filter((id) => id !== rootNodeId) + .forEach((extraId) => { extraParentFiltering += ` OR ANCESTOR:'workspace://SpacesStore/${extraId}'`; }); } diff --git a/lib/content-services/content-node-share/content-node-share.dialog.ts b/lib/content-services/content-node-share/content-node-share.dialog.ts index a0e6079e97..0a771cc174 100644 --- a/lib/content-services/content-node-share/content-node-share.dialog.ts +++ b/lib/content-services/content-node-share/content-node-share.dialog.ts @@ -140,7 +140,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { minWidth: '250px', closeOnNavigation: true }) - .beforeClose().subscribe(deleteSharedLink => { + .beforeClose().subscribe((deleteSharedLink) => { if (deleteSharedLink) { this.deleteSharedLink(this.sharedId); } else { diff --git a/lib/content-services/dialogs/download-zip.dialog.ts b/lib/content-services/dialogs/download-zip.dialog.ts index 84a9b003e9..8ecf77f013 100644 --- a/lib/content-services/dialogs/download-zip.dialog.ts +++ b/lib/content-services/dialogs/download-zip.dialog.ts @@ -58,9 +58,9 @@ export class DownloadZipDialogComponent implements OnInit { const promise: any = this.apiService.getInstance().core.downloadsApi.createDownload({ nodeIds }); - promise.on('progress', progress => this.logService.log('Progress', progress)); - promise.on('error', error => this.logService.error('Error', error)); - promise.on('abort', data => this.logService.log('Abort', data)); + promise.on('progress', (progress) => this.logService.log('Progress', progress)); + promise.on('error', (error) => this.logService.error('Error', error)); + promise.on('abort', (data) => this.logService.log('Abort', data)); promise.on('success', (data: DownloadEntry) => { if (data && data.entry && data.entry.id) { diff --git a/lib/content-services/dialogs/folder.dialog.spec.ts b/lib/content-services/dialogs/folder.dialog.spec.ts index 2663ec1c2c..3817789f3a 100644 --- a/lib/content-services/dialogs/folder.dialog.spec.ts +++ b/lib/content-services/dialogs/folder.dialog.spec.ts @@ -145,7 +145,7 @@ describe('FolderDialogComponent', () => { it('should not call dialog to close if submit fails', () => { spyOn(nodesApi, 'updateNode').and.returnValue(throwError('error')); - spyOn(component, 'handleError').and.callFake(val => val); + spyOn(component, 'handleError').and.callFake((val) => val); component.submit(); @@ -254,7 +254,7 @@ describe('FolderDialogComponent', () => { it('should not call dialog to close if submit fails', () => { spyOn(nodesApi, 'createFolder').and.returnValue(throwError('error')); - spyOn(component, 'handleError').and.callFake(val => val); + spyOn(component, 'handleError').and.callFake((val) => val); component.form.controls['name'].setValue('name'); component.form.controls['description'].setValue('description'); diff --git a/lib/content-services/dialogs/node-lock.dialog.ts b/lib/content-services/dialogs/node-lock.dialog.ts index f34fe51889..26ed07ddd6 100644 --- a/lib/content-services/dialogs/node-lock.dialog.ts +++ b/lib/content-services/dialogs/node-lock.dialog.ts @@ -85,10 +85,10 @@ export class NodeLockDialogComponent implements OnInit { submit(): void { this.toggleLock() - .then(node => { + .then((node) => { this.data.node.isLocked = this.form.value.isLocked; this.dialog.close(node.entry); }) - .catch(error => this.data.onError(error)); + .catch((error) => this.data.onError(error)); } } diff --git a/lib/content-services/document-list/components/content-action/content-action.component.spec.ts b/lib/content-services/document-list/components/content-action/content-action.component.spec.ts index 1b1c3503ac..0b37d621cb 100644 --- a/lib/content-services/document-list/components/content-action/content-action.component.spec.ts +++ b/lib/content-services/document-list/components/content-action/content-action.component.spec.ts @@ -200,7 +200,7 @@ describe('ContentAction', () => { it('should use custom "execute" emitter', (done) => { let emitter = new EventEmitter(); - emitter.subscribe(e => { + emitter.subscribe((e) => { expect(e.value).toBe(''); done(); }); diff --git a/lib/content-services/document-list/components/content-action/content-action.component.ts b/lib/content-services/document-list/components/content-action/content-action.component.ts index 48181617d2..487ff0764e 100644 --- a/lib/content-services/document-list/components/content-action/content-action.component.ts +++ b/lib/content-services/document-list/components/content-action/content-action.component.ts @@ -129,7 +129,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy { } ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.subscriptions.forEach((subscription) => subscription.unsubscribe()); this.subscriptions = []; if (this.documentActionModel) { @@ -188,13 +188,13 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy { if (target === ContentActionTarget.Document) { if (this.documentActions) { this.subscriptions.push( - this.documentActions.permissionEvent.subscribe(permission => { + this.documentActions.permissionEvent.subscribe((permission) => { this.permissionEvent.emit(permission); }), - this.documentActions.error.subscribe(errors => { + this.documentActions.error.subscribe((errors) => { this.error.emit(errors); }), - this.documentActions.success.subscribe(message => { + this.documentActions.success.subscribe((message) => { this.success.emit(message); }) ); @@ -207,13 +207,13 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy { if (target === ContentActionTarget.Folder) { if (this.folderActions) { this.subscriptions.push( - this.folderActions.permissionEvent.subscribe(permission => { + this.folderActions.permissionEvent.subscribe((permission) => { this.permissionEvent.emit(permission); }), - this.folderActions.error.subscribe(errors => { + this.folderActions.error.subscribe((errors) => { this.error.emit(errors); }), - this.folderActions.success.subscribe(message => { + this.folderActions.success.subscribe((message) => { this.success.emit(message); }) ); diff --git a/lib/content-services/document-list/components/document-list.component.spec.ts b/lib/content-services/document-list/components/document-list.component.spec.ts index 9836040a65..9d5a40b5b3 100644 --- a/lib/content-services/document-list/components/document-list.component.spec.ts +++ b/lib/content-services/document-list/components/document-list.component.spec.ts @@ -560,7 +560,7 @@ describe('DocumentList', () => { it('should emit nodeClick event', (done) => { let node = new FileNode(); - let disposableClick = documentList.nodeClick.subscribe(e => { + let disposableClick = documentList.nodeClick.subscribe((e) => { expect(e.value).toBe(node); disposableClick.unsubscribe(); done(); @@ -650,7 +650,7 @@ describe('DocumentList', () => { it('should emit file preview event on single click', (done) => { let file = new FileNode(); - let disposablePreview = documentList.preview.subscribe(e => { + let disposablePreview = documentList.preview.subscribe((e) => { expect(e.value).toBe(file); disposablePreview.unsubscribe(); done(); @@ -661,7 +661,7 @@ describe('DocumentList', () => { it('should emit file preview event on double click', (done) => { let file = new FileNode(); - let disposablePreview = documentList.preview.subscribe(e => { + let disposablePreview = documentList.preview.subscribe((e) => { expect(e.value).toBe(file); disposablePreview.unsubscribe(); done(); @@ -738,7 +738,7 @@ describe('DocumentList', () => { let called = false; documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; - documentList.preview.subscribe(val => called = true); + documentList.preview.subscribe((val) => called = true); documentList.onNodeClick(file); expect(called).toBeFalsy(); @@ -966,7 +966,7 @@ describe('DocumentList', () => { const error = { message: '{ "error": { "statusCode": 501 } }' }; spyOn(documentListService, 'getFolderNode').and.returnValue(throwError(error)); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe(error); disposableError.unsubscribe(); done(); @@ -980,7 +980,7 @@ describe('DocumentList', () => { spyOn(documentListService, 'getFolderNode').and.returnValue(of(fakeNodeWithCreatePermission)); spyOn(documentList, 'loadFolderNodesByFolderNodeId').and.returnValue(Promise.reject(error)); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe(error); disposableError.unsubscribe(); done(); @@ -1003,7 +1003,7 @@ describe('DocumentList', () => { const error = { message: '{ "error": { "statusCode": 403 } }' }; spyOn(documentListService, 'getFolderNode').and.returnValue(throwError(error)); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe(error); expect(documentList.noPermission).toBe(true); disposableError.unsubscribe(); @@ -1060,7 +1060,7 @@ describe('DocumentList', () => { documentList.currentFolderId = 'node-id'; expect(documentList.canNavigateFolder(node)).toBeTruthy(); - sources.forEach(source => { + sources.forEach((source) => { documentList.currentFolderId = source; expect(documentList.canNavigateFolder(node)).toBeFalsy(); }); @@ -1076,7 +1076,7 @@ describe('DocumentList', () => { it('should emit error when fetch trashcan fails', (done) => { spyOn(apiService.nodesApi, 'getDeletedNodes').and.returnValue(Promise.reject('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); @@ -1097,7 +1097,7 @@ describe('DocumentList', () => { spyOn(apiService.getInstance().core.sharedlinksApi, 'findSharedLinks') .and.returnValue(Promise.reject('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); @@ -1116,7 +1116,7 @@ describe('DocumentList', () => { it('should emit error when fetch sites fails', (done) => { spyGetSites.and.returnValue(Promise.reject('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); @@ -1129,7 +1129,7 @@ describe('DocumentList', () => { fixture.detectChanges(); let disposableReady = documentList.ready.subscribe((page) => { - const entriesWithoutName = page.list.entries.filter(item => !item.entry.name); + const entriesWithoutName = page.list.entries.filter((item) => !item.entry.name); expect(entriesWithoutName.length).toBe(0); disposableReady.unsubscribe(); done(); @@ -1142,7 +1142,7 @@ describe('DocumentList', () => { fixture.detectChanges(); let disposableReady = documentList.ready.subscribe((page) => { - const wrongName = page.list.entries.filter(item => (item.entry.name !== item.entry.title)); + const wrongName = page.list.entries.filter((item) => (item.entry.name !== item.entry.title)); expect(wrongName.length).toBe(0); disposableReady.unsubscribe(); done(); @@ -1163,7 +1163,7 @@ describe('DocumentList', () => { spyOn(apiService.getInstance().core.peopleApi, 'getSiteMembership') .and.returnValue(Promise.reject('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); @@ -1181,7 +1181,7 @@ describe('DocumentList', () => { expect(peopleApi.getSiteMembership).toHaveBeenCalled(); let disposableReady = documentList.ready.subscribe((page) => { - const entriesWithoutName = page.list.entries.filter(item => !item.entry.name); + const entriesWithoutName = page.list.entries.filter((item) => !item.entry.name); expect(entriesWithoutName.length).toBe(0); disposableReady.unsubscribe(); done(); @@ -1197,7 +1197,7 @@ describe('DocumentList', () => { expect(peopleApi.getSiteMembership).toHaveBeenCalled(); let disposableReady = documentList.ready.subscribe((page) => { - const wrongName = page.list.entries.filter(item => (item.entry.name !== item.entry.title)); + const wrongName = page.list.entries.filter((item) => (item.entry.name !== item.entry.title)); expect(wrongName.length).toBe(0); disposableReady.unsubscribe(); done(); @@ -1215,7 +1215,7 @@ describe('DocumentList', () => { it('should emit error when fetch favorites fails', (done) => { spyFavorite.and.returnValue(Promise.reject('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); @@ -1237,7 +1237,7 @@ describe('DocumentList', () => { it('should emit error when fetch recent fails on getPerson call', (done) => { spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.reject('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); @@ -1249,7 +1249,7 @@ describe('DocumentList', () => { xit('should emit error when fetch recent fails on search call', (done) => { spyOn(customResourcesService, 'loadFolderByNodeId').and.returnValue(throwError('error')); - let disposableError = documentList.error.subscribe(val => { + let disposableError = documentList.error.subscribe((val) => { expect(val).toBe('error'); disposableError.unsubscribe(); done(); diff --git a/lib/content-services/document-list/components/document-list.component.ts b/lib/content-services/document-list/components/document-list.component.ts index 2abf9aede5..2b16894aa7 100644 --- a/lib/content-services/document-list/components/document-list.component.ts +++ b/lib/content-services/document-list/components/document-list.component.ts @@ -286,7 +286,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } private getLayoutPreset(name: string = 'default'): DataColumn[] { - return (this.layoutPresets[name] || this.layoutPresets['default']).map(col => new ObjectDataColumn(col)); + return (this.layoutPresets[name] || this.layoutPresets['default']).map((col) => new ObjectDataColumn(col)); } get pagination(): BehaviorSubject { @@ -352,7 +352,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } this.subscriptions.push( - this.contextActionHandler.subscribe(val => this.contextActionCallback(val)) + this.contextActionHandler.subscribe((val) => this.contextActionCallback(val)) ); this.enforceSingleClickNavigationForMobile(); @@ -373,7 +373,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte let schema: DataColumn[] = []; if (this.hasCustomLayout) { - schema = this.columnList.columns.map(c => c); + schema = this.columnList.columns.map((c) => c); } if (!this.data) { @@ -422,7 +422,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } else if (changes.rowFilter && changes.rowFilter.currentValue !== changes.rowFilter.previousValue) { this.data.setFilter(changes.rowFilter.currentValue); if (this.currentFolderId) { - this.loadFolderNodesByFolderNodeId(this.currentFolderId, this.pagination.getValue()).catch(err => this.error.emit(err)); + this.loadFolderNodesByFolderNodeId(this.currentFolderId, this.pagination.getValue()).catch((err) => this.error.emit(err)); } } else if (changes.imageResolver) { this.data.setImageResolver(changes.imageResolver.currentValue); @@ -461,21 +461,21 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte if (target) { const actions = this.rowMenuCache[node.entry.id]; if (actions) { - actions.forEach(action => { + actions.forEach((action) => { this.refreshAction(action, node); }); return actions; } let actionsByTarget = this.actions - .filter(entry => { + .filter((entry) => { const isVisible = (typeof entry.visible === 'function') ? entry.visible(node) : entry.visible; return isVisible && entry.target.toLowerCase() === target; }) - .map(action => new ContentActionModel(action)); + .map((action) => new ContentActionModel(action)); actionsByTarget.forEach((action) => { this.refreshAction(action, node); @@ -604,7 +604,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte if (this.folderNode) { return this.loadFolderNodesByFolderNodeId(this.folderNode.id, this.pagination.getValue()) - .catch(err => this.handleError(err)); + .catch((err) => this.handleError(err)); } else { this.loadFolderByNodeId(this.currentFolderId); } @@ -616,7 +616,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte this.customResourcesService.loadFolderByNodeId(nodeId, this.pagination.getValue(), this.includeFields) .subscribe((page: NodePaging) => { this.onPageLoaded(page); - }, err => { + }, (err) => { this.error.emit(err); }); } else { @@ -625,8 +625,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte .subscribe((node: MinimalNodeEntryEntity) => { this.folderNode = node; return this.loadFolderNodesByFolderNodeId(node.id, this.pagination.getValue()) - .catch(err => this.handleError(err)); - }, err => { + .catch((err) => this.handleError(err)); + }, (err) => { this.handleError(err); }); } @@ -642,12 +642,12 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte rootFolderId: id }, this.includeFields) .subscribe( - nodePaging => { + (nodePaging) => { this.data.loadPage( nodePaging, this.pagination.getValue().merge); this.setLoadingState(false); this.onDataReady(nodePaging); resolve(true); - }, err => { + }, (err) => { this.handleError(err); }); }); @@ -740,7 +740,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } onNodeSelect(event: { row: ShareDataRow, selection: Array }) { - this.selection = event.selection.map(entry => entry.node); + this.selection = event.selection.map((entry) => entry.node); const domEvent = new CustomEvent('node-select', { detail: { node: event.row.node, @@ -752,7 +752,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } onNodeUnselect(event: { row: ShareDataRow, selection: Array }) { - this.selection = event.selection.map(entry => entry.node); + this.selection = event.selection.map((entry) => entry.node); const domEvent = new CustomEvent('node-unselect', { detail: { node: event.row.node, @@ -844,7 +844,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte } ngOnDestroy() { - this.subscriptions.forEach(s => s.unsubscribe()); + this.subscriptions.forEach((s) => s.unsubscribe()); this.subscriptions = []; } diff --git a/lib/content-services/document-list/data/share-datatable-adapter.ts b/lib/content-services/document-list/data/share-datatable-adapter.ts index 16bd5249e3..20bee66215 100644 --- a/lib/content-services/document-list/data/share-datatable-adapter.ts +++ b/lib/content-services/document-list/data/share-datatable-adapter.ts @@ -241,7 +241,7 @@ export class ShareDataTableAdapter implements DataTableAdapter { if (page && page.list) { let data = page.list.entries; if (data && data.length > 0) { - rows = data.map(item => new ShareDataRow(item, this.documentListService, this.permissionsStyle, this.thumbnailService)); + rows = data.map((item) => new ShareDataRow(item, this.documentListService, this.permissionsStyle, this.thumbnailService)); if (this.filter) { rows = rows.filter(this.filter); @@ -254,7 +254,7 @@ export class ShareDataTableAdapter implements DataTableAdapter { if (sorting) { this.sortRows(rows, sorting); } else { - let sortable = this.columns.filter(c => c.sortable); + let sortable = this.columns.filter((c) => c.sortable); if (sortable.length > 0) { this.sort(sortable[0].key, 'asc'); } else { diff --git a/lib/content-services/document-list/services/custom-resources.service.ts b/lib/content-services/document-list/services/custom-resources.service.ts index 161e623ed9..236ccc76ac 100644 --- a/lib/content-services/document-list/services/custom-resources.service.ts +++ b/lib/content-services/document-list/services/custom-resources.service.ts @@ -50,7 +50,7 @@ export class CustomResourcesService { * @returns List of nodes for the recently used files */ getRecentFiles(personId: string, pagination: PaginationModel): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.apiService.peopleApi.getPerson(personId) .then((person: PersonEntry) => { const username = person.entry.id; @@ -89,7 +89,7 @@ export class CustomResourcesService { observer.error(err); observer.complete(); }); - }).pipe(catchError(err => this.handleError(err))); + }).pipe(catchError((err) => this.handleError(err))); } /** @@ -108,7 +108,7 @@ export class CustomResourcesService { include: includeFieldsRequest }; - return new Observable(observer => { + return new Observable((observer) => { this.apiService.favoritesApi.getFavorites('-me-', options) .then((result: NodePaging) => { let page: NodePaging = { @@ -135,7 +135,7 @@ export class CustomResourcesService { observer.error(err); observer.complete(); }); - }).pipe(catchError(err => this.handleError(err))); + }).pipe(catchError((err) => this.handleError(err))); } /** @@ -150,7 +150,7 @@ export class CustomResourcesService { skipCount: pagination.skipCount }; - return new Observable(observer => { + return new Observable((observer) => { this.apiService.peopleApi.getSiteMembership('-me-', options) .then((result: SitePaging) => { let page: NodePaging = { @@ -174,7 +174,7 @@ export class CustomResourcesService { observer.error(err); observer.complete(); }); - }).pipe(catchError(err => this.handleError(err))); + }).pipe(catchError((err) => this.handleError(err))); } /** @@ -189,7 +189,7 @@ export class CustomResourcesService { skipCount: pagination.skipCount }; - return new Observable(observer => { + return new Observable((observer) => { this.apiService.sitesApi.getSites(options) .then((page: NodePaging) => { page.list.entries.map( @@ -205,7 +205,7 @@ export class CustomResourcesService { observer.error(err); observer.complete(); }); - }).pipe(catchError(err => this.handleError(err))); + }).pipe(catchError((err) => this.handleError(err))); } /** @@ -224,7 +224,7 @@ export class CustomResourcesService { }; return from(this.apiService.nodesApi.getDeletedNodes(options)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } @@ -244,7 +244,7 @@ export class CustomResourcesService { }; return from(this.apiService.sharedLinksApi.findSharedLinks(options)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -314,7 +314,7 @@ export class CustomResourcesService { if (this.isCustomSource(nodeId)) { return this.loadFolderByNodeId(nodeId, pagination, []) - .pipe(map(result => result.list.entries.map((node: any) => { + .pipe(map((result) => result.list.entries.map((node: any) => { if (nodeId === '-sharedlinks-') { return node.entry.nodeId; @@ -331,7 +331,7 @@ export class CustomResourcesService { } else if (nodeId) { // cases when nodeId is '-my-', '-root-' or '-shared-' return from(this.apiService.nodesApi.getNode(nodeId) - .then(node => [node.entry.id])); + .then((node) => [node.entry.id])); } return of([]); diff --git a/lib/content-services/document-list/services/document-list.service.spec.ts b/lib/content-services/document-list/services/document-list.service.spec.ts index 044f52e815..8f154a6e7c 100644 --- a/lib/content-services/document-list/services/document-list.service.spec.ts +++ b/lib/content-services/document-list/services/document-list.service.spec.ts @@ -107,7 +107,7 @@ describe('DocumentListService', () => { it('should create a folder in the path', () => { service.createFolder('fake-name', 'fake-path').subscribe( - res => { + (res) => { expect(res).toBeDefined(); expect(res.entry).toBeDefined(); expect(res.entry.isFolder).toBeTruthy(); @@ -125,10 +125,10 @@ describe('DocumentListService', () => { it('should emit an error when the folder already exist', () => { service.createFolder('fake-name', 'fake-path').subscribe( - res => { + (res) => { }, - err => { + (err) => { expect(err).toBeDefined(); expect(err.status).toEqual(409); expect(err.response).toBeDefined(); @@ -144,7 +144,7 @@ describe('DocumentListService', () => { it('should return the folder info', () => { service.getFolder('/fake-root/fake-name').subscribe( - res => { + (res) => { expect(res).toBeDefined(); expect(res.list).toBeDefined(); expect(res.list.entries).toBeDefined(); @@ -210,7 +210,7 @@ describe('DocumentListService', () => { it('should delete the folder', () => { service.deleteNode('fake-id').subscribe( - res => { + (res) => { expect(res).toBeNull(); } ); diff --git a/lib/content-services/document-list/services/document-list.service.ts b/lib/content-services/document-list/services/document-list.service.ts index 3a33f59eb6..a97cc3d7b1 100644 --- a/lib/content-services/document-list/services/document-list.service.ts +++ b/lib/content-services/document-list/services/document-list.service.ts @@ -88,7 +88,7 @@ export class DocumentListService { */ copyNode(nodeId: string, targetParentId: string) { return from(this.apiService.getInstance().nodes.copyNode(nodeId, { targetParentId })).pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -101,7 +101,7 @@ export class DocumentListService { */ moveNode(nodeId: string, targetParentId: string) { return from(this.apiService.getInstance().nodes.moveNode(nodeId, { targetParentId })).pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -114,7 +114,7 @@ export class DocumentListService { createFolder(name: string, parentId: string): Observable { return from(this.apiService.getInstance().nodes.createFolder(name, '/', parentId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -128,7 +128,7 @@ export class DocumentListService { getFolder(folder: string, opts?: any, includeFields: string[] = []): Observable { return from(this.getNodesPromise(folder, opts, includeFields)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/content-services/document-list/services/folder-actions.service.spec.ts b/lib/content-services/document-list/services/folder-actions.service.spec.ts index 0b8e7f9431..0452d26ce1 100644 --- a/lib/content-services/document-list/services/folder-actions.service.spec.ts +++ b/lib/content-services/document-list/services/folder-actions.service.spec.ts @@ -107,7 +107,7 @@ describe('FolderActionsService', () => { it('should delete the folder node if there is the delete permission', () => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -125,7 +125,7 @@ describe('FolderActionsService', () => { it('should not delete the folder node if there is no delete permission', (done) => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -146,7 +146,7 @@ describe('FolderActionsService', () => { it('should call the error on the returned Observable if there is no delete permission', (done) => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -168,7 +168,7 @@ describe('FolderActionsService', () => { it('should delete the folder node if there is the delete and others permission ', () => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -185,7 +185,7 @@ describe('FolderActionsService', () => { it('should support deletion only folder node', () => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -205,7 +205,7 @@ describe('FolderActionsService', () => { it('should require node id to delete', () => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -220,7 +220,7 @@ describe('FolderActionsService', () => { it('should reload target upon node deletion', (done) => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -244,7 +244,7 @@ describe('FolderActionsService', () => { it('should emit success event upon node deletion', (done) => { spyOn(documentListService, 'deleteNode').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); diff --git a/lib/content-services/folder-directive/folder-create.directive.spec.ts b/lib/content-services/folder-directive/folder-create.directive.spec.ts index 8fea7bb8a4..b917fd696e 100644 --- a/lib/content-services/folder-directive/folder-create.directive.spec.ts +++ b/lib/content-services/folder-directive/folder-create.directive.spec.ts @@ -88,7 +88,7 @@ describe('FolderCreateDirective', () => { node = { entry: { id: 'nodeId' } }; dialogRefMock = { - afterClosed: val => of(val), + afterClosed: (val) => of(val), componentInstance: { error: new Subject(), success: new Subject() diff --git a/lib/content-services/folder-directive/folder-edit.directive.spec.ts b/lib/content-services/folder-directive/folder-edit.directive.spec.ts index a119cbda3d..bbd9fc2ce4 100644 --- a/lib/content-services/folder-directive/folder-edit.directive.spec.ts +++ b/lib/content-services/folder-directive/folder-edit.directive.spec.ts @@ -71,7 +71,7 @@ describe('FolderEditDirective', () => { node = { entry: { id: 'folderId' } }; dialogRefMock = { - afterClosed: val => of(val), + afterClosed: (val) => of(val), componentInstance: { error: new Subject(), success: new Subject() diff --git a/lib/content-services/mock/document-list.service.mock.ts b/lib/content-services/mock/document-list.service.mock.ts index 8a9640fc7e..d0344427c3 100644 --- a/lib/content-services/mock/document-list.service.mock.ts +++ b/lib/content-services/mock/document-list.service.mock.ts @@ -42,14 +42,14 @@ export class DocumentListServiceMock extends DocumentListService { if (this.getFolderReject) { return throwError(this.getFolderRejectError); } - return new Observable(observer => { + return new Observable((observer) => { observer.next(this.getFolderResult); observer.complete(); }); } deleteNode(nodeId: string) { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); diff --git a/lib/content-services/permission-manager/services/node-permission-dialog.service.ts b/lib/content-services/permission-manager/services/node-permission-dialog.service.ts index c351b27cbe..c2edb8cb0e 100644 --- a/lib/content-services/permission-manager/services/node-permission-dialog.service.ts +++ b/lib/content-services/permission-manager/services/node-permission-dialog.service.ts @@ -84,10 +84,10 @@ export class NodePermissionDialogService { updateNodePermissionByDialog(nodeId?: string, title?: string): Observable { return this.contentService.getNode(nodeId, { include: ['allowableOperations'] }) .pipe( - switchMap(node => { + switchMap((node) => { return this.openAddPermissionDialog(node.entry, title) .pipe( - switchMap(selection => { + switchMap((selection) => { return this.nodePermissionService.updateNodePermissions(nodeId, selection); }) ); diff --git a/lib/content-services/permission-manager/services/node-permission.service.ts b/lib/content-services/permission-manager/services/node-permission.service.ts index b54de864ac..aa2d068c0d 100644 --- a/lib/content-services/permission-manager/services/node-permission.service.ts +++ b/lib/content-services/permission-manager/services/node-permission.service.ts @@ -78,7 +78,7 @@ export class NodePermissionService { */ updateNodePermissions(nodeId: string, permissionList: MinimalNodeEntity[]): Observable { return this.nodeService.getNode(nodeId).pipe( - switchMap(node => { + switchMap((node) => { return this.getNodeRoles(node).pipe( switchMap((nodeRoles) => of({node, nodeRoles}) ) ); diff --git a/lib/content-services/search/components/search-check-list/search-check-list.component.ts b/lib/content-services/search/components/search-check-list/search-check-list.component.ts index 0b08c4baf1..a955f3918f 100644 --- a/lib/content-services/search/components/search-check-list/search-check-list.component.ts +++ b/lib/content-services/search/components/search-check-list/search-check-list.component.ts @@ -60,7 +60,7 @@ export class SearchCheckListComponent implements SearchWidget, OnInit { } reset() { - this.options.items.forEach(opt => { + this.options.items.forEach((opt) => { opt.checked = false; }); @@ -77,8 +77,8 @@ export class SearchCheckListComponent implements SearchWidget, OnInit { flush() { const checkedValues = this.options.items - .filter(option => option.checked) - .map(option => option.value); + .filter((option) => option.checked) + .map((option) => option.value); const query = checkedValues.join(` ${this.operator} `); diff --git a/lib/content-services/search/components/search-control.component.spec.ts b/lib/content-services/search/components/search-control.component.spec.ts index 81c8cfb975..f1fdc08d7f 100644 --- a/lib/content-services/search/components/search-control.component.spec.ts +++ b/lib/content-services/search/components/search-control.component.spec.ts @@ -120,7 +120,7 @@ describe('SearchControlComponent', () => { of({ entry: { list: [] } }) ); - let searchDisposable = component.searchChange.subscribe(value => { + let searchDisposable = component.searchChange.subscribe((value) => { expect(value).toBe('customSearchTerm'); searchDisposable.unsubscribe(); done(); @@ -161,7 +161,7 @@ describe('SearchControlComponent', () => { it('should still fire an event when user inputs a search term less than 3 characters', (done) => { searchServiceSpy.and.returnValue(of(JSON.parse(JSON.stringify(results)))); - let searchDisposable = component.searchChange.subscribe(value => { + let searchDisposable = component.searchChange.subscribe((value) => { expect(value).toBe('cu'); searchDisposable.unsubscribe(); }); diff --git a/lib/content-services/search/components/search-filter/models/response-facet-query-list.model.ts b/lib/content-services/search/components/search-filter/models/response-facet-query-list.model.ts index dd13436c94..965a3414b0 100644 --- a/lib/content-services/search/components/search-filter/models/response-facet-query-list.model.ts +++ b/lib/content-services/search/components/search-filter/models/response-facet-query-list.model.ts @@ -22,7 +22,7 @@ export class ResponseFacetQueryList extends SearchFilterList { constructor(items: FacetQuery[] = [], translationService, pageSize: number = 5) { super( items - .filter(item => { + .filter((item) => { return item.count > 0; }), pageSize diff --git a/lib/content-services/search/components/search-filter/search-filter.component.ts b/lib/content-services/search/components/search-filter/search-filter.component.ts index 9d91782894..38eaf64252 100644 --- a/lib/content-services/search/components/search-filter/search-filter.component.ts +++ b/lib/content-services/search/components/search-filter/search-filter.component.ts @@ -119,8 +119,8 @@ export class SearchFilterComponent implements OnInit, OnDestroy { if (field.buckets) { this.selectedBuckets.push( ...this.queryBuilder.getUserFacetBuckets(field.field) - .filter(bucket => bucket.checked) - .map(bucket => { + .filter((bucket) => bucket.checked) + .map((bucket) => { return { field, bucket }; }) ); @@ -133,7 +133,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy { private updateSelectedFields() { if (this.responseFacetQueries) { - this.selectedFacetQueries = this.responseFacetQueries.items.filter(item => item.checked); + this.selectedFacetQueries = this.responseFacetQueries.items.filter((item) => item.checked); this.canResetSelectedQueries = this.selectedFacetQueries.length > 0; } else { this.selectedFacetQueries = []; @@ -183,7 +183,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy { canResetSelectedBuckets(field: FacetField): boolean { if (field && field.buckets) { - return field.buckets.items.some(bucket => bucket.checked); + return field.buckets.items.some((bucket) => bucket.checked); } return false; } @@ -215,10 +215,10 @@ export class SearchFilterComponent implements OnInit, OnDestroy { if (!this.responseFacetFields) { const configFacetFields = this.queryBuilder.config.facetFields && this.queryBuilder.config.facetFields.fields || []; - this.responseFacetFields = configFacetFields.map(field => { - const responseField = (context.facetsFields || []).find(response => response.label === field.label); - const buckets: FacetFieldBucket[] = ((responseField && responseField.buckets) || []).map(bucket => { - const selectedBucket = this.selectedBuckets.find(facetBucket => + this.responseFacetFields = configFacetFields.map((field) => { + const responseField = (context.facetsFields || []).find((response) => response.label === field.label); + const buckets: FacetFieldBucket[] = ((responseField && responseField.buckets) || []).map((bucket) => { + const selectedBucket = this.selectedBuckets.find((facetBucket) => facetBucket.bucket.label === bucket.label && facetBucket.field.field === field.field); return { @@ -249,13 +249,13 @@ export class SearchFilterComponent implements OnInit, OnDestroy { } else { this.responseFacetFields = this.responseFacetFields - .map(field => { + .map((field) => { - let responseField = (context.facetsFields || []).find(response => response.label === field.label); + let responseField = (context.facetsFields || []).find((response) => response.label === field.label); (field && field.buckets && field.buckets.items || []) - .map(bucket => { - const responseBucket = ((responseField && responseField.buckets) || []).find(respBucket => respBucket.label === bucket.label); + .map((bucket) => { + const responseBucket = ((responseField && responseField.buckets) || []).find((respBucket) => respBucket.label === bucket.label); bucket.count = responseBucket ? responseBucket.count : 0; return bucket; @@ -271,10 +271,10 @@ export class SearchFilterComponent implements OnInit, OnDestroy { if (this.queryBuilder.config.facetQueries) { const bkpResponseFacetQueries = Object.assign({}, this.responseFacetQueries); const facetQueries = (this.queryBuilder.config.facetQueries.queries || []) - .map(query => { + .map((query) => { const queryResult = responseQueries[query.label]; - const bkpQuery = (bkpResponseFacetQueries.items || []).find(item => item.label === query.label); + const bkpQuery = (bkpResponseFacetQueries.items || []).find((item) => item.label === query.label); if (bkpQuery) { bkpQuery.count = queryResult.count; @@ -304,7 +304,7 @@ export class SearchFilterComponent implements OnInit, OnDestroy { private getFacetQueryMap(context: any): { [key: string]: any } { const result = {}; - (context.facetQueries || []).forEach(query => { + (context.facetQueries || []).forEach((query) => { result[query.label] = query; }); diff --git a/lib/content-services/search/components/search-radio/search-radio.component.ts b/lib/content-services/search/components/search-radio/search-radio.component.ts index 268a0c6889..bb05f74081 100644 --- a/lib/content-services/search/components/search-radio/search-radio.component.ts +++ b/lib/content-services/search/components/search-radio/search-radio.component.ts @@ -70,7 +70,7 @@ export class SearchRadioComponent implements SearchWidget, OnInit { private getSelectedValue(): string { const options: any[] = this.settings['options'] || []; if (options && options.length > 0) { - let selected = options.find(opt => opt.default); + let selected = options.find((opt) => opt.default); if (!selected) { selected = options[0]; } diff --git a/lib/content-services/search/components/search-sorting-picker/search-sorting-picker.component.ts b/lib/content-services/search/components/search-sorting-picker/search-sorting-picker.component.ts index 053797cf42..4e9333b303 100644 --- a/lib/content-services/search/components/search-sorting-picker/search-sorting-picker.component.ts +++ b/lib/content-services/search/components/search-sorting-picker/search-sorting-picker.component.ts @@ -51,7 +51,7 @@ export class SearchSortingPickerComponent implements OnInit { private findOptionByKey(key: string): SearchSortingDefinition { if (key) { - return this.options.find(opt => opt.key === key); + return this.options.find((opt) => opt.key === key); } return null; } diff --git a/lib/content-services/search/components/search-trigger.directive.ts b/lib/content-services/search/components/search-trigger.directive.ts index 6a7f639af3..6e82a1860d 100644 --- a/lib/content-services/search/components/search-trigger.directive.ts +++ b/lib/content-services/search/components/search-trigger.directive.ts @@ -197,7 +197,7 @@ export class SearchTriggerDirective implements ControlValueAccessor, OnDestroy { }), takeUntil(this.onDestroy$) ) - .subscribe(event => this.setValueAndClose(event)); + .subscribe((event) => this.setValueAndClose(event)); } private setTriggerValue(value: any): void { diff --git a/lib/content-services/search/components/search.component.ts b/lib/content-services/search/components/search.component.ts index 5db3475c16..84bd799fbd 100644 --- a/lib/content-services/search/components/search.component.ts +++ b/lib/content-services/search/components/search.component.ts @@ -78,7 +78,7 @@ export class SearchComponent implements AfterContentInit, OnChanges { @Input('class') set classList(classList: string) { if (classList && classList.length) { - classList.split(' ').forEach(className => this._classList[className.trim()] = true); + classList.split(' ').forEach((className) => this._classList[className.trim()] = true); this._elementRef.nativeElement.className = ''; } } @@ -119,8 +119,8 @@ export class SearchComponent implements AfterContentInit, OnChanges { }); searchService.dataLoaded.subscribe( - data => this.onSearchDataLoaded(data), - error => this.onSearchDataError(error) + (data) => this.onSearchDataLoaded(data), + (error) => this.onSearchDataError(error) ); } @@ -162,13 +162,13 @@ export class SearchComponent implements AfterContentInit, OnChanges { if (searchTerm) { if (this.queryBody) { this.searchService.searchByQueryBody(this.queryBody).subscribe( - result => this.onSearchDataLoaded(result), - err => this.onSearchDataError(err) + (result) => this.onSearchDataLoaded(result), + (err) => this.onSearchDataError(err) ); } else { this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe( - result => this.onSearchDataLoaded(result), - err => this.onSearchDataError(err) + (result) => this.onSearchDataLoaded(result), + (err) => this.onSearchDataError(err) ); } } else { diff --git a/lib/content-services/search/search-query-builder.service.spec.ts b/lib/content-services/search/search-query-builder.service.spec.ts index 0a1727f370..c4db35d4de 100644 --- a/lib/content-services/search/search-query-builder.service.spec.ts +++ b/lib/content-services/search/search-query-builder.service.spec.ts @@ -222,7 +222,7 @@ describe('SearchQueryBuilder', () => { spyOn(builder, 'buildQuery').and.returnValue(query); let eventArgs; - builder.updated.subscribe(args => eventArgs = args); + builder.updated.subscribe((args) => eventArgs = args); await builder.execute(); expect(eventArgs).toBe(query); @@ -237,7 +237,7 @@ describe('SearchQueryBuilder', () => { spyOn(builder, 'buildQuery').and.returnValue({}); let eventArgs; - builder.executed.subscribe(args => eventArgs = args); + builder.executed.subscribe((args) => eventArgs = args); await builder.execute(); expect(eventArgs).toBe(data); diff --git a/lib/content-services/search/search-query-builder.service.ts b/lib/content-services/search/search-query-builder.service.ts index ee07297c68..e007055517 100644 --- a/lib/content-services/search/search-query-builder.service.ts +++ b/lib/content-services/search/search-query-builder.service.ts @@ -69,7 +69,7 @@ export class SearchQueryBuilderService { const template = this.appConfig.get('search'); if (template) { this.config = JSON.parse(JSON.stringify(template)); - this.categories = (this.config.categories || []).filter(category => category.enabled); + this.categories = (this.config.categories || []).filter((category) => category.enabled); this.filterQueries = this.config.filterQueries || []; this.userFacetBuckets = {}; this.userFacetQueries = []; @@ -81,7 +81,7 @@ export class SearchQueryBuilderService { addUserFacetQuery(query: FacetQuery) { if (query) { - const existing = this.userFacetQueries.find(facetQuery => facetQuery.label === query.label); + const existing = this.userFacetQueries.find((facetQuery) => facetQuery.label === query.label); if (existing) { existing.query = query.query; } else { @@ -93,14 +93,14 @@ export class SearchQueryBuilderService { removeUserFacetQuery(query: FacetQuery) { if (query) { this.userFacetQueries = this.userFacetQueries - .filter(facetQuery => facetQuery.label !== query.label); + .filter((facetQuery) => facetQuery.label !== query.label); } } addUserFacetBucket(field: FacetField, bucket: FacetFieldBucket) { if (field && field.field && bucket) { const buckets = this.userFacetBuckets[field.field] || []; - const existing = buckets.find(facetBucket => facetBucket.label === bucket.label); + const existing = buckets.find((facetBucket) => facetBucket.label === bucket.label); if (!existing) { buckets.push(bucket); } @@ -116,13 +116,13 @@ export class SearchQueryBuilderService { if (field && field.field && bucket) { const buckets = this.userFacetBuckets[field.field] || []; this.userFacetBuckets[field.field] = buckets - .filter(facetBucket => facetBucket.label !== bucket.label); + .filter((facetBucket) => facetBucket.label !== bucket.label); } } addFilterQuery(query: string): void { if (query) { - const existing = this.filterQueries.find(filterQuery => filterQuery.query === query); + const existing = this.filterQueries.find((filterQuery) => filterQuery.query === query); if (!existing) { this.filterQueries.push({ query: query }); } @@ -132,13 +132,13 @@ export class SearchQueryBuilderService { removeFilterQuery(query: string): void { if (query) { this.filterQueries = this.filterQueries - .filter(filterQuery => filterQuery.query !== query); + .filter((filterQuery) => filterQuery.query !== query); } } getFacetQuery(label: string): FacetQuery { if (label && this.hasFacetQueries) { - const result = this.config.facetQueries.queries.find(query => query.label === label); + const result = this.config.facetQueries.queries.find((query) => query.label === label); if (result) { return { ...result }; } @@ -149,7 +149,7 @@ export class SearchQueryBuilderService { getFacetField(label: string): FacetField { if (label) { const fields = this.config.facetFields.fields || []; - const result = fields.find(field => field.label === label); + const result = fields.find((field) => field.label === label); if (result) { return { ...result }; } @@ -233,7 +233,7 @@ export class SearchQueryBuilderService { } protected get sort(): RequestSortDefinitionInner[] { - return this.sorting.map(def => { + return this.sorting.map((def) => { return { type: def.type, field: def.field, @@ -244,7 +244,7 @@ export class SearchQueryBuilderService { protected get facetQueries(): FacetQuery[] { if (this.hasFacetQueries) { - return this.config.facetQueries.queries.map(query => { + return this.config.facetQueries.queries.map((query) => { return { ...query }; }); } @@ -255,7 +255,7 @@ export class SearchQueryBuilderService { protected getFinalQuery(): string { let query = ''; - this.categories.forEach(facet => { + this.categories.forEach((facet) => { const customQuery = this.queryFragments[facet.id]; if (customQuery) { if (query.length > 0) { @@ -266,20 +266,20 @@ export class SearchQueryBuilderService { }); let result = [this.userQuery, query] - .filter(entry => entry) + .filter((entry) => entry) .join(' AND '); if (this.userFacetQueries && this.userFacetQueries.length > 0) { const combined = this.userFacetQueries - .map(userQuery => userQuery.query) + .map((userQuery) => userQuery.query) .join(' OR '); result += ` AND (${combined})`; } if (this.userFacetBuckets) { - Object.keys(this.userFacetBuckets).forEach(key => { + Object.keys(this.userFacetBuckets).forEach((key) => { const subQuery = (this.userFacetBuckets[key] || []) - .map(bucket => bucket.filterQuery) + .map((bucket) => bucket.filterQuery) .join(' OR '); if (subQuery) { if (result.length > 0) { @@ -298,7 +298,7 @@ export class SearchQueryBuilderService { if (facetFields && facetFields.length > 0) { return { - facets: facetFields.map(facet => { + facets: facetFields.map((facet) => { field: facet.field, mincount: facet.mincount, label: facet.label, diff --git a/lib/content-services/site-dropdown/sites-dropdown.component.ts b/lib/content-services/site-dropdown/sites-dropdown.component.ts index 2fca489561..ce395e9164 100644 --- a/lib/content-services/site-dropdown/sites-dropdown.component.ts +++ b/lib/content-services/site-dropdown/sites-dropdown.component.ts @@ -105,7 +105,7 @@ export class DropdownSitesComponent implements OnInit { } } - this.selected = this.siteList.list.entries.find(site => site.entry.id === this.value); + this.selected = this.siteList.list.entries.find((site) => site.entry.id === this.value); }, (error) => { this.logService.error(error); diff --git a/lib/content-services/tag/services/tag.service.ts b/lib/content-services/tag/services/tag.service.ts index 040f9680af..05a8d36363 100644 --- a/lib/content-services/tag/services/tag.service.ts +++ b/lib/content-services/tag/services/tag.service.ts @@ -41,7 +41,7 @@ export class TagService { */ getTagsByNodeId(nodeId: string): any { return from(this.apiService.getInstance().core.tagsApi.getNodeTags(nodeId)).pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -52,7 +52,7 @@ export class TagService { */ getAllTheTags(opts?: any): Observable { return from(this.apiService.getInstance().core.tagsApi.getTags(opts)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** diff --git a/lib/content-services/tag/tag-actions.component.ts b/lib/content-services/tag/tag-actions.component.ts index 64d566977d..ee02b7b575 100644 --- a/lib/content-services/tag/tag-actions.component.ts +++ b/lib/content-services/tag/tag-actions.component.ts @@ -71,7 +71,7 @@ export class TagActionsComponent implements OnChanges, OnInit, OnDestroy { } ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.subscriptions.forEach((subscription) => subscription.unsubscribe()); this.subscriptions = []; } diff --git a/lib/content-services/tree-view/data/tree-view-datasource.ts b/lib/content-services/tree-view/data/tree-view-datasource.ts index 832943de23..948ff46ed1 100644 --- a/lib/content-services/tree-view/data/tree-view-datasource.ts +++ b/lib/content-services/tree-view/data/tree-view-datasource.ts @@ -46,7 +46,7 @@ export class TreeViewDataSource { } connect(collectionViewer: CollectionViewer): Observable { - this.changeSubscription = this.treeControl.expansionModel.onChange.subscribe(change => { + this.changeSubscription = this.treeControl.expansionModel.onChange.subscribe((change) => { if ((change as SelectionChange).added && (change as SelectionChange).added.length > 0) { this.expandTreeNodes(change as SelectionChange); @@ -67,11 +67,11 @@ export class TreeViewDataSource { } private expandTreeNodes(change: SelectionChange) { - change.added.forEach(node => this.expandNode(node)); + change.added.forEach((node) => this.expandNode(node)); } private reduceTreeNodes(change: SelectionChange) { - change.removed.slice().reverse().forEach(node => this.toggleNode(node)); + change.removed.slice().reverse().forEach((node) => this.toggleNode(node)); } private expandNode(node: TreeBaseNode) { @@ -82,7 +82,7 @@ export class TreeViewDataSource { node.expandable = false; return; } - const nodes = children.map(actualNode => { + const nodes = children.map((actualNode) => { actualNode.level = node.level + 1; return actualNode; }); diff --git a/lib/content-services/tree-view/services/tree-view.service.ts b/lib/content-services/tree-view/services/tree-view.service.ts index cbf8f7a633..c7dd883409 100644 --- a/lib/content-services/tree-view/services/tree-view.service.ts +++ b/lib/content-services/tree-view/services/tree-view.service.ts @@ -36,7 +36,7 @@ export class TreeViewService { map((nodePage: NodePaging) => { return nodePage.list.entries.filter((node) => node.entry.isFolder ? node : null); }), - map((nodes: NodeEntry[]) => nodes.map(node => new TreeBaseNode(node))) + map((nodes: NodeEntry[]) => nodes.map((node) => new TreeBaseNode(node))) ); } diff --git a/lib/content-services/upload/components/base-upload/upload-base.spec.ts b/lib/content-services/upload/components/base-upload/upload-base.spec.ts index fb1113f780..7d4df105e9 100644 --- a/lib/content-services/upload/components/base-upload/upload-base.spec.ts +++ b/lib/content-services/upload/components/base-upload/upload-base.spec.ts @@ -71,7 +71,7 @@ describe('UploadBase', () => { describe('beginUpload', () => { - it('should raise event', done => { + it('should raise event', (done) => { spyOn(uploadService, 'addToQueue').and.stub(); spyOn(uploadService, 'uploadFilesInTheQueue').and.stub(); @@ -86,7 +86,7 @@ describe('UploadBase', () => { spyOn(uploadService, 'uploadFilesInTheQueue').and.stub(); let prevented = false; - component.beginUpload.subscribe(event => { + component.beginUpload.subscribe((event) => { event.preventDefault(); prevented = true; }); @@ -105,7 +105,7 @@ describe('UploadBase', () => { let prevented = false; let uploadEvent: UploadFilesEvent; - component.beginUpload.subscribe(event => { + component.beginUpload.subscribe((event) => { uploadEvent = event; event.preventDefault(); prevented = true; @@ -132,7 +132,7 @@ describe('UploadBase', () => { spyOn(uploadService, 'uploadFilesInTheQueue').and.stub(); let uploadEvent: UploadFilesEvent; - component.beginUpload.subscribe(event => { + component.beginUpload.subscribe((event) => { uploadEvent = event; event.preventDefault(); }); diff --git a/lib/content-services/upload/components/base-upload/upload-base.ts b/lib/content-services/upload/components/base-upload/upload-base.ts index b05d984a58..ff0daebc58 100644 --- a/lib/content-services/upload/components/base-upload/upload-base.ts +++ b/lib/content-services/upload/components/base-upload/upload-base.ts @@ -95,7 +95,7 @@ export abstract class UploadBase implements OnInit, OnDestroy { } ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.subscriptions.forEach((subscription) => subscription.unsubscribe()); this.subscriptions = []; } @@ -156,7 +156,7 @@ export abstract class UploadBase implements OnInit, OnDestroy { const allowedExtensions = this.acceptedFilesType .split(',') - .map(ext => ext.replace(/^\./, '')); + .map((ext) => ext.replace(/^\./, '')); if (allowedExtensions.indexOf(file.extension) !== -1) { return true; diff --git a/lib/content-services/upload/components/upload-button.component.spec.ts b/lib/content-services/upload/components/upload-button.component.spec.ts index a14ccf4af5..7657093c07 100644 --- a/lib/content-services/upload/components/upload-button.component.spec.ts +++ b/lib/content-services/upload/components/upload-button.component.spec.ts @@ -167,7 +167,7 @@ describe('UploadButtonComponent', () => { component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); - component.success.subscribe(e => { + component.success.subscribe((e) => { expect(e.value).toEqual('File uploaded'); done(); }); diff --git a/lib/content-services/upload/components/upload-button.component.ts b/lib/content-services/upload/components/upload-button.component.ts index d101b716f1..f9e637a4ac 100644 --- a/lib/content-services/upload/components/upload-button.component.ts +++ b/lib/content-services/upload/components/upload-button.component.ts @@ -119,8 +119,8 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang }; this.contentService.getNode(this.rootFolderId, opts).subscribe( - res => this.permissionValue.next(this.nodeHasPermission(res.entry, PermissionsEnum.CREATE)), - error => this.error.emit(error) + (res) => this.permissionValue.next(this.nodeHasPermission(res.entry, PermissionsEnum.CREATE)), + (error) => this.error.emit(error) ); } } diff --git a/lib/content-services/upload/components/upload-drag-area.component.ts b/lib/content-services/upload/components/upload-drag-area.component.ts index cd1c84bcf6..67039876c6 100644 --- a/lib/content-services/upload/components/upload-drag-area.component.ts +++ b/lib/content-services/upload/components/upload-drag-area.component.ts @@ -84,7 +84,7 @@ export class UploadDragAreaComponent extends UploadBase implements NodePermissio */ onFolderEntityDropped(folder: any): void { if (!this.disabled && folder.isDirectory) { - FileUtils.flatten(folder).then(filesInfo => { + FileUtils.flatten(folder).then((filesInfo) => { this.uploadFilesInfo(filesInfo); }); } diff --git a/lib/content-services/version-manager/version-list.component.ts b/lib/content-services/version-manager/version-list.component.ts index 752ab1d525..c20c3f75f0 100644 --- a/lib/content-services/version-manager/version-list.component.ts +++ b/lib/content-services/version-manager/version-list.component.ts @@ -117,7 +117,7 @@ export class VersionListComponent implements OnChanges { minWidth: '250px' }); - dialogRef.afterClosed().subscribe(result => { + dialogRef.afterClosed().subscribe((result) => { if (result === true) { this.alfrescoApi.versionsApi .deleteVersion(this.node.id, versionId) diff --git a/lib/content-services/version-manager/version-manager.component.spec.ts b/lib/content-services/version-manager/version-manager.component.spec.ts index 7701dcf99f..c4f30cf871 100644 --- a/lib/content-services/version-manager/version-manager.component.spec.ts +++ b/lib/content-services/version-manager/version-manager.component.spec.ts @@ -101,7 +101,7 @@ describe('VersionManagerComponent', () => { fixture.detectChanges(); const emittedData = { value: { entry: node }}; - component.uploadSuccess.subscribe(event => { + component.uploadSuccess.subscribe((event) => { expect(event).toBe(node); }); component.onUploadSuccess(emittedData); diff --git a/lib/core/app-config/app-config.service.spec.ts b/lib/core/app-config/app-config.service.spec.ts index 9fd279b915..d2cf35bdec 100644 --- a/lib/core/app-config/app-config.service.spec.ts +++ b/lib/core/app-config/app-config.service.spec.ts @@ -126,7 +126,7 @@ describe('AppConfigService', () => { }); it('should load external settings', () => { - appConfigService.load().then(config => { + appConfigService.load().then((config) => { expect(config).toEqual(mockResponse); }); }); diff --git a/lib/core/app-config/app-config.service.ts b/lib/core/app-config/app-config.service.ts index dd2db31985..d2622a1f0c 100644 --- a/lib/core/app-config/app-config.service.ts +++ b/lib/core/app-config/app-config.service.ts @@ -127,7 +127,7 @@ export class AppConfigService { * @returns Notification when loading is complete */ load(): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { const configUrl = `app.config.json?v=${Date.now()}`; this.http.get(configUrl).subscribe( diff --git a/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.ts b/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.ts index 9d119c5c42..62fa92bad7 100644 --- a/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.ts +++ b/lib/core/card-view/components/card-view-item-dispatcher/card-view-item-dispatcher.component.ts @@ -63,7 +63,7 @@ export class CardViewItemDispatcherComponent implements OnChanges { 'ngOnDestroy' ]; - dynamicLifeCycleMethods.forEach(method => { + dynamicLifeCycleMethods.forEach((method) => { this[method] = this.proxy.bind(this, method); }); } @@ -75,7 +75,7 @@ export class CardViewItemDispatcherComponent implements OnChanges { } Object.keys(changes) - .map(changeName => [changeName, changes[changeName]]) + .map((changeName) => [changeName, changes[changeName]]) .forEach(([inputParamName, simpleChange]: [string, SimpleChange]) => { this.componentReference.instance[inputParamName] = simpleChange.currentValue; }); diff --git a/lib/core/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts b/lib/core/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts index cab8beacb9..b3b49d6b2b 100644 --- a/lib/core/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts +++ b/lib/core/card-view/components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component.ts @@ -65,7 +65,7 @@ export class CardViewKeyValuePairsItemComponent implements OnChanges { } save(remove?: boolean): void { - const validValues = this.values.filter(i => i.name.length && i.value.length); + const validValues = this.values.filter((i) => i.name.length && i.value.length); if (remove || validValues.length) { this.cardViewUpdateService.update(this.property, validValues); diff --git a/lib/core/card-view/models/card-view-baseitem.model.ts b/lib/core/card-view/models/card-view-baseitem.model.ts index 25dafb4e3e..5a36f04a5d 100644 --- a/lib/core/card-view/models/card-view-baseitem.model.ts +++ b/lib/core/card-view/models/card-view-baseitem.model.ts @@ -50,7 +50,7 @@ export abstract class CardViewBaseItemModel { } return this.validators - .map(validator => validator.isValid(newValue)) + .map((validator) => validator.isValid(newValue)) .reduce((isValidUntilNow, isValid) => isValidUntilNow && isValid, true); } @@ -59,6 +59,6 @@ export abstract class CardViewBaseItemModel { return []; } - return this.validators.filter(validator => !validator.isValid(value)).map(validator => validator.message); + return this.validators.filter((validator) => !validator.isValid(value)).map((validator) => validator.message); } } diff --git a/lib/core/card-view/models/card-view-selectitem.model.spec.ts b/lib/core/card-view/models/card-view-selectitem.model.spec.ts index c915c6f7ff..d472b53e1d 100644 --- a/lib/core/card-view/models/card-view-selectitem.model.spec.ts +++ b/lib/core/card-view/models/card-view-selectitem.model.spec.ts @@ -38,7 +38,7 @@ describe('CardViewSelectItemModel', () => { it('should return the value if it is present', async(() => { const itemModel = new CardViewSelectItemModel(properties); - itemModel.displayValue.subscribe(value => { + itemModel.displayValue.subscribe((value) => { expect(value).toBe(mockData[1].label); }); })); diff --git a/lib/core/card-view/models/card-view-selectitem.model.ts b/lib/core/card-view/models/card-view-selectitem.model.ts index f3daa54c26..19b0fd1248 100644 --- a/lib/core/card-view/models/card-view-selectitem.model.ts +++ b/lib/core/card-view/models/card-view-selectitem.model.ts @@ -34,8 +34,8 @@ export class CardViewSelectItemModel extends CardViewBaseItemModel implements get displayValue() { return this.options$.pipe( - switchMap(options => { - const option = options.find(o => o.key === this.value); + switchMap((options) => { + const option = options.find((o) => o.key === this.value); return of(option ? option.label : ''); }) ); diff --git a/lib/core/comments/comment-list.component.spec.ts b/lib/core/comments/comment-list.component.spec.ts index 726aa6a746..39cba9cbaa 100644 --- a/lib/core/comments/comment-list.component.spec.ts +++ b/lib/core/comments/comment-list.component.spec.ts @@ -135,7 +135,7 @@ describe('CommentListComponent', () => { it('should emit row click event', async(() => { commentList.comments = [Object.assign({}, processCommentOne)]; - commentList.clickRow.subscribe(selectedComment => { + commentList.clickRow.subscribe((selectedComment) => { expect(selectedComment.id).toEqual(1); expect(selectedComment.message).toEqual('Test Comment'); expect(selectedComment.createdBy).toEqual(testUser); @@ -156,7 +156,7 @@ describe('CommentListComponent', () => { commentList.selectedComment = commentOne; commentList.comments = [commentOne, commentTwo]; - commentList.clickRow.subscribe(selectedComment => { + commentList.clickRow.subscribe((selectedComment) => { fixture.detectChanges(); let commentSelectedList = fixture.nativeElement.querySelectorAll('.is-selected'); expect(commentSelectedList.length).toBe(1); diff --git a/lib/core/comments/comments.component.ts b/lib/core/comments/comments.component.ts index f657062f90..6eae4ab4cd 100644 --- a/lib/core/comments/comments.component.ts +++ b/lib/core/comments/comments.component.ts @@ -55,7 +55,7 @@ export class CommentsComponent implements OnChanges { beingAdded: boolean = false; constructor(private commentProcessService: CommentProcessService, private commentContentService: CommentContentService) { - this.comment$ = new Observable(observer => this.commentObserver = observer) + this.comment$ = new Observable((observer) => this.commentObserver = observer) .pipe(share()); this.comment$.subscribe((comment: CommentModel) => { this.comments.push(comment); diff --git a/lib/core/context-menu/context-menu-holder.component.ts b/lib/core/context-menu/context-menu-holder.component.ts index ea0a175da6..0dd1b221e0 100644 --- a/lib/core/context-menu/context-menu-holder.component.ts +++ b/lib/core/context-menu/context-menu-holder.component.ts @@ -81,7 +81,7 @@ export class ContextMenuHolderComponent implements OnInit, OnDestroy { ngOnInit() { this.subscriptions.push( - this.contextMenuService.show.subscribe(e => this.showMenu(e.event, e.obj)), + this.contextMenuService.show.subscribe((mouseEvent) => this.showMenu(mouseEvent.event, mouseEvent.obj)), this.menuTrigger.onMenuOpen.subscribe(() => { const container = this.overlayContainer.getContainerElement(); @@ -107,7 +107,7 @@ export class ContextMenuHolderComponent implements OnInit, OnDestroy { this.contextMenuListenerFn(); } - this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.subscriptions.forEach((subscription) => subscription.unsubscribe()); this.subscriptions = []; this.menuElement = null; diff --git a/lib/core/datatable/components/datatable/datatable.component.spec.ts b/lib/core/datatable/components/datatable/datatable.component.spec.ts index 65d012416e..42a89a01d6 100644 --- a/lib/core/datatable/components/datatable/datatable.component.spec.ts +++ b/lib/core/datatable/components/datatable/datatable.component.spec.ts @@ -546,10 +546,10 @@ describe('DataTable', () => { expect(dataTable.data).toBe(data); }); - it('should emit row click event', done => { + it('should emit row click event', (done) => { let row = {}; - dataTable.rowClick.subscribe(e => { + dataTable.rowClick.subscribe((e) => { expect(e.value).toBe(row); done(); }); @@ -744,12 +744,12 @@ describe('DataTable', () => { dataTable.ngAfterContentInit(); dataTable.onSelectAllClick( { checked: true }); - expect(dataTable.selection.every(entry => entry.isSelected)); + expect(dataTable.selection.every((entry) => entry.isSelected)); data.setRows([]); fixture.detectChanges(); - expect(dataTable.selection.every(entry => !entry.isSelected)); + expect(dataTable.selection.every((entry) => !entry.isSelected)); }); it('should update rows on "select all" click', () => { diff --git a/lib/core/datatable/components/datatable/datatable.component.ts b/lib/core/datatable/components/datatable/datatable.component.ts index 05d26479ea..7f47817413 100644 --- a/lib/core/datatable/components/datatable/datatable.component.ts +++ b/lib/core/datatable/components/datatable/datatable.component.ts @@ -182,7 +182,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, if (differs) { this.differ = differs.find([]).create(null); } - this.click$ = new Observable(observer => this.clickObserver = observer) + this.click$ = new Observable((observer) => this.clickObserver = observer) .pipe(share()); } @@ -245,7 +245,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, } convertToRowsData(rows: any []): ObjectDataRow[] { - return rows.map(row => new ObjectDataRow(row, row.isSelected)); + return rows.map((row) => new ObjectDataRow(row, row.isSelected)); } convertToDataSorting(sorting: any[]): DataSorting { @@ -263,8 +263,8 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, debounceTime(250) ) ), - map(list => list), - filter(x => x.length === 1) + map((list) => list), + filter((x) => x.length === 1) ); this.singleClickStreamSub = singleClickStream.subscribe((obj: DataRowEvent[]) => { @@ -288,8 +288,8 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, debounceTime(250) ) ), - map(list => list), - filter(x => x.length >= 2) + map((list) => list), + filter((x) => x.length >= 2) ); this.multiClickStreamSub = multiClickStream.subscribe((obj: DataRowEvent[]) => { @@ -359,7 +359,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, public getSchemaFromHtml(): any { let schema = []; if (this.columnList && this.columnList.columns && this.columnList.columns.length > 0) { - schema = this.columnList.columns.map(c => c); + schema = this.columnList.columns.map((c) => c); } return schema; } @@ -412,7 +412,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, if (this.data) { const rows = this.data.getRows(); if (rows && rows.length > 0) { - rows.forEach(r => r.isSelected = false); + rows.forEach((r) => r.isSelected = false); } this.selection = []; } @@ -631,7 +631,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, } getSortableColumns() { - return this.data.getColumns().filter(column => { + return this.data.getColumns().filter((column) => { return column.sortable === true; }); } @@ -669,7 +669,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck, ngOnDestroy() { this.unsubscribeClickStream(); - this.subscriptions.forEach(s => s.unsubscribe()); + this.subscriptions.forEach((s) => s.unsubscribe()); this.subscriptions = []; if (this.dataRowsChanged) { diff --git a/lib/core/datatable/components/datatable/date-cell.component.ts b/lib/core/datatable/components/datatable/date-cell.component.ts index 29ae1abe31..1cfb9fa8e3 100644 --- a/lib/core/datatable/components/datatable/date-cell.component.ts +++ b/lib/core/datatable/components/datatable/date-cell.component.ts @@ -56,7 +56,7 @@ export class DateCellComponent extends DataTableCellComponent { if (userPreferenceService) { userPreferenceService .select(UserPreferenceValues.Locale) - .subscribe(locale => { + .subscribe((locale) => { this.currentLocale = locale; }); } diff --git a/lib/core/datatable/data/data-table.schema.ts b/lib/core/datatable/data/data-table.schema.ts index f33a1a12b8..0e46de654c 100644 --- a/lib/core/datatable/data/data-table.schema.ts +++ b/lib/core/datatable/data/data-table.schema.ts @@ -65,16 +65,16 @@ export abstract class DataTableSchema { public getSchemaFromHtml(columnList: DataColumnListComponent): any { let schema = []; if (columnList && columnList.columns && columnList.columns.length > 0) { - schema = columnList.columns.map(c => c); + schema = columnList.columns.map((c) => c); } return schema; } public getSchemaFromConfig(presetColumn: string): DataColumn[] { - return presetColumn ? (this.layoutPresets[presetColumn]).map(col => new ObjectDataColumn(col)) : []; + return presetColumn ? (this.layoutPresets[presetColumn]).map((col) => new ObjectDataColumn(col)) : []; } private getDefaultLayoutPreset(): DataColumn[] { - return (this.layoutPresets['default']).map(col => new ObjectDataColumn(col)); + return (this.layoutPresets['default']).map((col) => new ObjectDataColumn(col)); } } diff --git a/lib/core/datatable/data/object-datatable-adapter.ts b/lib/core/datatable/data/object-datatable-adapter.ts index 398045e71e..501a2c0bdc 100644 --- a/lib/core/datatable/data/object-datatable-adapter.ts +++ b/lib/core/datatable/data/object-datatable-adapter.ts @@ -61,18 +61,18 @@ export class ObjectDataTableAdapter implements DataTableAdapter { this._columns = []; if (data && data.length > 0) { - this._rows = data.map(item => { + this._rows = data.map((item) => { return new ObjectDataRow(item); }); } if (schema && schema.length > 0) { - this._columns = schema.map(item => { + this._columns = schema.map((item) => { return new ObjectDataColumn(item); }); // Sort by first sortable or just first column - let sortable = this._columns.filter(c => c.sortable); + let sortable = this._columns.filter((column) => column.sortable); if (sortable.length > 0) { this.sort(sortable[0].key, 'asc'); } diff --git a/lib/core/directives/node-favorite.directive.ts b/lib/core/directives/node-favorite.directive.ts index 97f7330296..7377f0f62f 100644 --- a/lib/core/directives/node-favorite.directive.ts +++ b/lib/core/directives/node-favorite.directive.ts @@ -75,10 +75,10 @@ export class NodeFavoriteDirective implements OnChanges { forkJoin(batch).subscribe( () => { - this.favorites.map(selected => selected.entry.isFavorite = false); + this.favorites.map((selected) => selected.entry.isFavorite = false); this.toggle.emit(); }, - error => this.error.emit(error) + (error) => this.error.emit(error) ); } @@ -89,10 +89,10 @@ export class NodeFavoriteDirective implements OnChanges { from(this.alfrescoApiService.favoritesApi.addFavorite('-me-', body)) .subscribe( () => { - notFavorite.map(selected => selected.entry.isFavorite = true); + notFavorite.map((selected) => selected.entry.isFavorite = true); this.toggle.emit(); }, - error => this.error.emit(error) + (error) => this.error.emit(error) ); } } @@ -106,7 +106,7 @@ export class NodeFavoriteDirective implements OnChanges { const result = this.diff(selection, this.favorites); const batch = this.getProcessBatch(result); - forkJoin(batch).subscribe(data => { + forkJoin(batch).subscribe((data) => { this.favorites.push(...data); }); } @@ -186,14 +186,14 @@ export class NodeFavoriteDirective implements OnChanges { } private diff(list, patch): any[] { - const ids = patch.map(item => item.entry.id); + const ids = patch.map((item) => item.entry.id); - return list.filter(item => ids.includes(item.entry.id) ? null : item); + return list.filter((item) => ids.includes(item.entry.id) ? null : item); } private reduce(patch, comparator): any[] { - const ids = comparator.map(item => item.entry.id); + const ids = comparator.map((item) => item.entry.id); - return patch.filter(item => ids.includes(item.entry.id) ? item : null); + return patch.filter((item) => ids.includes(item.entry.id) ? item : null); } } diff --git a/lib/core/directives/node-permission.directive.ts b/lib/core/directives/node-permission.directive.ts index a6e943cf0c..54e8906ae5 100644 --- a/lib/core/directives/node-permission.directive.ts +++ b/lib/core/directives/node-permission.directive.ts @@ -119,7 +119,7 @@ export class NodePermissionDirective implements OnChanges { */ hasPermission(nodes: MinimalNodeEntity[], permission: string): boolean { if (nodes && nodes.length > 0) { - return nodes.every(node => this.contentService.hasPermission(node.entry, permission)); + return nodes.every((node) => this.contentService.hasPermission(node.entry, permission)); } return false; diff --git a/lib/core/directives/node-restore.directive.spec.ts b/lib/core/directives/node-restore.directive.spec.ts index e63c6e571e..c3c1df313e 100644 --- a/lib/core/directives/node-restore.directive.spec.ts +++ b/lib/core/directives/node-restore.directive.spec.ts @@ -78,7 +78,7 @@ describe('NodeRestoreDirective', () => { })); translationService = TestBed.get(TranslationService); - spyOn(translationService, 'instant').and.callFake(key => { return key; }); + spyOn(translationService, 'instant').and.callFake((key) => { return key; }); }); it('should not restore when selection is empty', () => { diff --git a/lib/core/directives/node-restore.directive.ts b/lib/core/directives/node-restore.directive.ts index ba6ab8da99..64471c2cd2 100644 --- a/lib/core/directives/node-restore.directive.ts +++ b/lib/core/directives/node-restore.directive.ts @@ -71,7 +71,7 @@ export class NodeRestoreDirective { if (selection.length && nodesWithPath.length) { this.restoreNodesBatch(nodesWithPath).pipe( - tap(restoredNodes => { + tap((restoredNodes) => { const status = this.processStatus(restoredNodes); this.restoreProcessStatus.fail.push(...status.fail); @@ -79,7 +79,7 @@ export class NodeRestoreDirective { }), mergeMap(() => this.getDeletedNodes()) ) - .subscribe(deletedNodesList => { + .subscribe((deletedNodesList) => { const { entries: nodeList } = deletedNodesList.list; const { fail: restoreErrorNodes } = this.restoreProcessStatus; const selectedNodes = this.diff(restoreErrorNodes, selection, false); @@ -136,9 +136,9 @@ export class NodeRestoreDirective { } private diff(selection, list, fromList = true): any { - const ids = selection.map(item => item.entry.id); + const ids = selection.map((item) => item.entry.id); - return list.filter(item => { + return list.filter((item) => { if (fromList) { return ids.includes(item.entry.id) ? item : null; } else { diff --git a/lib/core/directives/upload.directive.spec.ts b/lib/core/directives/upload.directive.spec.ts index 391a7db90e..8d6726290e 100644 --- a/lib/core/directives/upload.directive.spec.ts +++ b/lib/core/directives/upload.directive.spec.ts @@ -115,7 +115,7 @@ describe('UploadDirective', () => { {}, {} ])); - spyOn(nativeElement, 'dispatchEvent').and.callFake(_ => { + spyOn(nativeElement, 'dispatchEvent').and.callFake((_) => { done(); }); directive.onDrop(event); @@ -130,7 +130,7 @@ describe('UploadDirective', () => { spyOn(directive, 'getDataTransfer').and.returnValue({}); spyOn(directive, 'getFilesDropped').and.returnValue(Promise.resolve(files)); - spyOn(nativeElement, 'dispatchEvent').and.callFake(e => { + spyOn(nativeElement, 'dispatchEvent').and.callFake((e) => { expect(e.detail.files.length).toBe(1); expect(e.detail.files[0]).toBe(files[0]); done(); diff --git a/lib/core/directives/upload.directive.ts b/lib/core/directives/upload.directive.ts index d6c37722ab..adf8bac877 100644 --- a/lib/core/directives/upload.directive.ts +++ b/lib/core/directives/upload.directive.ts @@ -68,7 +68,7 @@ export class UploadDirective implements OnInit, OnDestroy { this.upload.type = 'file'; this.upload.style.display = 'none'; - this.upload.addEventListener('change', e => this.onSelectFiles(e)); + this.upload.addEventListener('change', (e) => this.onSelectFiles(e)); if (this.multiple) { this.upload.setAttribute('multiple', ''); @@ -142,7 +142,7 @@ export class UploadDirective implements OnInit, OnDestroy { const dataTransfer = this.getDataTransfer(event); if (dataTransfer) { - this.getFilesDropped(dataTransfer).then(files => { + this.getFilesDropped(dataTransfer).then((files) => { this.onUploadFiles(files); }); @@ -193,7 +193,7 @@ export class UploadDirective implements OnInit, OnDestroy { * @param dataTransfer DataTransfer object */ getFilesDropped(dataTransfer: DataTransfer): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { const iterations = []; if (dataTransfer) { @@ -210,8 +210,8 @@ export class UploadDirective implements OnInit, OnDestroy { relativeFolder: '/' })); } else if (item.isDirectory) { - iterations.push(new Promise(resolveFolder => { - FileUtils.flatten(item).then(files => resolveFolder(files)); + iterations.push(new Promise((resolveFolder) => { + FileUtils.flatten(item).then((files) => resolveFolder(files)); })); } } @@ -227,7 +227,7 @@ export class UploadDirective implements OnInit, OnDestroy { // safari or FF let files = FileUtils .toFileArray(dataTransfer.files) - .map(file => { + .map((file) => { entry: null, file: file, relativeFolder: '/' @@ -237,7 +237,7 @@ export class UploadDirective implements OnInit, OnDestroy { } } - Promise.all(iterations).then(result => { + Promise.all(iterations).then((result) => { resolve(result.reduce((a, b) => a.concat(b), [])); }); }); @@ -251,7 +251,7 @@ export class UploadDirective implements OnInit, OnDestroy { if (this.isClickMode()) { const input = ( e.currentTarget); const files = FileUtils.toFileArray(input.files); - this.onUploadFiles(files.map(file => { + this.onUploadFiles(files.map((file) => { entry: null, file: file, relativeFolder: '/' diff --git a/lib/core/form/components/form-field/form-field.component.ts b/lib/core/form/components/form-field/form-field.component.ts index 98c2fed944..0304ca9d0f 100644 --- a/lib/core/form/components/form-field/form-field.component.ts +++ b/lib/core/form/components/form-field/form-field.component.ts @@ -95,7 +95,7 @@ export class FormFieldComponent implements OnInit, OnDestroy { this.componentRef = this.container.createComponent(factory); let instance = this.componentRef.instance; instance.field = this.field; - instance.fieldChanged.subscribe(field => { + instance.fieldChanged.subscribe((field) => { if (field && this.field.form) { this.visibilityService.refreshVisibility(field.form); field.form.onFormFieldChanged(field); @@ -154,7 +154,7 @@ export class FormFieldComponent implements OnInit, OnDestroy { } let module: ModuleWithComponentFactories = compiler.compileModuleAndAllComponentsSync(RuntimeComponentModule); - return module.componentFactories.find(x => x.componentType === decoratedCmp); + return module.componentFactories.find((x) => x.componentType === decoratedCmp); } focusToggle() { diff --git a/lib/core/form/components/form.component.spec.ts b/lib/core/form/components/form.component.spec.ts index 89a50de146..a97f5ea0a8 100644 --- a/lib/core/form/components/form.component.spec.ts +++ b/lib/core/form/components/form.component.spec.ts @@ -172,7 +172,7 @@ describe('FormComponent', () => { it('should get process variable if is a process task', () => { spyOn(formService, 'getTaskForm').and.callFake((currentTaskId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ taskId: currentTaskId }); observer.complete(); }); @@ -180,7 +180,7 @@ describe('FormComponent', () => { spyOn(visibilityService, 'getTaskProcessVariable').and.returnValue(of({})); spyOn(formService, 'getTask').and.callFake((currentTaskId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ taskId: currentTaskId, processDefinitionId: '10201' }); observer.complete(); }); @@ -195,7 +195,7 @@ describe('FormComponent', () => { it('should not get process variable if is not a process task', () => { spyOn(formService, 'getTaskForm').and.callFake((currentTaskId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ taskId: currentTaskId }); observer.complete(); }); @@ -203,7 +203,7 @@ describe('FormComponent', () => { spyOn(visibilityService, 'getTaskProcessVariable').and.returnValue(of({})); spyOn(formService, 'getTask').and.callFake((currentTaskId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ taskId: currentTaskId, processDefinitionId: 'null' }); observer.complete(); }); @@ -311,7 +311,7 @@ describe('FormComponent', () => { let saved = false; formComponent.form = formModel; - formComponent.formSaved.subscribe(v => saved = true); + formComponent.formSaved.subscribe((v) => saved = true); spyOn(formComponent, 'completeTaskForm').and.stub(); let result = formComponent.onOutcomeClicked(outcome); @@ -362,7 +362,7 @@ describe('FormComponent', () => { let saved = false; formComponent.form = formModel; - formComponent.formSaved.subscribe(v => saved = true); + formComponent.formSaved.subscribe((v) => saved = true); let result = formComponent.onOutcomeClicked(outcome); expect(result).toBeTruthy(); @@ -421,7 +421,7 @@ describe('FormComponent', () => { it('should fetch and parse form by task id', (done) => { spyOn(formService, 'getTask').and.returnValue(of({})); spyOn(formService, 'getTaskForm').and.callFake((currentTaskId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ taskId: currentTaskId }); observer.complete(); }); @@ -448,7 +448,7 @@ describe('FormComponent', () => { return throwError(error); }); - formComponent.getFormByTaskId('123').then(_ => { + formComponent.getFormByTaskId('123').then((_) => { expect(formComponent.handleError).toHaveBeenCalledWith(error); done(); }); @@ -457,14 +457,14 @@ describe('FormComponent', () => { it('should apply readonly state when getting form by task id', (done) => { spyOn(formService, 'getTask').and.returnValue(of({})); spyOn(formService, 'getTaskForm').and.callFake((taskId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ taskId: taskId }); observer.complete(); }); }); formComponent.readOnly = true; - formComponent.getFormByTaskId('123').then(_ => { + formComponent.getFormByTaskId('123').then((_) => { expect(formComponent.form).toBeDefined(); expect(formComponent.form.readOnly).toBe(true); done(); @@ -473,7 +473,7 @@ describe('FormComponent', () => { it('should fetch and parse form definition by id', () => { spyOn(formService, 'getFormDefinitionById').and.callFake((currentFormId) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ id: currentFormId }); observer.complete(); }); @@ -505,14 +505,14 @@ describe('FormComponent', () => { it('should fetch and parse form definition by form name', () => { spyOn(formService, 'getFormDefinitionByName').and.callFake((currentFormName) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(currentFormName); observer.complete(); }); }); spyOn(formService, 'getFormDefinitionById').and.callFake((currentFormName) => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ name: currentFormName }); observer.complete(); }); @@ -533,7 +533,7 @@ describe('FormComponent', () => { it('should save task form and raise corresponding event', () => { spyOn(formService, 'saveTaskForm').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -541,7 +541,7 @@ describe('FormComponent', () => { let saved = false; let savedForm = null; - formComponent.formSaved.subscribe(form => { + formComponent.formSaved.subscribe((form) => { saved = true; savedForm = form; }); @@ -598,7 +598,7 @@ describe('FormComponent', () => { it('should complete form form and raise corresponding event', () => { spyOn(formService, 'completeTaskForm').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -703,7 +703,7 @@ describe('FormComponent', () => { it('should load form for ecm node', () => { let metadata = {}; spyOn(nodeService, 'getNodeMetadata').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next({ metadata: metadata }); observer.complete(); }) @@ -791,7 +791,7 @@ describe('FormComponent', () => { formComponent.disableCompleteButton = true; expect(formModel.isValid).toBeTruthy(); - let completeOutcome = formComponent.form.outcomes.find(outcome => outcome.name === FormOutcomeModel.COMPLETE_ACTION); + let completeOutcome = formComponent.form.outcomes.find((outcome) => outcome.name === FormOutcomeModel.COMPLETE_ACTION); expect(formComponent.isOutcomeButtonEnabled(completeOutcome)).toBeFalsy(); }); @@ -802,7 +802,7 @@ describe('FormComponent', () => { formComponent.disableStartProcessButton = true; expect(formModel.isValid).toBeTruthy(); - let startProcessOutcome = formComponent.form.outcomes.find(outcome => outcome.name === FormOutcomeModel.START_PROCESS_ACTION); + let startProcessOutcome = formComponent.form.outcomes.find((outcome) => outcome.name === FormOutcomeModel.START_PROCESS_ACTION); expect(formComponent.isOutcomeButtonEnabled(startProcessOutcome)).toBeFalsy(); }); @@ -825,8 +825,8 @@ describe('FormComponent', () => { formComponent.form = new FormModel(JSON.parse(JSON.stringify(fakeForm))); let formFields = formComponent.form.getFormFields(); - let labelField = formFields.find(field => field.id === 'label'); - let radioField = formFields.find(field => field.id === 'radio'); + let labelField = formFields.find((field) => field.id === 'label'); + let radioField = formFields.find((field) => field.id === 'radio'); expect(labelField.value).toBe('empty'); expect(radioField.value).toBeNull(); @@ -841,8 +841,8 @@ describe('FormComponent', () => { formComponent.ngOnChanges({ 'data': change }); formFields = formComponent.form.getFormFields(); - labelField = formFields.find(field => field.id === 'label'); - radioField = formFields.find(field => field.id === 'radio'); + labelField = formFields.find((field) => field.id === 'label'); + radioField = formFields.find((field) => field.id === 'radio'); expect(labelField.value).toBe('option_2'); expect(radioField.value).toBe('option_2'); }); @@ -850,7 +850,7 @@ describe('FormComponent', () => { it('should refresh radio buttons value when id is given to data', () => { formComponent.form = new FormModel(JSON.parse(JSON.stringify(fakeForm))); let formFields = formComponent.form.getFormFields(); - let radioFieldById = formFields.find(field => field.id === 'radio'); + let radioFieldById = formFields.find((field) => field.id === 'radio'); let formValues: any = {}; formValues.radio = 'option_3'; @@ -859,7 +859,7 @@ describe('FormComponent', () => { formComponent.ngOnChanges({ 'data': change }); formFields = formComponent.form.getFormFields(); - radioFieldById = formFields.find(field => field.id === 'radio'); + radioFieldById = formFields.find((field) => field.id === 'radio'); expect(radioFieldById.value).toBe('option_3'); }); }); diff --git a/lib/core/form/components/start-form.component.spec.ts b/lib/core/form/components/start-form.component.spec.ts index cec7f0a242..8d1f0b132e 100644 --- a/lib/core/form/components/start-form.component.spec.ts +++ b/lib/core/form/components/start-form.component.spec.ts @@ -147,7 +147,7 @@ describe('StartFormComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'mocktext'); + const labelField = formFields.find((field) => field.id === 'mocktext'); const textWidget = fixture.debugElement.nativeElement.querySelector('text-widget'); const textWidgetLabel = fixture.debugElement.nativeElement.querySelector('.adf-label'); expect(labelField.type).toBe('text'); @@ -165,7 +165,7 @@ describe('StartFormComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'radio-but'); + const labelField = formFields.find((field) => field.id === 'radio-but'); const radioButtonWidget = fixture.debugElement.nativeElement.querySelector('radio-buttons-widget'); const radioButtonWidgetLabel = fixture.debugElement.nativeElement.querySelector('.adf-input'); expect(labelField.type).toBe('radio-buttons'); @@ -183,7 +183,7 @@ describe('StartFormComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'amount'); + const labelField = formFields.find((field) => field.id === 'amount'); const amountWidget = fixture.debugElement.nativeElement.querySelector('amount-widget'); const amountWidgetLabel = fixture.debugElement.nativeElement.querySelector('.adf-input'); expect(labelField.type).toBe('amount'); @@ -201,7 +201,7 @@ describe('StartFormComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'number'); + const labelField = formFields.find((field) => field.id === 'number'); const numberWidget = fixture.debugElement.nativeElement.querySelector('number-widget'); expect(labelField.type).toBe('integer'); expect(numberWidget).toBeDefined(); @@ -217,7 +217,7 @@ describe('StartFormComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'mockTypeDropDown'); + const labelField = formFields.find((field) => field.id === 'mockTypeDropDown'); const dropDownWidget = fixture.debugElement.nativeElement.querySelector('dropdown-widget'); const selectElement = fixture.debugElement.nativeElement.querySelector('.adf-dropdown-widget>mat-select .mat-select-trigger'); selectElement.click(); @@ -240,7 +240,7 @@ describe('StartFormComponent', () => { fixture.whenStable().then(() => { fixture.detectChanges(); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'date'); + const labelField = formFields.find((field) => field.id === 'date'); const dateWidget = fixture.debugElement.nativeElement.querySelector('dropdown-widget'); const dateLabelElement = fixture.debugElement.nativeElement.querySelector('#data-widget .mat-form-field-infix> .adf-label'); expect(dateWidget).toBeDefined(); @@ -256,11 +256,11 @@ describe('StartFormComponent', () => { component.ngOnChanges({ processDefinitionId: new SimpleChange(exampleId1, exampleId2, true) }); const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'billdate'); + const labelField = formFields.find((field) => field.id === 'billdate'); expect(labelField.type).toBe('date'); const formFields1 = component.form.getFormFields(); - const labelField1 = formFields1.find(field => field.id === 'claimtype'); + const labelField1 = formFields1.find((field) => field.id === 'claimtype'); expect(labelField1.type).toBe('dropdown'); }); @@ -272,7 +272,7 @@ describe('StartFormComponent', () => { fixture.detectChanges(); fixture.whenStable().then(() => { const formFields = component.form.getFormFields(); - const labelField = formFields.find(field => field.id === 'claimtype'); + const labelField = formFields.find((field) => field.id === 'claimtype'); expect(labelField.type).toBe('dropdown'); expect(labelField.options[0].name).toBe('Chooseone...'); expect(labelField.options[1].name).toBe('Cashless'); @@ -333,8 +333,8 @@ describe('StartFormComponent', () => { fixture.detectChanges(); fixture.whenStable().then(() => { const formTabs = component.form.tabs; - const tabField1 = formTabs.find(tab => tab.id === 'form1'); - const tabField2 = formTabs.find(tab => tab.id === 'form2'); + const tabField1 = formTabs.find((tab) => tab.id === 'form1'); + const tabField2 = formTabs.find((tab) => tab.id === 'form2'); const tabsWidgetElement = fixture.debugElement.nativeElement.querySelector('tabs-widget'); expect(tabField1.name).toBe('Tab 1'); expect(tabField2.name).toBe('Tab 2'); diff --git a/lib/core/form/components/start-form.component.ts b/lib/core/form/components/start-form.component.ts index e04621570f..7a92739c15 100644 --- a/lib/core/form/components/start-form.component.ts +++ b/lib/core/form/components/start-form.component.ts @@ -82,7 +82,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn ngOnInit() { this.subscriptions.push( - this.formService.formContentClicked.subscribe(content => { + this.formService.formContentClicked.subscribe((content) => { this.formContentClicked.emit(content); }), this.formService.validateForm.subscribe((validateFormEvent: ValidateFormEvent) => { @@ -94,7 +94,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn } ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.subscriptions.forEach((subscription) => subscription.unsubscribe()); this.subscriptions = []; } @@ -120,7 +120,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn this.formService .getStartFormInstance(processId) .subscribe( - form => { + (form) => { this.formName = form.name; if (instance.variables) { form.processVariables = instance.variables; @@ -131,7 +131,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn this.form.readOnly = this.readOnlyForm; this.onFormLoaded(this.form); }, - error => this.handleError(error) + (error) => this.handleError(error) ); }); } @@ -140,7 +140,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn this.formService .getStartFormDefinition(processId) .subscribe( - form => { + (form) => { this.formName = form.processDefinitionName; this.form = this.parseForm(form); this.visibilityService.refreshVisibility(this.form); @@ -148,7 +148,7 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn this.form.readOnly = this.readOnlyForm; this.onFormLoaded(this.form); }, - error => this.handleError(error) + (error) => this.handleError(error) ); } diff --git a/lib/core/form/components/widgets/container/container.widget.spec.ts b/lib/core/form/components/widgets/container/container.widget.spec.ts index 3963c5db9b..7f3d378ea9 100644 --- a/lib/core/form/components/widgets/container/container.widget.spec.ts +++ b/lib/core/form/components/widgets/container/container.widget.spec.ts @@ -104,7 +104,7 @@ describe('ContainerWidgetComponent', () => { it('should send an event when a value is changed in the form', (done) => { let fakeForm = new FormModel(); let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'}); - widget.fieldChanged.subscribe(field => { + widget.fieldChanged.subscribe((field) => { expect(field).not.toBe(null); expect(field.id).toBe('fakeField'); expect(field.value).toBe('fakeValue'); diff --git a/lib/core/form/components/widgets/core/form-field-validator.ts b/lib/core/form/components/widgets/core/form-field-validator.ts index ea0db656ae..1756b10879 100644 --- a/lib/core/form/components/widgets/core/form-field-validator.ts +++ b/lib/core/form/components/widgets/core/form-field-validator.ts @@ -66,7 +66,7 @@ export class RequiredFieldValidator implements FormFieldValidator { } if (field.type === FormFieldTypes.RADIO_BUTTONS) { - let option = field.options.find(opt => opt.id === field.value); + let option = field.options.find((opt) => opt.id === field.value); return !!option; } @@ -497,7 +497,7 @@ export class FixedValueFieldValidator implements FormFieldValidator { } hasValidName(field: FormFieldModel) { - return field.options.find(item => item.name && item.name.toLocaleLowerCase() === field.value.toLocaleLowerCase()) ? true : false; + return field.options.find((item) => item.name && item.name.toLocaleLowerCase() === field.value.toLocaleLowerCase()) ? true : false; } hasValidId(field: FormFieldModel) { diff --git a/lib/core/form/components/widgets/core/form-field.model.spec.ts b/lib/core/form/components/widgets/core/form-field.model.spec.ts index 72856d081a..db80520f90 100644 --- a/lib/core/form/components/widgets/core/form-field.model.spec.ts +++ b/lib/core/form/components/widgets/core/form-field.model.spec.ts @@ -58,7 +58,7 @@ describe('FormFieldModel', () => { value: '' }; let field = new FormFieldModel(new FormModel(), json); - Object.keys(json).forEach(key => { + Object.keys(json).forEach((key) => { expect(field[key]).toBe(json[key]); }); }); @@ -346,7 +346,7 @@ describe('FormFieldModel', () => { it('should not update form with display-only field value', () => { let form = new FormModel(); - FormFieldTypes.READONLY_TYPES.forEach(typeName => { + FormFieldTypes.READONLY_TYPES.forEach((typeName) => { let field = new FormFieldModel(form, { id: typeName, type: typeName diff --git a/lib/core/form/components/widgets/core/form-field.model.ts b/lib/core/form/components/widgets/core/form-field.model.ts index 2d71bfc2b3..848af05ec7 100644 --- a/lib/core/form/components/widgets/core/form-field.model.ts +++ b/lib/core/form/components/widgets/core/form-field.model.ts @@ -271,7 +271,7 @@ export class FormFieldModel extends FormWidgetModel { if (json.fields.hasOwnProperty(currentField)) { let col = new ContainerColumnModel(); - let fields: FormFieldModel[] = (json.fields[currentField] || []).map(f => new FormFieldModel(form, f)); + let fields: FormFieldModel[] = (json.fields[currentField] || []).map((f) => new FormFieldModel(form, f)); col.fields = fields; col.rowspan = json.fields[currentField].length; @@ -315,7 +315,7 @@ export class FormFieldModel extends FormWidgetModel { // Activiti has a bug with default radio button value where initial selection passed as `name` value // so try resolving current one with a fallback to first entry via name or id // TODO: needs to be reported and fixed at Activiti side - let entry: FormFieldOption[] = this.options.filter(opt => + let entry: FormFieldOption[] = this.options.filter((opt) => opt.id === value || opt.name === value || (value && (opt.id === value.id || opt.name === value.name))); if (entry.length > 0) { value = entry[0].id; @@ -357,7 +357,7 @@ export class FormFieldModel extends FormWidgetModel { if (this.value === 'empty' || this.value === '') { this.form.values[this.id] = {}; } else { - let entry: FormFieldOption[] = this.options.filter(opt => opt.id === this.value); + let entry: FormFieldOption[] = this.options.filter((opt) => opt.id === this.value); if (entry.length > 0) { this.form.values[this.id] = entry[0]; } @@ -368,20 +368,20 @@ export class FormFieldModel extends FormWidgetModel { This is needed due to Activiti issue related to reading radio button values as value string but saving back as object: { id: , name: } */ - let rbEntry: FormFieldOption[] = this.options.filter(opt => opt.id === this.value); + let rbEntry: FormFieldOption[] = this.options.filter((opt) => opt.id === this.value); if (rbEntry.length > 0) { this.form.values[this.id] = rbEntry[0]; } break; case FormFieldTypes.UPLOAD: if (this.value && this.value.length > 0) { - this.form.values[this.id] = this.value.map(elem => elem.id).join(','); + this.form.values[this.id] = this.value.map((elem) => elem.id).join(','); } else { this.form.values[this.id] = null; } break; case FormFieldTypes.TYPEAHEAD: - let taEntry: FormFieldOption[] = this.options.filter(opt => opt.id === this.value || opt.name === this.value); + let taEntry: FormFieldOption[] = this.options.filter((opt) => opt.id === this.value || opt.name === this.value); if (taEntry.length > 0) { this.form.values[this.id] = taEntry[0]; } else if (this.options.length > 0) { @@ -435,7 +435,7 @@ export class FormFieldModel extends FormWidgetModel { } getOptionName(): string { - let option: FormFieldOption = this.options.find(opt => opt.id === this.value); + let option: FormFieldOption = this.options.find((opt) => opt.id === this.value); return option ? option.name : null; } diff --git a/lib/core/form/components/widgets/core/form.model.spec.ts b/lib/core/form/components/widgets/core/form.model.spec.ts index 6e91f58e7d..0a2346032c 100644 --- a/lib/core/form/components/widgets/core/form.model.spec.ts +++ b/lib/core/form/components/widgets/core/form.model.spec.ts @@ -49,7 +49,7 @@ describe('FormModel', () => { }; let form = new FormModel(json); - Object.keys(json).forEach(key => { + Object.keys(json).forEach((key) => { expect(form[key]).toEqual(form[key]); }); }); diff --git a/lib/core/form/components/widgets/core/form.model.ts b/lib/core/form/components/widgets/core/form.model.ts index e0d866271b..71b764ea02 100644 --- a/lib/core/form/components/widgets/core/form.model.ts +++ b/lib/core/form/components/widgets/core/form.model.ts @@ -99,7 +99,7 @@ export class FormModel { this.processVariables = json.processVariables; - this.tabs = (json.tabs || []).map(t => { + this.tabs = (json.tabs || []).map((t) => { let model = new TabModel(this, t); tabCache[model.id] = model; return model; @@ -138,7 +138,7 @@ export class FormModel { isSystem: true }); - let customOutcomes = (json.outcomes || []).map(obj => new FormOutcomeModel(this, obj)); + let customOutcomes = (json.outcomes || []).map((obj) => new FormOutcomeModel(this, obj)); this.outcomes = [saveOutcome].concat( customOutcomes.length > 0 ? customOutcomes : [completeOutcome, startProcessOutcome] @@ -157,7 +157,7 @@ export class FormModel { } getFieldById(fieldId: string): FormFieldModel { - return this.getFormFields().find(field => field.id === fieldId); + return this.getFormFields().find((field) => field.id === fieldId); } // TODO: consider evaluating and caching once the form is loaded diff --git a/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts b/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts index 1aeee4e5d1..f027670f78 100644 --- a/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts +++ b/lib/core/form/components/widgets/dropdown/dropdown.widget.spec.ts @@ -89,7 +89,7 @@ describe('DropdownWidgetComponent', () => { }); spyOn(formService, 'getRestFieldValues').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(null); observer.complete(); }) @@ -101,7 +101,7 @@ describe('DropdownWidgetComponent', () => { it('should preserve empty option when loading fields', () => { let restFieldValue: FormFieldOption = { id: '1', name: 'Option1' }; spyOn(formService, 'getRestFieldValues').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next([restFieldValue]); observer.complete(); }); diff --git a/lib/core/form/components/widgets/dropdown/dropdown.widget.ts b/lib/core/form/components/widgets/dropdown/dropdown.widget.ts index 7cc97978fb..d68008b0fe 100644 --- a/lib/core/form/components/widgets/dropdown/dropdown.widget.ts +++ b/lib/core/form/components/widgets/dropdown/dropdown.widget.ts @@ -62,7 +62,7 @@ export class DropdownWidgetComponent extends WidgetComponent implements OnInit { this.field.options = options.concat((result || [])); this.field.updateForm(); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } @@ -81,7 +81,7 @@ export class DropdownWidgetComponent extends WidgetComponent implements OnInit { this.field.options = options.concat((result || [])); this.field.updateForm(); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } diff --git a/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.model.ts b/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.model.ts index b4770732bb..c7e92a4c24 100644 --- a/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.model.ts +++ b/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.model.ts @@ -51,7 +51,7 @@ export class DynamicTableModel extends FormWidgetModel { return; } - this.rows.forEach(row => row.selected = false); + this.rows.forEach((row) => row.selected = false); this._selectedRow = value; @@ -68,11 +68,11 @@ export class DynamicTableModel extends FormWidgetModel { const columns = this.getColumns(field); if (columns) { this.columns = columns; - this.visibleColumns = this.columns.filter(col => col.visible); + this.visibleColumns = this.columns.filter((col) => col.visible); } if (field.json.value) { - this.rows = field.json.value.map(obj => {selected: false, value: obj}); + this.rows = field.json.value.map((obj) => {selected: false, value: obj}); } } @@ -91,7 +91,7 @@ export class DynamicTableModel extends FormWidgetModel { } if (definitions) { - return definitions.map(obj => obj); + return definitions.map((obj) => obj); } } return null; @@ -99,7 +99,7 @@ export class DynamicTableModel extends FormWidgetModel { flushValue() { if (this.field) { - this.field.value = this.rows.map(r => r.value); + this.field.value = this.rows.map((r) => r.value); this.field.updateForm(); } } diff --git a/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.ts b/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.ts index 81d6af8221..810c44be36 100644 --- a/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.ts +++ b/lib/core/form/components/widgets/dynamic-table/dynamic-table.widget.ts @@ -195,7 +195,7 @@ export class DynamicTableWidgetComponent extends WidgetComponent implements OnIn if (typeof obj === 'object' && obj !== null && obj !== undefined) { result = Object.assign({}, obj); - Object.keys(obj).forEach(key => { + Object.keys(obj).forEach((key) => { if (typeof obj[key] === 'object') { result[key] = this.copyObject(obj[key]); } diff --git a/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts b/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts index e2c45208ce..410a7da36c 100644 --- a/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts +++ b/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts @@ -98,7 +98,7 @@ describe('DropdownEditorComponent', () => { ]; spyOn(formService, 'getRestFieldValuesColumn').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(restResults); observer.complete(); }) @@ -121,7 +121,7 @@ describe('DropdownEditorComponent', () => { column.optionType = 'rest'; spyOn(formService, 'getRestFieldValuesColumn').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(null); observer.complete(); }) diff --git a/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.ts b/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.ts index a721d78e6e..1756725877 100644 --- a/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.ts +++ b/lib/core/form/components/widgets/dynamic-table/editors/dropdown/dropdown.editor.ts @@ -77,7 +77,7 @@ export class DropdownEditorComponent implements OnInit { this.options = this.column.options; this.value = this.table.getCellValue(this.row, this.column); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } @@ -94,13 +94,13 @@ export class DropdownEditorComponent implements OnInit { this.options = this.column.options; this.value = this.table.getCellValue(this.row, this.column); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } onValueChanged(row: DynamicTableRow, column: DynamicTableColumn, event: any) { let value: any = ( event).value; - value = column.options.find(opt => opt.name === value); + value = column.options.find((opt) => opt.name === value); row.value[column.id] = value; } diff --git a/lib/core/form/components/widgets/dynamic-table/editors/row.editor.spec.ts b/lib/core/form/components/widgets/dynamic-table/editors/row.editor.spec.ts index 9c99822df5..c033b2bc2a 100644 --- a/lib/core/form/components/widgets/dynamic-table/editors/row.editor.spec.ts +++ b/lib/core/form/components/widgets/dynamic-table/editors/row.editor.spec.ts @@ -41,7 +41,7 @@ describe('RowEditorComponent', () => { }); it('should emit [cancel] event', (done) => { - component.cancel.subscribe(e => { + component.cancel.subscribe((e) => { expect(e.table).toBe(component.table); expect(e.row).toBe(component.row); expect(e.column).toBe(component.column); @@ -60,7 +60,7 @@ describe('RowEditorComponent', () => { spyOn(component.table, 'validateRow').and.returnValue( {isValid: true, message: null} ); - component.save.subscribe(e => { + component.save.subscribe((e) => { expect(e.table).toBe(component.table); expect(e.row).toBe(component.row); expect(e.column).toBe(component.column); @@ -74,7 +74,7 @@ describe('RowEditorComponent', () => { {isValid: false, message: 'error'} ); let raised = false; - component.save.subscribe(e => raised = true); + component.save.subscribe((e) => raised = true); component.onSaveChanges(); expect(raised).toBeFalsy(); }); diff --git a/lib/core/form/components/widgets/functional-group/functional-group.widget.spec.ts b/lib/core/form/components/widgets/functional-group/functional-group.widget.spec.ts index 557766be96..6a830096a6 100644 --- a/lib/core/form/components/widgets/functional-group/functional-group.widget.spec.ts +++ b/lib/core/form/components/widgets/functional-group/functional-group.widget.spec.ts @@ -40,7 +40,7 @@ describe('FunctionalGroupWidgetComponent', () => { widget.field.value = group; spyOn(formService, 'getWorkflowGroups').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(null); observer.complete(); }) @@ -128,7 +128,7 @@ describe('FunctionalGroupWidgetComponent', () => { new GroupModel() ]; spyOn(formService, 'getWorkflowGroups').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(groups); observer.complete(); }) @@ -148,7 +148,7 @@ describe('FunctionalGroupWidgetComponent', () => { new GroupModel() ]; spyOn(formService, 'getWorkflowGroups').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(groups); observer.complete(); }) @@ -165,7 +165,7 @@ describe('FunctionalGroupWidgetComponent', () => { it('should hide popup when fetching empty group list', () => { spyOn(formService, 'getWorkflowGroups').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(null); observer.complete(); }) diff --git a/lib/core/form/components/widgets/functional-group/functional-group.widget.ts b/lib/core/form/components/widgets/functional-group/functional-group.widget.ts index 45a4223471..ce97fc727f 100644 --- a/lib/core/form/components/widgets/functional-group/functional-group.widget.ts +++ b/lib/core/form/components/widgets/functional-group/functional-group.widget.ts @@ -78,7 +78,7 @@ export class FunctionalGroupWidgetComponent extends WidgetComponent implements O } flushValue() { - let option = this.groups.find(item => item.name.toLocaleLowerCase() === this.value.toLocaleLowerCase()); + let option = this.groups.find((item) => item.name.toLocaleLowerCase() === this.value.toLocaleLowerCase()); if (option) { this.field.value = option; diff --git a/lib/core/form/components/widgets/people/people.widget.spec.ts b/lib/core/form/components/widgets/people/people.widget.spec.ts index b86abd5cd2..4ad985fd1c 100644 --- a/lib/core/form/components/widgets/people/people.widget.spec.ts +++ b/lib/core/form/components/widgets/people/people.widget.spec.ts @@ -49,8 +49,8 @@ describe('PeopleWidgetComponent', () => { formService = TestBed.get(FormService); translationService = TestBed.get(TranslateService); - spyOn(translationService, 'instant').and.callFake(key => { return key; }); - spyOn(translationService, 'get').and.callFake(key => { return of(key); }); + spyOn(translationService, 'instant').and.callFake((key) => { return key; }); + spyOn(translationService, 'get').and.callFake((key) => { return of(key); }); element = fixture.nativeElement; widget = fixture.componentInstance; @@ -88,7 +88,7 @@ describe('PeopleWidgetComponent', () => { }); spyOn(formService, 'getWorkflowUsers').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(null); observer.complete(); }) @@ -111,7 +111,7 @@ describe('PeopleWidgetComponent', () => { widget.field.form.readOnly = true; spyOn(formService, 'getWorkflowUsers').and.returnValue( - new Observable(observer => { + new Observable((observer) => { observer.next(null); observer.complete(); }) @@ -166,7 +166,7 @@ describe('PeopleWidgetComponent', () => { { id: 1002, firstName: 'Test02', lastName: 'Test02', email: 'test2' }]; beforeEach(async(() => { - spyOn(formService, 'getWorkflowUsers').and.returnValue(new Observable(observer => { + spyOn(formService, 'getWorkflowUsers').and.returnValue(new Observable((observer) => { observer.next(fakeUserResult); observer.complete(); })); diff --git a/lib/core/form/components/widgets/people/people.widget.ts b/lib/core/form/components/widgets/people/people.widget.ts index 8b279ec883..db527d28c5 100644 --- a/lib/core/form/components/widgets/people/people.widget.ts +++ b/lib/core/form/components/widgets/people/people.widget.ts @@ -64,7 +64,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit { let value = searchTerm.email ? this.getDisplayName(searchTerm) : searchTerm; return this.formService.getWorkflowUsers(value, this.groupId) .pipe( - catchError(err => { + catchError((err) => { this.errorMsg = err.message; return of(); }) diff --git a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts index 4207c367a9..0b6020b8f3 100644 --- a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts +++ b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.spec.ts @@ -59,7 +59,7 @@ describe('RadioButtonsWidgetComponent', () => { restUrl: '' }); - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next(null); observer.complete(); })); @@ -82,7 +82,7 @@ describe('RadioButtonsWidgetComponent', () => { let field = widget.field; spyOn(field, 'updateForm').and.stub(); - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next(null); observer.complete(); })); @@ -102,7 +102,7 @@ describe('RadioButtonsWidgetComponent', () => { id: fieldId, restUrl: '' }); - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next(null); observer.complete(); })); @@ -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((field) => { expect(element.querySelector('#radio-id')).toBeNull(); expect(element.querySelector('#radio-id-opt-1-input')).toBeNull(); }); diff --git a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.ts b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.ts index 23f48949dc..cc34fbd57f 100644 --- a/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.ts +++ b/lib/core/form/components/widgets/radio-buttons/radio-buttons.widget.ts @@ -58,7 +58,7 @@ export class RadioButtonsWidgetComponent extends WidgetComponent implements OnIn this.field.options = result || []; this.field.updateForm(); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } @@ -73,7 +73,7 @@ export class RadioButtonsWidgetComponent extends WidgetComponent implements OnIn this.field.options = result || []; this.field.updateForm(); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } diff --git a/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts b/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts index ffe093ad0e..b246e6bf20 100644 --- a/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts +++ b/lib/core/form/components/widgets/tabs/tabs.widget.spec.ts @@ -57,7 +57,7 @@ describe('TabsWidgetComponent', () => { it('should emit tab changed event', (done) => { let field = new FormFieldModel(null); - widget.formTabChanged.subscribe(tab => { + widget.formTabChanged.subscribe((tab) => { expect(tab).toBe(field); done(); }); diff --git a/lib/core/form/components/widgets/tabs/tabs.widget.ts b/lib/core/form/components/widgets/tabs/tabs.widget.ts index eb1be87e49..139748baa1 100644 --- a/lib/core/form/components/widgets/tabs/tabs.widget.ts +++ b/lib/core/form/components/widgets/tabs/tabs.widget.ts @@ -44,7 +44,7 @@ export class TabsWidgetComponent implements AfterContentChecked { } filterVisibleTabs() { - this.visibleTabs = this.tabs.filter(tab => { + this.visibleTabs = this.tabs.filter((tab) => { return tab.isVisible; }); } diff --git a/lib/core/form/components/widgets/typeahead/typeahead.widget.spec.ts b/lib/core/form/components/widgets/typeahead/typeahead.widget.spec.ts index cbc4f5d51d..637f52cf2f 100644 --- a/lib/core/form/components/widgets/typeahead/typeahead.widget.spec.ts +++ b/lib/core/form/components/widgets/typeahead/typeahead.widget.spec.ts @@ -45,8 +45,8 @@ describe('TypeaheadWidgetComponent', () => { beforeEach(() => { translationService = TestBed.get(TranslateService); - spyOn(translationService, 'instant').and.callFake(key => { return key; }); - spyOn(translationService, 'get').and.callFake(key => { return of(key); }); + spyOn(translationService, 'instant').and.callFake((key) => { return key; }); + spyOn(translationService, 'get').and.callFake((key) => { return of(key); }); formService = new FormService(null, null, null); widget = new TypeaheadWidgetComponent(formService, null); @@ -67,7 +67,7 @@ describe('TypeaheadWidgetComponent', () => { restUrl: 'whateverURL' }); - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next(null); observer.complete(); })); @@ -137,7 +137,7 @@ describe('TypeaheadWidgetComponent', () => { }); it('should setup initial value', () => { - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next([ { id: '1', name: 'One' }, { id: '2', name: 'Two' } @@ -153,7 +153,7 @@ describe('TypeaheadWidgetComponent', () => { }); it('should not setup initial value due to missing option', () => { - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next([ { id: '1', name: 'One' }, { id: '2', name: 'Two' } @@ -175,7 +175,7 @@ describe('TypeaheadWidgetComponent', () => { { id: '2', name: 'Two' } ]; - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next(options); observer.complete(); })); @@ -185,7 +185,7 @@ describe('TypeaheadWidgetComponent', () => { }); it('should update form upon options setup', () => { - spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable(observer => { + spyOn(formService, 'getRestFieldValues').and.returnValue(new Observable((observer) => { observer.next([]); observer.complete(); })); diff --git a/lib/core/form/components/widgets/typeahead/typeahead.widget.ts b/lib/core/form/components/widgets/typeahead/typeahead.widget.ts index 8af38a9ce6..f885d3c4df 100644 --- a/lib/core/form/components/widgets/typeahead/typeahead.widget.ts +++ b/lib/core/form/components/widgets/typeahead/typeahead.widget.ts @@ -67,7 +67,7 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit let fieldValue = this.field.value; if (fieldValue) { - let toSelect = options.find(item => item.id === fieldValue || item.name.toLocaleLowerCase() === fieldValue.toLocaleLowerCase()); + let toSelect = options.find((item) => item.id === fieldValue || item.name.toLocaleLowerCase() === fieldValue.toLocaleLowerCase()); if (toSelect) { this.value = toSelect.name; } @@ -75,7 +75,7 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit this.onFieldChanged(this.field); this.field.updateForm(); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } @@ -92,7 +92,7 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit let fieldValue = this.field.value; if (fieldValue) { - let toSelect = options.find(item => item.id === fieldValue); + let toSelect = options.find((item) => item.id === fieldValue); if (toSelect) { this.value = toSelect.name; } @@ -100,20 +100,20 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit this.onFieldChanged(this.field); this.field.updateForm(); }, - err => this.handleError(err) + (err) => this.handleError(err) ); } getOptions(): FormFieldOption[] { let val = this.value.trim().toLocaleLowerCase(); - return this.field.options.filter(item => { + return this.field.options.filter((item) => { let name = item.name.toLocaleLowerCase(); return name.indexOf(val) > -1; }); } isValidOptionName(optionName: string): boolean { - let option = this.field.options.find(item => item.name && item.name.toLocaleLowerCase() === optionName.toLocaleLowerCase()); + let option = this.field.options.find((item) => item.name && item.name.toLocaleLowerCase() === optionName.toLocaleLowerCase()); return option ? true : false; } diff --git a/lib/core/form/components/widgets/upload-folder/upload-folder.widget.ts b/lib/core/form/components/widgets/upload-folder/upload-folder.widget.ts index e8188e8092..748e11df89 100644 --- a/lib/core/form/components/widgets/upload-folder/upload-folder.widget.ts +++ b/lib/core/form/components/widgets/upload-folder/upload-folder.widget.ts @@ -76,7 +76,7 @@ export class UploadFolderWidgetComponent extends WidgetComponent implements OnIn if (files && files.length > 0) { from(files) - .pipe(mergeMap(file => this.uploadRawContent(file))) + .pipe(mergeMap((file) => this.uploadRawContent(file))) .subscribe( (res) => { filesSaved.push(res); diff --git a/lib/core/form/components/widgets/upload/upload.widget.ts b/lib/core/form/components/widgets/upload/upload.widget.ts index 98cc670076..c20d950137 100644 --- a/lib/core/form/components/widgets/upload/upload.widget.ts +++ b/lib/core/form/components/widgets/upload/upload.widget.ts @@ -76,7 +76,7 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit { if (files && files.length > 0) { from(files) - .pipe(mergeMap(file => this.uploadRawContent(file))) + .pipe(mergeMap((file) => this.uploadRawContent(file))) .subscribe( (res) => filesSaved.push(res), () => this.logService.error('Error uploading file. See console output for more details.'), diff --git a/lib/core/form/components/widgets/widget.component.spec.ts b/lib/core/form/components/widgets/widget.component.spec.ts index 31e3b19426..41c0b3dac0 100644 --- a/lib/core/form/components/widgets/widget.component.spec.ts +++ b/lib/core/form/components/widgets/widget.component.spec.ts @@ -68,7 +68,7 @@ describe('WidgetComponent', () => { let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'}); widget.field = fakeField; - widget.fieldChanged.subscribe(field => { + widget.fieldChanged.subscribe((field) => { expect(field).not.toBe(null); expect(field.id).toBe('fakeField'); expect(field.value).toBe('fakeValue'); @@ -81,7 +81,7 @@ describe('WidgetComponent', () => { it('should send an event when a field is changed', (done) => { let fakeForm = new FormModel(); let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'}); - widget.fieldChanged.subscribe(field => { + widget.fieldChanged.subscribe((field) => { expect(field).not.toBe(null); expect(field.id).toBe('fakeField'); expect(field.value).toBe('fakeValue'); diff --git a/lib/core/form/services/activiti-alfresco.service.ts b/lib/core/form/services/activiti-alfresco.service.ts index 27180af5ec..54e7e25df5 100644 --- a/lib/core/form/services/activiti-alfresco.service.ts +++ b/lib/core/form/services/activiti-alfresco.service.ts @@ -48,7 +48,7 @@ export class ActivitiContentService { return from(apiService.activiti.alfrescoApi.getContentInFolder(accountShortId, folderId)) .pipe( map(this.toJsonArray), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -67,7 +67,7 @@ export class ActivitiContentService { return from(apiService.activiti.alfrescoApi.getRepositories(opts)) .pipe( map(this.toJsonArray), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -89,7 +89,7 @@ export class ActivitiContentService { })) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -106,7 +106,7 @@ export class ActivitiContentService { return from(apiService.activiti.contentApi.createTemporaryRelatedContent(params)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/form/services/ecm-model.service.spec.ts b/lib/core/form/services/ecm-model.service.spec.ts index f86772b5f5..a96ad1f1a2 100644 --- a/lib/core/form/services/ecm-model.service.spec.ts +++ b/lib/core/form/services/ecm-model.service.spec.ts @@ -229,14 +229,14 @@ describe('EcmModelService', () => { it('Should create an ECM type with properties', (done) => { spyOn(service, 'createEcmType').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); }); spyOn(service, 'addPropertyToAType').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -251,14 +251,14 @@ describe('EcmModelService', () => { it('Should return the already existing type', (done) => { spyOn(service, 'searchEcmType').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({test: 'I-EXIST'}); observer.complete(); }); }); spyOn(service, 'createEcmTypeWithProperties').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -273,14 +273,14 @@ describe('EcmModelService', () => { it('Should create an ECM type with properties if the ecm Type is not defined already', (done) => { spyOn(service, 'searchEcmType').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); }); spyOn(service, 'createEcmTypeWithProperties').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -295,14 +295,14 @@ describe('EcmModelService', () => { it('Should create an ECM model for the activiti if not defined already', (done) => { spyOn(service, 'searchActivitiEcmModel').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); }); spyOn(service, 'createActivitiEcmModel').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); @@ -317,14 +317,14 @@ describe('EcmModelService', () => { it('If a model for the activiti is already define has to save the new type', (done) => { spyOn(service, 'searchActivitiEcmModel').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next({test: 'I-EXIST'}); observer.complete(); }); }); spyOn(service, 'saveFomType').and.callFake(() => { - return new Observable(observer => { + return new Observable((observer) => { observer.next(); observer.complete(); }); diff --git a/lib/core/form/services/ecm-model.service.ts b/lib/core/form/services/ecm-model.service.ts index 9e79d160e8..0cb67e3e61 100644 --- a/lib/core/form/services/ecm-model.service.ts +++ b/lib/core/form/services/ecm-model.service.ts @@ -36,22 +36,22 @@ export class EcmModelService { } public createEcmTypeForActivitiForm(formName: string, form: FormModel): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.searchActivitiEcmModel().subscribe( - model => { + (model) => { if (!model) { - this.createActivitiEcmModel(formName, form).subscribe(typeForm => { + this.createActivitiEcmModel(formName, form).subscribe((typeForm) => { observer.next(typeForm); observer.complete(); }); } else { - this.saveFomType(formName, form).subscribe(typeForm => { + this.saveFomType(formName, form).subscribe((typeForm) => { observer.next(typeForm); observer.complete(); }); } }, - err => this.handleError(err) + (err) => this.handleError(err) ); }); @@ -59,38 +59,38 @@ export class EcmModelService { searchActivitiEcmModel() { return this.getEcmModels().pipe(map(function (ecmModels: any) { - return ecmModels.list.entries.find(model => model.entry.name === EcmModelService.MODEL_NAME); + return ecmModels.list.entries.find((model) => model.entry.name === EcmModelService.MODEL_NAME); })); } createActivitiEcmModel(formName: string, form: FormModel): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.createEcmModel(EcmModelService.MODEL_NAME, EcmModelService.MODEL_NAMESPACE).subscribe( - model => { + (model) => { this.logService.info('model created', model); this.activeEcmModel(EcmModelService.MODEL_NAME).subscribe( - modelActive => { + (modelActive) => { this.logService.info('model active', modelActive); - this.createEcmTypeWithProperties(formName, form).subscribe(typeCreated => { + this.createEcmTypeWithProperties(formName, form).subscribe((typeCreated) => { observer.next(typeCreated); observer.complete(); }); }, - err => this.handleError(err) + (err) => this.handleError(err) ); }, - err => this.handleError(err) + (err) => this.handleError(err) ); }); } saveFomType(formName: string, form: FormModel): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe( - ecmType => { + (ecmType) => { this.logService.info('custom types', ecmType); if (!ecmType) { - this.createEcmTypeWithProperties(formName, form).subscribe(typeCreated => { + this.createEcmTypeWithProperties(formName, form).subscribe((typeCreated) => { observer.next(typeCreated); observer.complete(); }); @@ -99,31 +99,31 @@ export class EcmModelService { observer.complete(); } }, - err => this.handleError(err) + (err) => this.handleError(err) ); }); } public createEcmTypeWithProperties(formName: string, form: FormModel): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.createEcmType(formName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe( - typeCreated => { + (typeCreated) => { this.logService.info('type Created', typeCreated); this.addPropertyToAType(EcmModelService.MODEL_NAME, formName, form).subscribe( - propertyAdded => { + (propertyAdded) => { this.logService.info('property Added', propertyAdded); observer.next(typeCreated); observer.complete(); }, - err => this.handleError(err)); + (err) => this.handleError(err)); }, - err => this.handleError(err)); + (err) => this.handleError(err)); }); } public searchEcmType(typeName: string, modelName: string): Observable { return this.getEcmType(modelName).pipe(map(function (customTypes: any) { - return customTypes.list.entries.find(type => type.entry.prefixedName === typeName || type.entry.title === typeName); + return customTypes.list.entries.find((type) => type.entry.prefixedName === typeName || type.entry.title === typeName); })); } @@ -131,7 +131,7 @@ export class EcmModelService { return from(this.apiService.getInstance().core.customModelApi.activateCustomModel(modelName)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -139,7 +139,7 @@ export class EcmModelService { return from(this.apiService.getInstance().core.customModelApi.createCustomModel('DRAFT', '', modelName, modelName, nameSpace)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -147,7 +147,7 @@ export class EcmModelService { return from(this.apiService.getInstance().core.customModelApi.getAllCustomModel()) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -155,7 +155,7 @@ export class EcmModelService { return from(this.apiService.getInstance().core.customModelApi.getAllCustomType(modelName)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -165,7 +165,7 @@ export class EcmModelService { return from(this.apiService.getInstance().core.customModelApi.createCustomType(modelName, name, parentType, typeName, '')) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -192,7 +192,7 @@ export class EcmModelService { return from(this.apiService.getInstance().core.customModelApi.addPropertyToType(modelName, name, properties)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/form/services/form.service.spec.ts b/lib/core/form/services/form.service.spec.ts index 29ed4ee11c..6effe59065 100644 --- a/lib/core/form/services/form.service.spec.ts +++ b/lib/core/form/services/form.service.spec.ts @@ -94,7 +94,7 @@ describe('Form service', () => { let simpleResponseBody = { id: 1, modelType: 'test' }; it('should fetch and parse process definitions', (done) => { - service.getProcessDefinitions().subscribe(result => { + service.getProcessDefinitions().subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/process-definitions')).toBeTruthy(); expect(result).toEqual(JSON.parse(jasmine.Ajax.requests.mostRecent().response).data); done(); @@ -108,7 +108,7 @@ describe('Form service', () => { }); it('should fetch and parse tasks', (done) => { - service.getTasks().subscribe(result => { + service.getTasks().subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/tasks/query')).toBeTruthy(); expect(result).toEqual(JSON.parse(jasmine.Ajax.requests.mostRecent().response).data); done(); @@ -122,7 +122,7 @@ describe('Form service', () => { }); it('should fetch and parse the task by id', (done) => { - service.getTask('1').subscribe(result => { + service.getTask('1').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/tasks/1')).toBeTruthy(); expect(result.id).toEqual('1'); done(); @@ -182,7 +182,7 @@ describe('Form service', () => { }); it('should get task form by id', (done) => { - service.getTaskForm('1').subscribe(result => { + service.getTaskForm('1').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/task-forms/1')).toBeTruthy(); expect(result.id).toEqual(1); done(); @@ -196,7 +196,7 @@ describe('Form service', () => { }); it('should get form definition by id', (done) => { - service.getFormDefinitionById('1').subscribe(result => { + service.getFormDefinitionById('1').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/form-models/1')).toBeTruthy(); expect(result.id).toEqual(1); done(); @@ -218,7 +218,7 @@ describe('Form service', () => { ] }; - service.getFormDefinitionByName(formName).subscribe(result => { + service.getFormDefinitionByName(formName).subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith(`models?filter=myReusableForms&filterText=${formName}&modelType=2`)).toBeTruthy(); expect(result).toEqual(formId); done(); @@ -241,7 +241,7 @@ describe('Form service', () => { }); processApiSpy.getProcessDefinitionStartForm.and.returnValue(Promise.resolve({ id: '1' })); - service.getStartFormDefinition('myprocess:1').subscribe(result => { + service.getStartFormDefinition('myprocess:1').subscribe((result) => { expect(processApiSpy.getProcessDefinitionStartForm).toHaveBeenCalledWith('myprocess:1'); done(); }); @@ -309,7 +309,7 @@ describe('Form service', () => { }); it('should get all the forms with modelType=2', (done) => { - service.getForms().subscribe(result => { + service.getForms().subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('models?modelType=2')).toBeTruthy(); expect(result.length).toEqual(2); done(); @@ -330,7 +330,7 @@ describe('Form service', () => { it('should search for Form with modelType=2', (done) => { let response = { data: [{ id: 1, name: 'findMe' }, { id: 2, name: 'testForm' }] }; - service.searchFrom('findMe').subscribe(result => { + service.searchFrom('findMe').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('models?modelType=2')).toBeTruthy(); expect(result.name).toEqual('findMe'); expect(result.id).toEqual(1); @@ -345,7 +345,7 @@ describe('Form service', () => { }); it('should create a Form with modelType=2', (done) => { - service.createForm('testName').subscribe(result => { + service.createForm('testName').subscribe((result) => { 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'); @@ -365,7 +365,7 @@ describe('Form service', () => { let data = [{ name: 'name' }, { name: 'email' }]; let formDefinitionModel = new FormDefinitionModel(formId, name, 'testUserName', '2016-09-05T14:41:19.049Z', data); - service.addFieldsToAForm(formId, formDefinitionModel).subscribe(result => { + service.addFieldsToAForm(formId, formDefinitionModel).subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/form-models/' + formId)).toBeTruthy(); expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).formRepresentation.name).toEqual(name); done(); @@ -382,7 +382,7 @@ describe('Form service', () => { spyOn(service, 'getUserProfileImageApi').and.returnValue('/app/rest/users/2002/picture'); let fakeFilter: string = 'whatever'; - service.getWorkflowUsers(fakeFilter).subscribe(result => { + service.getWorkflowUsers(fakeFilter).subscribe((result) => { expect(result).toBeDefined(); expect(result.length).toBe(3); expect(result[0].id).toBe(2002); @@ -400,7 +400,7 @@ describe('Form service', () => { it('should return list of groups', (done) => { let fakeFilter: string = 'whatever'; - service.getWorkflowGroups(fakeFilter).subscribe(result => { + service.getWorkflowGroups(fakeFilter).subscribe((result) => { expect(result).toBeDefined(); expect(result.length).toBe(2); expect(result[0].id).toBe('2004'); @@ -433,7 +433,7 @@ describe('Form service', () => { stubAddFieldsToAForm(); - service.createFormFromANode(nameForm).subscribe(result => { + service.createFormFromANode(nameForm).subscribe((result) => { expect(result.id).toEqual(formId); done(); }); diff --git a/lib/core/form/services/form.service.ts b/lib/core/form/services/form.service.ts index e074e92c92..6c0ad2234f 100644 --- a/lib/core/form/services/form.service.ts +++ b/lib/core/form/services/form.service.ts @@ -118,20 +118,20 @@ export class FormService { * @returns The new form */ createFormFromANode(formName: string): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.createForm(formName).subscribe( - form => { + (form) => { this.ecmModelService.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe( - customType => { + (customType) => { let formDefinitionModel = new FormDefinitionModel(form.id, form.name, form.lastUpdatedByFullName, form.lastUpdated, customType.entry.properties); - this.addFieldsToAForm(form.id, formDefinitionModel).subscribe(formData => { + this.addFieldsToAForm(form.id, formDefinitionModel).subscribe((formData) => { observer.next(formData); observer.complete(); - }, err => this.handleError(err)); + }, (err) => this.handleError(err)); }, - err => this.handleError(err)); + (err) => this.handleError(err)); }, - err => this.handleError(err)); + (err) => this.handleError(err)); }); } @@ -193,9 +193,9 @@ export class FormService { ) .pipe( map(function (forms: any) { - return forms.data.find(formData => formData.name === name); + return forms.data.find((formData) => formData.name === name); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -211,7 +211,7 @@ export class FormService { return from(this.modelsApi.getModels(opts)) .pipe( map(this.toJsonArray), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -223,7 +223,7 @@ export class FormService { return from(this.processApi.getProcessDefinitions({})) .pipe( map(this.toJsonArray), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -236,7 +236,7 @@ export class FormService { return from(this.processInstanceVariablesApi.getProcessInstanceVariables(processInstanceId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -248,7 +248,7 @@ export class FormService { return from(this.taskApi.listTasks({})) .pipe( map(this.toJsonArray), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -261,7 +261,7 @@ export class FormService { return from(this.taskApi.getTask(taskId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -276,7 +276,7 @@ export class FormService { return from(this.taskApi.saveTaskForm(taskId, body)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -296,7 +296,7 @@ export class FormService { return from(this.taskApi.completeTaskForm(taskId, body)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -309,7 +309,7 @@ export class FormService { return from(this.taskApi.getTaskForm(taskId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -322,7 +322,7 @@ export class FormService { return from(this.editorApi.getForm(formId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -341,7 +341,7 @@ export class FormService { return from(this.modelsApi.getModels(opts)) .pipe( map(this.getFormId), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -354,7 +354,7 @@ export class FormService { return from(this.processApi.getProcessInstanceStartForm(processId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -367,7 +367,7 @@ export class FormService { return from(this.processApi.getProcessInstance(processId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -380,7 +380,7 @@ export class FormService { return from(this.processApi.getProcessDefinitionStartForm(processId)) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -393,7 +393,7 @@ export class FormService { getRestFieldValues(taskId: string, field: string): Observable { return from(this.taskApi.getRestFieldValues(taskId, field)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -406,7 +406,7 @@ export class FormService { getRestFieldValuesByProcessId(processDefinitionId: string, field: string): Observable { return from(this.processApi.getRestFieldValues(processDefinitionId, field)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -420,7 +420,7 @@ export class FormService { getRestFieldValuesColumnByProcessId(processDefinitionId: string, field: string, column?: string): Observable { return from(this.processApi.getRestTableFieldValues(processDefinitionId, field, column)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -434,7 +434,7 @@ export class FormService { getRestFieldValuesColumn(taskId: string, field: string, column?: string): Observable { return from(this.taskApi.getRestFieldValuesColumn(taskId, field, column)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -467,7 +467,7 @@ export class FormService { }), combineAll(), defaultIfEmpty([]), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -485,7 +485,7 @@ export class FormService { return from(this.groupsApi.getGroups(option)) .pipe( map((response: any) => response.data || []), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/form/services/node.service.spec.ts b/lib/core/form/services/node.service.spec.ts index f5c6b629eb..a6c45f2b61 100644 --- a/lib/core/form/services/node.service.spec.ts +++ b/lib/core/form/services/node.service.spec.ts @@ -65,7 +65,7 @@ describe('NodeService', () => { } }; - service.getNodeMetadata('-nodeid-').subscribe(result => { + service.getNodeMetadata('-nodeid-').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('nodes/-nodeid-')).toBeTruthy(); let node = new NodeMetadata({ test: 'test', @@ -94,7 +94,7 @@ describe('NodeService', () => { } }; - service.getNodeMetadata('-nodeid-').subscribe(result => { + service.getNodeMetadata('-nodeid-').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('nodes/-nodeid-')).toBeTruthy(); let node = new NodeMetadata({ test: 'test', @@ -123,7 +123,7 @@ describe('NodeService', () => { isFolder: true }; - service.createNodeMetadata('typeTest', EcmModelService.MODEL_NAMESPACE, data, '/Sites/swsdp/documentLibrary', 'testNode').subscribe(result => { + service.createNodeMetadata('typeTest', EcmModelService.MODEL_NAMESPACE, data, '/Sites/swsdp/documentLibrary', 'testNode').subscribe((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('-root-/children')).toBeTruthy(); expect(result).toEqual(responseBody); done(); @@ -142,7 +142,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((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('-root-/children')).toBeTruthy(); expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).properties[EcmModelService.MODEL_NAMESPACE + ':test']).toBeDefined(); expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).properties[EcmModelService.MODEL_NAMESPACE + ':testdata']).toBeDefined(); @@ -162,7 +162,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((result) => { expect(jasmine.Ajax.requests.mostRecent().url.endsWith('-root-/children')).toBeTruthy(); expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toBeDefined(); done(); diff --git a/lib/core/form/services/process-content.service.spec.ts b/lib/core/form/services/process-content.service.spec.ts index 91ebca6028..9e96276c52 100644 --- a/lib/core/form/services/process-content.service.spec.ts +++ b/lib/core/form/services/process-content.service.spec.ts @@ -146,7 +146,7 @@ describe('ProcessContentService', () => { it('should return the unsupported content when the file is an image', (done) => { let contentId: number = 888; - service.getFileContent(contentId).subscribe(result => { + service.getFileContent(contentId).subscribe((result) => { expect(result.id).toEqual(contentId); expect(result.name).toEqual('fake-name.jpg'); expect(result.simpleType).toEqual('image'); @@ -164,7 +164,7 @@ describe('ProcessContentService', () => { it('should return the supported content when the file is a pdf', (done) => { let contentId: number = 999; - service.getFileContent(contentId).subscribe(result => { + service.getFileContent(contentId).subscribe((result) => { expect(result.id).toEqual(contentId); expect(result.name).toEqual('fake-name.pdf'); expect(result.simpleType).toEqual('pdf'); @@ -189,7 +189,7 @@ describe('ProcessContentService', () => { let contentId: number = 999; let blob = createFakeBlob(); spyOn(service, 'getContentThumbnail').and.returnValue(of(blob)); - service.getContentThumbnail(contentId).subscribe(result => { + service.getContentThumbnail(contentId).subscribe((result) => { expect(result).toEqual(jasmine.any(Blob)); expect(result.size).toEqual(48); expect(result.type).toEqual('image/png'); diff --git a/lib/core/form/services/process-content.service.ts b/lib/core/form/services/process-content.service.ts index 60fcb84c21..7b242be092 100644 --- a/lib/core/form/services/process-content.service.ts +++ b/lib/core/form/services/process-content.service.ts @@ -45,7 +45,7 @@ export class ProcessContentService { */ createTemporaryRawRelatedContent(file: any): Observable { return from(this.contentApi.createTemporaryRawRelatedContent(file)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -55,7 +55,7 @@ export class ProcessContentService { */ getFileContent(contentId: number): Observable { return from(this.contentApi.getContent(contentId)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -65,7 +65,7 @@ export class ProcessContentService { */ getFileRawContent(contentId: number): Observable { return from(this.contentApi.getRawContent(contentId)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -74,7 +74,7 @@ export class ProcessContentService { * @returns Binary data of the content preview */ getContentPreview(contentId: number): Observable { - return new Observable(observer => { + return new Observable((observer) => { this.contentApi.getContentPreview(contentId).then( (result) => { observer.next(result); @@ -112,7 +112,7 @@ export class ProcessContentService { */ getContentThumbnail(contentId: number): Observable { return from(this.contentApi.getContentThumbnail(contentId)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -122,7 +122,7 @@ export class ProcessContentService { */ getTaskRelatedContent(taskId: string): Observable { return from(this.contentApi.getRelatedContentForTask(taskId)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -132,7 +132,7 @@ export class ProcessContentService { */ getProcessRelatedContent(processId: string): Observable { return from(this.contentApi.getRelatedContentForProcessInstance(processId)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -142,7 +142,7 @@ export class ProcessContentService { */ deleteRelatedContent(contentId: number): Observable { return from(this.contentApi.deleteContent(contentId)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -154,7 +154,7 @@ export class ProcessContentService { */ createProcessRelatedContent(processInstanceId: string, content: any, opts?: any): Observable { return from(this.contentApi.createRelatedContentOnProcessInstance(processInstanceId, content, opts)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** @@ -166,7 +166,7 @@ export class ProcessContentService { */ createTaskRelatedContent(taskId: string, file: any, opts?: any) { return from(this.contentApi.createRelatedContentOnTask(taskId, file, opts)) - .pipe(catchError(err => this.handleError(err))); + .pipe(catchError((err) => this.handleError(err))); } /** diff --git a/lib/core/form/services/widget-visibility.service.ts b/lib/core/form/services/widget-visibility.service.ts index c3cd7abfb3..9a2b698ba4 100644 --- a/lib/core/form/services/widget-visibility.service.ts +++ b/lib/core/form/services/widget-visibility.service.ts @@ -38,11 +38,11 @@ export class WidgetVisibilityService { public refreshVisibility(form: FormModel) { if (form && form.tabs && form.tabs.length > 0) { - form.tabs.map(tabModel => this.refreshEntityVisibility(tabModel)); + form.tabs.map((tabModel) => this.refreshEntityVisibility(tabModel)); } if (form) { - form.getFormFields().map(field => this.refreshEntityVisibility(field)); + form.getFormFields().map((field) => this.refreshEntityVisibility(field)); } } @@ -150,7 +150,7 @@ export class WidgetVisibilityService { if (field.value && field.value.name) { value = field.value.name; } else if (field.options) { - let option = field.options.find(opt => opt.id === field.value); + let option = field.options.find((opt) => opt.id === field.value); if (option) { value = this.getValueFromOption(fieldId, option); } @@ -188,14 +188,14 @@ export class WidgetVisibilityService { private getFormVariableValue(form: FormModel, name: string) { if (form.json.variables) { - let formVariable = form.json.variables.find(formVar => formVar.name === name); + let formVariable = form.json.variables.find((formVar) => formVar.name === name); return formVariable ? formVariable.value : formVariable; } } private getProcessVariableValue(name: string, processVarList: TaskProcessVariableModel[]) { if (this.processVarList) { - let processVariable = this.processVarList.find(variable => variable.id === name); + let processVariable = this.processVarList.find((variable) => variable.id === name); return processVariable ? processVariable.value : processVariable; } } @@ -248,12 +248,12 @@ export class WidgetVisibilityService { getTaskProcessVariable(taskId: string): Observable { return from(this.apiService.getInstance().activiti.taskFormsApi.getTaskFormVariables(taskId)) .pipe( - map(res => { + map((res) => { let jsonRes = this.toJson(res); this.processVarList = jsonRes; return jsonRes; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/login/components/login.component.ts b/lib/core/login/components/login.component.ts index ef7f536835..96e9dcc5c1 100644 --- a/lib/core/login/components/login.component.ts +++ b/lib/core/login/components/login.component.ts @@ -171,7 +171,7 @@ export class LoginComponent implements OnInit { this.initFormFieldsDefault(); this.initFormFieldsMessagesDefault(); } - this.form.valueChanges.subscribe(data => this.onValueChanged(data)); + this.form.valueChanges.subscribe((data) => this.onValueChanged(data)); } submit() { diff --git a/lib/core/mock/app-config.service.mock.ts b/lib/core/mock/app-config.service.mock.ts index ed85361ec6..ecff93460f 100644 --- a/lib/core/mock/app-config.service.mock.ts +++ b/lib/core/mock/app-config.service.mock.ts @@ -35,7 +35,7 @@ export class AppConfigServiceMock extends AppConfigService { } load(): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve(this.config); }); } diff --git a/lib/core/mock/cookie.service.mock.ts b/lib/core/mock/cookie.service.mock.ts index f6df1a11cf..eb49a7f7bd 100644 --- a/lib/core/mock/cookie.service.mock.ts +++ b/lib/core/mock/cookie.service.mock.ts @@ -36,7 +36,7 @@ export class CookieServiceMock extends CookieService { /** @override */ clear() { - Object.keys(this).forEach(key => { + Object.keys(this).forEach((key) => { if (this.hasOwnProperty(key) && typeof(this[key]) !== 'function') { this[key] = undefined; } diff --git a/lib/core/pagination/infinite-pagination.component.ts b/lib/core/pagination/infinite-pagination.component.ts index d06ac684af..f990c6e144 100644 --- a/lib/core/pagination/infinite-pagination.component.ts +++ b/lib/core/pagination/infinite-pagination.component.ts @@ -78,7 +78,7 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio ngOnInit() { if (this.target) { - this.paginationSubscription = this.target.pagination.subscribe(pagination => { + this.paginationSubscription = this.target.pagination.subscribe((pagination) => { this.isLoading = false; this.pagination = pagination; this.pageSize = this.userPreferencesService.paginationSize || this.pageSize; diff --git a/lib/core/services/apps-process.service.ts b/lib/core/services/apps-process.service.ts index e4f518c625..a2f60cdc67 100644 --- a/lib/core/services/apps-process.service.ts +++ b/lib/core/services/apps-process.service.ts @@ -39,7 +39,7 @@ export class AppsProcessService { return from(this.apiService.getInstance().activiti.appsApi.getAppDefinitions()) .pipe( map((response: any) => response.data), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -51,8 +51,8 @@ export class AppsProcessService { getDeployedApplicationsByName(name: string): Observable { return from(this.apiService.getInstance().activiti.appsApi.getAppDefinitions()) .pipe( - map((response: any) => response.data.find(app => app.name === name)), - catchError(err => this.handleError(err)) + map((response: any) => response.data.find((app) => app.name === name)), + catchError((err) => this.handleError(err)) ); } @@ -64,8 +64,8 @@ export class AppsProcessService { getApplicationDetailsById(appId: number): Observable { return from(this.apiService.getInstance().activiti.appsApi.getAppDefinitions()) .pipe( - map((response: any) => response.data.find(app => app.id === appId)), - catchError(err => this.handleError(err)) + map((response: any) => response.data.find((app) => app.id === appId)), + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/authentication.service.ts b/lib/core/services/authentication.service.ts index b98882f1db..a2387419e3 100644 --- a/lib/core/services/authentication.service.ts +++ b/lib/core/services/authentication.service.ts @@ -108,7 +108,7 @@ export class AuthenticationService { ticket: response }; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -150,11 +150,11 @@ export class AuthenticationService { logout() { return from(this.callApiLogout()) .pipe( - tap(response => { + tap((response) => { this.onLogout.next(response); return response; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/comment-content.service.ts b/lib/core/services/comment-content.service.ts index a9b9abc282..39a871e0f0 100644 --- a/lib/core/services/comment-content.service.ts +++ b/lib/core/services/comment-content.service.ts @@ -48,7 +48,7 @@ export class CommentContentService { createdBy: response.entry.createdBy }); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -72,7 +72,7 @@ export class CommentContentService { }); return comments; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/comment-process.service.ts b/lib/core/services/comment-process.service.ts index 02c037ea26..15d6d2c2b9 100644 --- a/lib/core/services/comment-process.service.ts +++ b/lib/core/services/comment-process.service.ts @@ -49,7 +49,7 @@ export class CommentProcessService { createdBy: response.createdBy }); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -69,7 +69,7 @@ export class CommentProcessService { }); return comments; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -89,7 +89,7 @@ export class CommentProcessService { }); return comments; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -111,7 +111,7 @@ export class CommentProcessService { createdBy: response.createdBy }); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/content.service.ts b/lib/core/services/content.service.ts index 24bdf7437b..4baf186164 100644 --- a/lib/core/services/content.service.ts +++ b/lib/core/services/content.service.ts @@ -157,7 +157,7 @@ export class ContentService { getNodeContent(nodeId: string): Observable { return from(this.apiService.getInstance().core.nodesApi.getFileContent(nodeId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -171,7 +171,7 @@ export class ContentService { createFolder(relativePath: string, name: string, parentId?: string): Observable { return from(this.apiService.getInstance().nodes.createFolder(name, relativePath, parentId)) .pipe( - tap(data => { + tap((data) => { this.folderCreated.next( { relativePath: relativePath, name: name, @@ -179,7 +179,7 @@ export class ContentService { node: data }); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -204,9 +204,9 @@ export class ContentService { if (this.hasAllowableOperations(node)) { if (permission && permission.startsWith('!')) { - hasPermission = node.allowableOperations.find(currentPermission => currentPermission === permission.replace('!', '')) ? false : true; + hasPermission = node.allowableOperations.find((currentPermission) => currentPermission === permission.replace('!', '')) ? false : true; } else { - hasPermission = node.allowableOperations.find(currentPermission => currentPermission === permission) ? true : false; + hasPermission = node.allowableOperations.find((currentPermission) => currentPermission === permission) ? true : false; } } else { diff --git a/lib/core/services/deleted-nodes-api.service.ts b/lib/core/services/deleted-nodes-api.service.ts index 59b5d867b8..114960b122 100644 --- a/lib/core/services/deleted-nodes-api.service.ts +++ b/lib/core/services/deleted-nodes-api.service.ts @@ -51,7 +51,7 @@ export class DeletedNodesApiService { const promise = this.nodesApi.getDeletedNodes(queryOptions); return from(promise).pipe( - catchError(err => of(err)) + catchError((err) => of(err)) ); } } diff --git a/lib/core/services/discovery-api.service.ts b/lib/core/services/discovery-api.service.ts index 52b93495c8..e1cd8df0fc 100644 --- a/lib/core/services/discovery-api.service.ts +++ b/lib/core/services/discovery-api.service.ts @@ -36,8 +36,8 @@ export class DiscoveryApiService { public getEcmProductInfo(): Observable { return from(this.apiService.getInstance().discovery.discoveryApi.getRepositoryInformation()) .pipe( - map(res => new EcmProductVersionModel(res)), - catchError(err => throwError(err)) + map((res) => new EcmProductVersionModel(res)), + catchError((err) => throwError(err)) ); } @@ -48,8 +48,8 @@ export class DiscoveryApiService { public getBpmProductInfo(): Observable { return from(this.apiService.getInstance().activiti.aboutApi.getAppVersion()) .pipe( - map(res => new BpmProductVersionModel(res)), - catchError(err => throwError(err)) + map((res) => new BpmProductVersionModel(res)), + catchError((err) => throwError(err)) ); } } diff --git a/lib/core/services/favorites-api.service.ts b/lib/core/services/favorites-api.service.ts index 3c54da5bb6..41c22fbc34 100644 --- a/lib/core/services/favorites-api.service.ts +++ b/lib/core/services/favorites-api.service.ts @@ -84,7 +84,7 @@ export class FavoritesApiService { .then(this.remapFavoritesData); return from(promise).pipe( - catchError(err => of(err)) + catchError((err) => of(err)) ); } } diff --git a/lib/core/services/nodes-api.service.ts b/lib/core/services/nodes-api.service.ts index 54e1d73788..a5836dd071 100644 --- a/lib/core/services/nodes-api.service.ts +++ b/lib/core/services/nodes-api.service.ts @@ -55,7 +55,7 @@ export class NodesApiService { .then(this.getEntryFromEntity); return from(promise).pipe( - catchError(err => throwError(err)) + catchError((err) => throwError(err)) ); } @@ -76,7 +76,7 @@ export class NodesApiService { .getNodeChildren(nodeId, queryOptions); return from(promise).pipe( - catchError(err => throwError(err)) + catchError((err) => throwError(err)) ); } @@ -93,7 +93,7 @@ export class NodesApiService { .then(this.getEntryFromEntity); return from(promise).pipe( - catchError(err => throwError(err)) + catchError((err) => throwError(err)) ); } @@ -127,7 +127,7 @@ export class NodesApiService { .then(this.getEntryFromEntity); return from(promise).pipe( - catchError(err => throwError(err)) + catchError((err) => throwError(err)) ); } @@ -141,7 +141,7 @@ export class NodesApiService { const promise = this.nodesApi.deleteNode(nodeId, options); return from(promise).pipe( - catchError(err => throwError(err)) + catchError((err) => throwError(err)) ); } @@ -156,7 +156,7 @@ export class NodesApiService { .then(this.getEntryFromEntity); return from(promise).pipe( - catchError(err => throwError(err)) + catchError((err) => throwError(err)) ); } } diff --git a/lib/core/services/people-content.service.ts b/lib/core/services/people-content.service.ts index a7c99f9e47..9bb39d855c 100644 --- a/lib/core/services/people-content.service.ts +++ b/lib/core/services/people-content.service.ts @@ -40,7 +40,7 @@ export class PeopleContentService { const promise = this.peopleApi.getPerson(personId); return from(promise).pipe( - catchError(err => of(err)) + catchError((err) => of(err)) ); } diff --git a/lib/core/services/people-process.service.ts b/lib/core/services/people-process.service.ts index 61c19b997d..03ec80bda5 100644 --- a/lib/core/services/people-process.service.ts +++ b/lib/core/services/people-process.service.ts @@ -43,7 +43,7 @@ export class PeopleProcessService { return from(this.getWorkflowUserApi(option)) .pipe( map((response: any) => response.data || []), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -66,7 +66,7 @@ export class PeopleProcessService { let node = {userId: idToInvolve}; return from(this.involveUserToTaskApi(taskId, node)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -80,7 +80,7 @@ export class PeopleProcessService { let node = {userId: idToRemove}; return from(this.removeInvolvedUserFromTaskApi(taskId, node)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/search.service.ts b/lib/core/services/search.service.ts index d8455b7b7e..f751b9f877 100644 --- a/lib/core/services/search.service.ts +++ b/lib/core/services/search.service.ts @@ -41,7 +41,7 @@ export class SearchService { }); return from(promise).pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -54,7 +54,7 @@ export class SearchService { }); return from(promise).pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -66,7 +66,7 @@ export class SearchService { }); return from(promise).pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/shared-links-api.service.ts b/lib/core/services/shared-links-api.service.ts index 656431ec4e..17ce440f17 100644 --- a/lib/core/services/shared-links-api.service.ts +++ b/lib/core/services/shared-links-api.service.ts @@ -50,7 +50,7 @@ export class SharedLinksApiService { const promise = this.sharedLinksApi.findSharedLinks(queryOptions); return from(promise).pipe( - catchError(err => of(err)) + catchError((err) => of(err)) ); } @@ -64,7 +64,7 @@ export class SharedLinksApiService { const promise = this.sharedLinksApi.addSharedLink({ nodeId: nodeId }); return from(promise).pipe( - catchError(err => of(err)) + catchError((err) => of(err)) ); } @@ -77,7 +77,7 @@ export class SharedLinksApiService { const promise = this.sharedLinksApi.deleteSharedLink(sharedId); return from(promise).pipe( - catchError(err => of(err)) + catchError((err) => of(err)) ); } } diff --git a/lib/core/services/sites.service.ts b/lib/core/services/sites.service.ts index 4419350a4a..c13d534af3 100644 --- a/lib/core/services/sites.service.ts +++ b/lib/core/services/sites.service.ts @@ -43,7 +43,7 @@ export class SitesService { const queryOptions = Object.assign({}, defaultOptions, opts); return from(this.apiService.getInstance().core.sitesApi.getSites(queryOptions)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -56,7 +56,7 @@ export class SitesService { getSite(siteId: string, opts?: any): Observable { return from(this.apiService.getInstance().core.sitesApi.getSite(siteId, opts)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -71,7 +71,7 @@ export class SitesService { options.permanent = permanentFlag; return from(this.apiService.getInstance().core.sitesApi.deleteSite(siteId, options)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/services/thumbnail.service.ts b/lib/core/services/thumbnail.service.ts index 57e60ff38c..64cf354fb1 100644 --- a/lib/core/services/thumbnail.service.ts +++ b/lib/core/services/thumbnail.service.ts @@ -156,7 +156,7 @@ export class ThumbnailService { }; constructor(public contentService: ContentService, matIconRegistry: MatIconRegistry, sanitizer: DomSanitizer) { - Object.keys(this.mimeTypeIcons).forEach(key => { + Object.keys(this.mimeTypeIcons).forEach((key) => { matIconRegistry.addSvgIcon(key, sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key])); }); } diff --git a/lib/core/services/translate-loader.service.ts b/lib/core/services/translate-loader.service.ts index 62120ad132..3843d2f26e 100644 --- a/lib/core/services/translate-loader.service.ts +++ b/lib/core/services/translate-loader.service.ts @@ -38,7 +38,7 @@ export class TranslateLoaderService implements TranslateLoader { } registerProvider(name: string, path: string) { - let registered = this.providers.find(provider => provider.name === name); + let registered = this.providers.find((provider) => provider.name === name); if (registered) { registered.path = path; } else { @@ -47,7 +47,7 @@ export class TranslateLoaderService implements TranslateLoader { } providerRegistered(name: string): boolean { - return this.providers.find(x => x.name === name) ? true : false; + return this.providers.find((x) => x.name === name) ? true : false; } getComponentToFetch(lang: string): Array> { @@ -83,7 +83,7 @@ export class TranslateLoaderService implements TranslateLoader { } isComponentInQueue(lang: string, name: string) { - return (this.queue[lang] || []).find(x => x === name) ? true : false; + return (this.queue[lang] || []).find((x) => x === name) ? true : false; } getFullTranslationJSON(lang: string): any { @@ -100,7 +100,7 @@ export class TranslateLoaderService implements TranslateLoader { } return a.name.localeCompare(b.name); }) - .forEach(model => { + .forEach((model) => { if (model.json && model.json[lang]) { result = ObjectUtils.merge(result, model.json[lang]); } @@ -112,9 +112,9 @@ export class TranslateLoaderService implements TranslateLoader { getTranslation(lang: string): Observable { let hasFailures = false; const batch = [ - ...this.getComponentToFetch(lang).map(observable => { + ...this.getComponentToFetch(lang).map((observable) => { return observable.pipe( - catchError(error => { + catchError((error) => { console.warn(error); hasFailures = true; return of(error); @@ -123,7 +123,7 @@ export class TranslateLoaderService implements TranslateLoader { }) ]; - return new Observable(observer => { + return new Observable((observer) => { if (batch.length > 0) { forkJoin(batch).subscribe( diff --git a/lib/core/services/upload.service.spec.ts b/lib/core/services/upload.service.spec.ts index 8c6689f783..9c0b8fad89 100644 --- a/lib/core/services/upload.service.spec.ts +++ b/lib/core/services/upload.service.spec.ts @@ -98,7 +98,7 @@ describe('UploadService', () => { it('should make XHR done request after the file is added in the queue', (done) => { let emitter = new EventEmitter(); - let emitterDisposable = emitter.subscribe(e => { + let emitterDisposable = emitter.subscribe((e) => { expect(e.value).toBe('File uploaded'); emitterDisposable.unsubscribe(); done(); @@ -124,7 +124,7 @@ describe('UploadService', () => { it('should make XHR error request after an error occur', (done) => { let emitter = new EventEmitter(); - let emitterDisposable = emitter.subscribe(e => { + let emitterDisposable = emitter.subscribe((e) => { expect(e.value).toBe('Error file uploaded'); emitterDisposable.unsubscribe(); done(); @@ -148,7 +148,7 @@ describe('UploadService', () => { it('should make XHR abort request after the xhr abort is called', (done) => { let emitter = new EventEmitter(); - let emitterDisposable = emitter.subscribe(e => { + let emitterDisposable = emitter.subscribe((e) => { expect(e.value).toEqual('File aborted'); emitterDisposable.unsubscribe(); done(); @@ -200,7 +200,7 @@ describe('UploadService', () => { it('should use custom root folder ID given to the service', (done) => { let emitter = new EventEmitter(); - let emitterDisposable = emitter.subscribe(e => { + let emitterDisposable = emitter.subscribe((e) => { expect(e.value).toBe('File uploaded'); emitterDisposable.unsubscribe(); done(); @@ -259,11 +259,11 @@ describe('UploadService', () => { it('should start downloading the next one if a file of the list is aborted', (done) => { let emitter = new EventEmitter(); - service.fileUploadAborted.subscribe(e => { + service.fileUploadAborted.subscribe((e) => { expect(e).not.toBeNull(); }); - service.fileUploadCancelled.subscribe(e => { + service.fileUploadCancelled.subscribe((e) => { expect(e).not.toBeNull(); done(); }); diff --git a/lib/core/services/upload.service.ts b/lib/core/services/upload.service.ts index d372a961de..af8f31d174 100644 --- a/lib/core/services/upload.service.ts +++ b/lib/core/services/upload.service.ts @@ -79,7 +79,7 @@ export class UploadService { * @returns Array of files that were not blocked from upload by the ignore list */ addToQueue(...files: FileModel[]): FileModel[] { - const allowedFiles = files.filter(currentFile => this.filterElement(currentFile)); + const allowedFiles = files.filter((currentFile) => this.filterElement(currentFile)); this.queue = this.queue.concat(allowedFiles); this.queueChanged.next(this.queue); return allowedFiles; @@ -107,7 +107,7 @@ export class UploadService { */ uploadFilesInTheQueue(emitter?: EventEmitter): void { if (!this.activeTask) { - let file = this.queue.find(currentFile => currentFile.status === FileUploadStatus.Pending); + let file = this.queue.find((currentFile) => currentFile.status === FileUploadStatus.Pending); if (file) { this.onUploadStarting(file); @@ -135,7 +135,7 @@ export class UploadService { * @param files One or more separate parameters or an array of files specifying uploads to cancel */ cancelUpload(...files: FileModel[]) { - files.forEach(file => { + files.forEach((file) => { const promise = this.cache[file.id]; if (promise) { @@ -212,19 +212,19 @@ export class UploadService { emitter.emit({ value: 'File aborted' }); } }) - .on('error', err => { + .on('error', (err) => { this.onUploadError(file, err); if (emitter) { emitter.emit({ value: 'Error file uploaded' }); } }) - .on('success', data => { + .on('success', (data) => { this.onUploadComplete(file, data); if (emitter) { emitter.emit({ value: data }); } }) - .catch(err => { + .catch((err) => { throw err; }); diff --git a/lib/core/testing/setupTestBed.ts b/lib/core/testing/setupTestBed.ts index 585eb37b79..a9c8586a87 100644 --- a/lib/core/testing/setupTestBed.ts +++ b/lib/core/testing/setupTestBed.ts @@ -30,7 +30,7 @@ const preventAngularFromResetting = () => (TestBed.resetTestingModule = () => Te const allowAngularToReset = () => (TestBed.resetTestingModule = resetTestingModule); export const setupTestBed = (moduleDef: TestModuleMetadata) => { - beforeAll(done => + beforeAll((done) => (async () => { localStorage.clear(); sessionStorage.clear(); diff --git a/lib/core/userinfo/services/bpm-user.service.ts b/lib/core/userinfo/services/bpm-user.service.ts index a661223ef0..cbc81a7e17 100644 --- a/lib/core/userinfo/services/bpm-user.service.ts +++ b/lib/core/userinfo/services/bpm-user.service.ts @@ -48,7 +48,7 @@ export class BpmUserService { map((data: UserRepresentation) => { return new BpmUserModel(data); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/userinfo/services/ecm-user.service.ts b/lib/core/userinfo/services/ecm-user.service.ts index c4c5486789..de00dee182 100644 --- a/lib/core/userinfo/services/ecm-user.service.ts +++ b/lib/core/userinfo/services/ecm-user.service.ts @@ -46,7 +46,7 @@ export class EcmUserService { map((personEntry: PersonEntry) => { return new EcmUserModel(personEntry.entry); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/core/utils/file-utils.ts b/lib/core/utils/file-utils.ts index 7b4176f272..b39974ac9e 100644 --- a/lib/core/utils/file-utils.ts +++ b/lib/core/utils/file-utils.ts @@ -26,16 +26,16 @@ export class FileUtils { static flatten(folder: any): Promise { let reader = folder.createReader(); let files: FileInfo[] = []; - return new Promise(resolve => { + return new Promise((resolve) => { let iterations = []; (function traverse() { reader.readEntries((entries) => { if (!entries.length) { - Promise.all(iterations).then(result => resolve(files)); + Promise.all(iterations).then(() => resolve(files)); } else { - iterations.push(Promise.all(entries.map(entry => { + iterations.push(Promise.all(entries.map((entry) => { if (entry.isFile) { - return new Promise(resolveFile => { + return new Promise((resolveFile) => { entry.file(function (file: File) { files.push({ entry: entry, @@ -46,7 +46,7 @@ export class FileUtils { }); }); } else { - return FileUtils.flatten(entry).then(result => { + return FileUtils.flatten(entry).then((result) => { files.push(...result); }); } diff --git a/lib/core/utils/momentDateAdapter.ts b/lib/core/utils/momentDateAdapter.ts index 82fe862b63..657ee78635 100644 --- a/lib/core/utils/momentDateAdapter.ts +++ b/lib/core/utils/momentDateAdapter.ts @@ -48,7 +48,7 @@ export class MomentDateAdapter extends DateAdapter { case 'short': return this.localeData.monthsShort(); case 'narrow': - return this.localeData.monthsShort().map(month => month[0]); + return this.localeData.monthsShort().map((month) => month[0]); default : return; } diff --git a/lib/core/utils/object-utils.ts b/lib/core/utils/object-utils.ts index 930b83f1a8..0670b7d5b3 100644 --- a/lib/core/utils/object-utils.ts +++ b/lib/core/utils/object-utils.ts @@ -50,8 +50,8 @@ export class ObjectUtils { static merge(...objects): any { let result = {}; - objects.forEach(source => { - Object.keys(source).forEach(prop => { + objects.forEach((source) => { + Object.keys(source).forEach((prop) => { if (prop in result && Array.isArray(result[prop])) { result[prop] = result[prop].concat(source[prop]); } else if (prop in result && typeof result[prop] === 'object') { diff --git a/lib/core/viewer/components/pdfViewer-thumbnails.component.spec.ts b/lib/core/viewer/components/pdfViewer-thumbnails.component.spec.ts index 5e5f73041b..cd838a4bb8 100644 --- a/lib/core/viewer/components/pdfViewer-thumbnails.component.spec.ts +++ b/lib/core/viewer/components/pdfViewer-thumbnails.component.spec.ts @@ -85,8 +85,8 @@ describe('PdfThumbListComponent', () => { fixture.nativeElement.scrollTop = 0; fixture.detectChanges(); - const renderedIds = component.renderItems.map(item => item.id); - const rangeIds = viewerMock._pages.slice(0, 6).map(item => item.id); + const renderedIds = component.renderItems.map((item) => item.id); + const rangeIds = viewerMock._pages.slice(0, 6).map((item) => item.id); expect(renderedIds).toEqual(rangeIds); }); @@ -96,8 +96,8 @@ describe('PdfThumbListComponent', () => { fixture.nativeElement.scrollTop = 700; fixture.detectChanges(); - const renderedIds = component.renderItems.map(item => item.id); - const rangeIds = viewerMock._pages.slice(5, 12).map(item => item.id); + const renderedIds = component.renderItems.map((item) => item.id); + const rangeIds = viewerMock._pages.slice(5, 12).map((item) => item.id); expect(renderedIds).toEqual(rangeIds); }); @@ -105,13 +105,13 @@ describe('PdfThumbListComponent', () => { it('should render items containing current document page', () => { fixture.detectChanges(); - const renderedIds = component.renderItems.map(item => item.id); + const renderedIds = component.renderItems.map((item) => item.id); expect(renderedIds).not.toContain(10); component.scrollInto(10); - const newRenderedIds = component.renderItems.map(item => item.id); + const newRenderedIds = component.renderItems.map((item) => item.id); expect(newRenderedIds).toContain(10); }); @@ -120,14 +120,14 @@ describe('PdfThumbListComponent', () => { fixture.nativeElement.scrollTop = 1700; fixture.detectChanges(); - const renderedIds = component.renderItems.map(item => item.id); + const renderedIds = component.renderItems.map((item) => item.id); expect(renderedIds).toContain(12); /* cspell:disable-next-line */ viewerMock.eventBus.dispatch('pagechange', { pageNumber: 12 }); - const newRenderedIds = component.renderItems.map(item => item.id); + const newRenderedIds = component.renderItems.map((item) => item.id); expect(newRenderedIds).toContain(12); }); diff --git a/lib/core/viewer/components/pdfViewer.component.spec.ts b/lib/core/viewer/components/pdfViewer.component.spec.ts index 75e2c14a4d..96e6723e0e 100644 --- a/lib/core/viewer/components/pdfViewer.component.spec.ts +++ b/lib/core/viewer/components/pdfViewer.component.spec.ts @@ -251,7 +251,7 @@ describe('Test PdfViewer component', () => { let componentBlobTestComponent: BlobTestComponent; let elementBlobTestComponent: HTMLElement; - beforeEach(done => { + beforeEach((done) => { fixtureBlobTestComponent = TestBed.createComponent(BlobTestComponent); componentBlobTestComponent = fixtureBlobTestComponent.componentInstance; elementBlobTestComponent = fixtureBlobTestComponent.nativeElement; diff --git a/lib/core/viewer/components/pdfViewer.component.ts b/lib/core/viewer/components/pdfViewer.component.ts index a2230ea260..68979f4d30 100644 --- a/lib/core/viewer/components/pdfViewer.component.ts +++ b/lib/core/viewer/components/pdfViewer.component.ts @@ -417,7 +417,7 @@ export class PdfViewerComponent implements OnChanges, OnDestroy { disableClose: true, data: { reason } }) - .afterClosed().subscribe(password => { + .afterClosed().subscribe((password) => { if (password) { callback(password); } diff --git a/lib/core/viewer/components/txtViewer.component.ts b/lib/core/viewer/components/txtViewer.component.ts index 36f84dbf0a..4117d00765 100644 --- a/lib/core/viewer/components/txtViewer.component.ts +++ b/lib/core/viewer/components/txtViewer.component.ts @@ -58,7 +58,7 @@ export class TxtViewerComponent implements OnChanges { private getUrlContent(url: string): Promise { return new Promise((resolve, reject) => { - this.http.get(url, { responseType: 'text' }).subscribe(res => { + this.http.get(url, { responseType: 'text' }).subscribe((res) => { this.content = res; resolve(); }, (event) => { diff --git a/lib/core/viewer/components/viewer.component.spec.ts b/lib/core/viewer/components/viewer.component.spec.ts index c09d1b0442..62aaec49a4 100644 --- a/lib/core/viewer/components/viewer.component.spec.ts +++ b/lib/core/viewer/components/viewer.component.spec.ts @@ -569,7 +569,7 @@ describe('ViewerComponent', () => { component.fileName = 'fileName'; fixture.detectChanges(); - component.download.subscribe(e => { + component.download.subscribe((e) => { expect(e).not.toBeNull(); done(); }); @@ -617,7 +617,7 @@ describe('ViewerComponent', () => { component.allowPrint = true; fixture.detectChanges(); - component.print.subscribe(e => { + component.print.subscribe((e) => { expect(e).not.toBeNull(); done(); }); @@ -665,7 +665,7 @@ describe('ViewerComponent', () => { component.allowShare = true; fixture.detectChanges(); - component.share.subscribe(e => { + component.share.subscribe((e) => { expect(e).not.toBeNull(); done(); }); diff --git a/lib/core/viewer/components/viewer.component.ts b/lib/core/viewer/components/viewer.component.ts index 6da57ec648..087f28dc7b 100644 --- a/lib/core/viewer/components/viewer.component.ts +++ b/lib/core/viewer/components/viewer.component.ts @@ -288,12 +288,12 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { ngOnInit() { this.subscriptions.push( - this.apiService.nodeUpdated.subscribe(node => this.onNodeUpdated(node)) + this.apiService.nodeUpdated.subscribe((node) => this.onNodeUpdated(node)) ); } ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.subscriptions.forEach((subscription) => subscription.unsubscribe()); this.subscriptions = []; } @@ -335,7 +335,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { } else if (this.sharedLinkId) { this.apiService.sharedLinksApi.getSharedLink(this.sharedLinkId).then( - details => { + (details) => { this.setUpSharedLinkFile(details); this.isLoading = false; }, @@ -710,10 +710,10 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { const supported = await this.apiService.renditionsApi.getRenditions(nodeId); - let rendition = supported.list.entries.find(obj => obj.entry.id.toLowerCase() === renditionId); + let rendition = supported.list.entries.find((obj) => obj.entry.id.toLowerCase() === renditionId); if (!rendition) { renditionId = 'imgpreview'; - rendition = supported.list.entries.find(obj => obj.entry.id.toLowerCase() === renditionId); + rendition = supported.list.entries.find((obj) => obj.entry.id.toLowerCase() === renditionId); } if (rendition) { diff --git a/lib/core/viewer/services/view-util.service.ts b/lib/core/viewer/services/view-util.service.ts index ade3aed13c..fd0eaedb10 100644 --- a/lib/core/viewer/services/view-util.service.ts +++ b/lib/core/viewer/services/view-util.service.ts @@ -93,14 +93,14 @@ export class ViewUtilService { const type: string = this.getViewerTypeByMimeType(mimeType); this.getRendition(nodeId, ViewUtilService.ContentGroup.PDF) - .then(value => { + .then((value) => { const url: string = this.getRenditionUrl(nodeId, type, (value ? true : false)); const printType = (type === ViewUtilService.ContentGroup.PDF || type === ViewUtilService.ContentGroup.TEXT) ? ViewUtilService.ContentGroup.PDF : type; this.printFile(url, printType); }) - .catch(err => { + .catch((err) => { this.logService.error('Error with Printing'); this.logService.error(err); }); @@ -143,12 +143,12 @@ export class ViewUtilService { } wait(ms: number): Promise { - return new Promise(resolve => setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } async getRendition(nodeId: string, renditionId: string): Promise { const supported = await this.apiService.renditionsApi.getRenditions(nodeId); - let rendition = supported.list.entries.find(obj => obj.entry.id.toLowerCase() === renditionId); + let rendition = supported.list.entries.find((obj) => obj.entry.id.toLowerCase() === renditionId); if (rendition) { const status = rendition.entry.status.toString(); @@ -162,7 +162,7 @@ export class ViewUtilService { } } } - return new Promise(resolve => resolve(rendition)); + return new Promise((resolve) => resolve(rendition)); } } diff --git a/lib/extensions/src/lib/config/extension-utils.ts b/lib/extensions/src/lib/config/extension-utils.ts index 511e61e7b1..2fa36e886b 100644 --- a/lib/extensions/src/lib/config/extension-utils.ts +++ b/lib/extensions/src/lib/config/extension-utils.ts @@ -105,8 +105,8 @@ export function reduceEmptyMenus( export function mergeObjects(...objects): any { const result = {}; - objects.forEach(source => { - Object.keys(source).forEach(prop => { + objects.forEach((source) => { + Object.keys(source).forEach((prop) => { if (!prop.startsWith('$')) { if (prop in result && Array.isArray(result[prop])) { // result[prop] = result[prop].concat(source[prop]); @@ -127,7 +127,7 @@ export function mergeArrays(left: any[], right: any[]): any[] { const result = []; const map = {}; - (left || []).forEach(entry => { + (left || []).forEach((entry) => { const element = entry; if (element && element.hasOwnProperty('id')) { map[element.id] = element; @@ -136,7 +136,7 @@ export function mergeArrays(left: any[], right: any[]): any[] { } }); - (right || []).forEach(entry => { + (right || []).forEach((entry) => { const element = entry; if (element && element.hasOwnProperty('id') && map[element.id]) { const merged = mergeObjects(map[element.id], element); diff --git a/lib/extensions/src/lib/evaluators/core.evaluators.ts b/lib/extensions/src/lib/evaluators/core.evaluators.ts index b6ce7748aa..d481cdee81 100644 --- a/lib/extensions/src/lib/evaluators/core.evaluators.ts +++ b/lib/extensions/src/lib/evaluators/core.evaluators.ts @@ -23,7 +23,7 @@ export function not(context: RuleContext, ...args: RuleParameter[]): boolean { } return args - .every(arg => { + .every((arg) => { const evaluator = context.getEvaluator(arg.value); if (!evaluator) { console.warn('evaluator not found: ' + arg.value); @@ -39,7 +39,7 @@ export function every(context: RuleContext, ...args: RuleParameter[]): boolean { } return args - .every(arg => { + .every((arg) => { const evaluator = context.getEvaluator(arg.value); if (!evaluator) { console.warn('evaluator not found: ' + arg.value); @@ -55,7 +55,7 @@ export function some(context: RuleContext, ...args: RuleParameter[]): boolean { } return args - .some(arg => { + .some((arg) => { const evaluator = context.getEvaluator(arg.value); if (!evaluator) { console.warn('evaluator not found: ' + arg.value); diff --git a/lib/extensions/src/lib/services/extension-loader.service.ts b/lib/extensions/src/lib/services/extension-loader.service.ts index 140e829763..be4fc57191 100644 --- a/lib/extensions/src/lib/services/extension-loader.service.ts +++ b/lib/extensions/src/lib/services/extension-loader.service.ts @@ -28,11 +28,12 @@ import { RuleRef } from '../config/rule.extensions'; providedIn: 'root' }) export class ExtensionLoaderService { - constructor(private http: HttpClient) {} + constructor(private http: HttpClient) { + } load(configPath: string, pluginsPath: string): Promise { - return new Promise(resolve => { - this.loadConfig(configPath, 0).then(result => { + return new Promise((resolve) => { + this.loadConfig(configPath, 0).then((result) => { let config = result.config; const override = sessionStorage.getItem('app.extension.config'); @@ -45,11 +46,11 @@ export class ExtensionLoaderService { this.loadConfig(`${pluginsPath}/${name}`, idx) ); - Promise.all(plugins).then(results => { + Promise.all(plugins).then((results) => { const configs = results - .filter(entry => entry) + .filter((entry) => entry) .sort(sortByOrder) - .map(entry => entry.config); + .map((entry) => entry.config); if (configs.length > 0) { config = mergeObjects(config, ...configs); @@ -58,7 +59,7 @@ export class ExtensionLoaderService { config = { ...config, ...this.getMetadata(result.config), - $references: configs.map(ext => this.getMetadata(ext)) + $references: configs.map((ext) => this.getMetadata(ext)) }; resolve(config); @@ -75,8 +76,8 @@ export class ExtensionLoaderService { Object .keys(config) - .filter(key => key.startsWith('$')) - .forEach(key => { + .filter((key) => key.startsWith('$')) + .forEach((key) => { result[key] = config[key]; }); @@ -87,15 +88,15 @@ export class ExtensionLoaderService { url: string, order: number ): Promise<{ order: number; config: ExtensionConfig }> { - return new Promise(resolve => { + return new Promise((resolve) => { this.http.get(url).subscribe( - config => { + (config) => { resolve({ order, config }); }, - error => { + () => { resolve(null); } ); diff --git a/lib/extensions/src/lib/services/extension.service.spec.ts b/lib/extensions/src/lib/services/extension.service.spec.ts index 2036d0fa29..7ef7b8da8c 100644 --- a/lib/extensions/src/lib/services/extension.service.spec.ts +++ b/lib/extensions/src/lib/services/extension.service.spec.ts @@ -65,7 +65,7 @@ describe('ExtensionService', () => { service.setup(blankConfig); const evaluators = ['core.every', 'core.some', 'core.not']; - evaluators.forEach(key => { + evaluators.forEach((key) => { expect(service.getEvaluator(key)).toBeDefined(`Evaluator ${key} is missing`); }); }); diff --git a/lib/extensions/src/lib/services/extension.service.ts b/lib/extensions/src/lib/services/extension.service.ts index 818ec272f6..9ddda90415 100644 --- a/lib/extensions/src/lib/services/extension.service.ts +++ b/lib/extensions/src/lib/services/extension.service.ts @@ -85,17 +85,17 @@ export class ExtensionService { } getRouteById(id: string): RouteRef { - return this.routes.find(route => route.id === id); + return this.routes.find((route) => route.id === id); } getAuthGuards(ids: string[]): Array> { return (ids || []) - .map(id => this.authGuards[id]) - .filter(guard => guard); + .map((id) => this.authGuards[id]) + .filter((guard) => guard); } getActionById(id: string): ActionRef { - return this.actions.find(action => action.id === id); + return this.actions.find((action) => action.id === id); } getEvaluator(key: string): RuleEvaluator { @@ -130,7 +130,7 @@ export class ExtensionService { } getRuleById(id: string): RuleRef { - return this.rules.find(ref => ref.id === id); + return this.rules.find((ref) => ref.id === id); } runExpression(value: string, context?: any) { diff --git a/lib/insights/analytics-process/components/analytics-report-list.component.ts b/lib/insights/analytics-process/components/analytics-report-list.component.ts index 8f0c1787d0..0e2ac82a09 100644 --- a/lib/insights/analytics-process/components/analytics-report-list.component.ts +++ b/lib/insights/analytics-process/components/analytics-report-list.component.ts @@ -59,7 +59,7 @@ export class AnalyticsReportListComponent implements OnInit { reports: ReportParametersModel[] = []; constructor(private analyticsService: AnalyticsService) { - this.report$ = new Observable(observer => this.reportObserver = observer) + this.report$ = new Observable((observer) => this.reportObserver = observer) .pipe(share()); } @@ -154,7 +154,7 @@ export class AnalyticsReportListComponent implements OnInit { } public selectReportByReportId(reportId) { - let reportFound = this.reports.find(report => report.id === reportId); + let reportFound = this.reports.find((report) => report.id === reportId); if (reportFound) { this.currentReport = reportFound; this.reportClick.emit(reportFound); diff --git a/lib/insights/analytics-process/components/analytics-report-parameters.component.ts b/lib/insights/analytics-process/components/analytics-report-parameters.component.ts index c08a5373d5..7cf9fbd212 100644 --- a/lib/insights/analytics-process/components/analytics-report-parameters.component.ts +++ b/lib/insights/analytics-process/components/analytics-report-parameters.component.ts @@ -112,7 +112,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On ngOnInit() { this.dropDownSub = this.onDropdownChanged.subscribe((field) => { - let paramDependOn: ReportParameterDetailsModel = this.reportParameters.definition.parameters.find(p => p.dependsOn === field.id); + let paramDependOn: ReportParameterDetailsModel = this.reportParameters.definition.parameters.find((p) => p.dependsOn === field.id); if (paramDependOn) { this.retrieveParameterOptions(this.reportParameters.definition.parameters, this.appId, this.reportId, field.value); } @@ -191,8 +191,8 @@ 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.valueChanges.subscribe((data) => this.onValueChanged(data)); + this.reportForm.statusChanges.subscribe((data) => this.onStatusChanged(data)); } public getReportParams(reportId: string) { @@ -368,7 +368,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On deleteReport(reportId: string) { this.analyticsService.deleteReport(reportId).subscribe(() => { this.deleteReportSuccess.emit(reportId); - }, error => this.logService.error(error)); + }, (error) => this.logService.error(error)); } ngAfterContentChecked() { diff --git a/lib/insights/analytics-process/services/analytics.service.ts b/lib/insights/analytics-process/services/analytics.service.ts index 4dac87c5cf..3b3e57e090 100644 --- a/lib/insights/analytics-process/services/analytics.service.ts +++ b/lib/insights/analytics-process/services/analytics.service.ts @@ -53,7 +53,7 @@ export class AnalyticsService { }); return reports; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -65,9 +65,9 @@ export class AnalyticsService { return from(this.apiService.getInstance().activiti.reportApi.getReportList()) .pipe( map((response: any) => { - return response.find(report => report.name === reportName); + return response.find((report) => report.name === reportName); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -85,7 +85,7 @@ export class AnalyticsService { map((res: any) => { return new ReportParametersModel(res); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -103,7 +103,7 @@ export class AnalyticsService { } else if (type === 'task' && reportId && processDefinitionId) { return this.getTasksByProcessDefinitionId(reportId, processDefinitionId); } else { - return new Observable(observer => { + return new Observable((observer) => { observer.next(null); observer.complete(); }); @@ -117,7 +117,7 @@ export class AnalyticsService { paramOptions.push(new ParameterValueModel({ id: 'Active', name: 'Active' })); paramOptions.push(new ParameterValueModel({ id: 'Complete', name: 'Complete' })); - return new Observable(observer => { + return new Observable((observer) => { observer.next(paramOptions); observer.complete(); }); @@ -132,7 +132,7 @@ export class AnalyticsService { paramOptions.push(new ParameterValueModel({ id: 'byMonth', name: 'By month' })); paramOptions.push(new ParameterValueModel({ id: 'byYear', name: 'By year' })); - return new Observable(observer => { + return new Observable((observer) => { observer.next(paramOptions); observer.complete(); }); @@ -145,7 +145,7 @@ export class AnalyticsService { paramOptions.push(new ParameterValueModel({ id: 'totalTime', name: 'Total time spent in a process step' })); paramOptions.push(new ParameterValueModel({ id: 'avgTime', name: 'Average time spent in a process step' })); - return new Observable(observer => { + return new Observable((observer) => { observer.next(paramOptions); observer.complete(); }); @@ -161,7 +161,7 @@ export class AnalyticsService { }); return paramOptions; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -176,7 +176,7 @@ export class AnalyticsService { }); return paramOptions; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -190,7 +190,7 @@ export class AnalyticsService { }); return paramOptions; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -217,7 +217,7 @@ export class AnalyticsService { return elements; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -225,7 +225,7 @@ export class AnalyticsService { return from(this.apiService.getInstance().activiti.reportApi.createDefaultReports()) .pipe( map(this.toJson), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -233,7 +233,7 @@ export class AnalyticsService { return from(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name)) .pipe( map(() => this.logService.info('upload')), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -244,7 +244,7 @@ export class AnalyticsService { this.logService.info('export'); return res; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -254,7 +254,7 @@ export class AnalyticsService { map(() => { this.logService.info('save'); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -264,7 +264,7 @@ export class AnalyticsService { map(() => { this.logService.info('delete'); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/insights/diagram/components/raphael/raphael-multiline-text.component.ts b/lib/insights/diagram/components/raphael/raphael-multiline-text.component.ts index a604fa8920..a938a5ffdc 100644 --- a/lib/insights/diagram/components/raphael/raphael-multiline-text.component.ts +++ b/lib/insights/diagram/components/raphael/raphael-multiline-text.component.ts @@ -78,9 +78,9 @@ export class RaphaelMultilineTextDirective extends RaphaelBase implements OnInit let letterWidth = textPaper.getBBox().width / text.length; let removedLineBreaks = text.split('\n'); let actualRowLength = 0, formattedText = []; - removedLineBreaks.forEach(sentence => { + removedLineBreaks.forEach((sentence) => { let words = sentence.split(' '); - words.forEach(word => { + words.forEach((word) => { let length = word.length; if (actualRowLength + (length * letterWidth) > elementWidth) { formattedText.push('\n'); diff --git a/lib/insights/diagram/services/diagrams.service.ts b/lib/insights/diagram/services/diagrams.service.ts index e04f51dab6..9fa5e9e2e8 100644 --- a/lib/insights/diagram/services/diagrams.service.ts +++ b/lib/insights/diagram/services/diagrams.service.ts @@ -30,14 +30,14 @@ export class DiagramsService { getProcessDefinitionModel(processDefinitionId: string): Observable { return from(this.apiService.getInstance().activiti.modelJsonBpmnApi.getModelJSON(processDefinitionId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } getRunningProcessDefinitionModel(processInstanceId: string): Observable { return from(this.apiService.getInstance().activiti.modelJsonBpmnApi.getModelJSONForProcessDefinition(processInstanceId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.spec.ts index b70b1b9cff..e2a78bf9b5 100644 --- a/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.spec.ts @@ -62,8 +62,8 @@ describe('AppsProcessCloudService', () => { spyOn(service, 'getDeployedApplicationsByStatus').and.returnValue(throwError(errorResponse)); service.getDeployedApplicationsByStatus('fake') .subscribe( - users => fail('expected an error, not applications'), - error => { + (users) => fail('expected an error, not applications'), + (error) => { expect(error.status).toEqual(404); expect(error.statusText).toEqual('Not Found'); expect(error.error).toEqual('Mock Error'); diff --git a/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.ts b/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.ts index 57e17cb76d..b919f6af77 100644 --- a/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/app-list-cloud/services/apps-process-cloud.service.ts @@ -58,7 +58,7 @@ export class AppsProcessCloudService { }); } ), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/process-services-cloud/src/lib/task-cloud/services/task-filter-cloud.service.ts b/lib/process-services-cloud/src/lib/task-cloud/services/task-filter-cloud.service.ts index 1eff2b6d43..dabbff6a48 100644 --- a/lib/process-services-cloud/src/lib/task-cloud/services/task-filter-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task-cloud/services/task-filter-cloud.service.ts @@ -45,7 +45,7 @@ export class TaskFilterCloudService { let completedTasksFilter = this.getCompletedTasksFilterInstance(appName); let completeObservable = this.addFilter(completedTasksFilter); - return new Observable(observer => { + return new Observable((observer) => { forkJoin( involvedObservable, myTaskObservable, diff --git a/lib/process-services-cloud/src/lib/task-list-cloud/components/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task-list-cloud/components/task-list-cloud.component.spec.ts index a3416b8dba..dc40f9f5fa 100644 --- a/lib/process-services-cloud/src/lib/task-list-cloud/components/task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task-list-cloud/components/task-list-cloud.component.spec.ts @@ -199,7 +199,7 @@ describe('TaskListCloudComponent', () => { } }); let rowEvent = new DataRowEvent(row, null); - component.rowClick.subscribe(taskId => { + component.rowClick.subscribe((taskId) => { expect(taskId).toEqual('999'); expect(component.getCurrentId()).toEqual('999'); done(); diff --git a/lib/process-services/app-list/apps-list.component.ts b/lib/process-services/app-list/apps-list.component.ts index 90c98b07ac..d900abbd9d 100644 --- a/lib/process-services/app-list/apps-list.component.ts +++ b/lib/process-services/app-list/apps-list.component.ts @@ -74,7 +74,7 @@ export class AppsListComponent implements OnInit, AfterContentInit { constructor( private appsProcessService: AppsProcessService, private translationService: TranslationService) { - this.apps$ = new Observable(observer => this.appsObserver = observer) + this.apps$ = new Observable((observer) => this.appsObserver = observer) .pipe(share()); } diff --git a/lib/process-services/app-list/select-apps-dialog-component.spec.ts b/lib/process-services/app-list/select-apps-dialog-component.spec.ts index 6b847a5ffa..a010aec3d6 100644 --- a/lib/process-services/app-list/select-apps-dialog-component.spec.ts +++ b/lib/process-services/app-list/select-apps-dialog-component.spec.ts @@ -43,7 +43,7 @@ export class DialogSelectAppTestComponent { width: '630px' }); - this.dialogRef.afterClosed().subscribe(selectedProcess => { + this.dialogRef.afterClosed().subscribe((selectedProcess) => { this.processId = selectedProcess.id; }); } diff --git a/lib/process-services/attachment/create-process-attachment.component.ts b/lib/process-services/attachment/create-process-attachment.component.ts index c06bbb4b69..c065e53465 100644 --- a/lib/process-services/attachment/create-process-attachment.component.ts +++ b/lib/process-services/attachment/create-process-attachment.component.ts @@ -51,7 +51,7 @@ export class CreateProcessAttachmentComponent implements OnChanges { } onFileUpload(event: any) { - let filesList: File[] = event.detail.files.map(obj => obj.file); + let filesList: File[] = event.detail.files.map((obj) => obj.file); for (let fileInfoObj of filesList) { let file: File = fileInfoObj; diff --git a/lib/process-services/attachment/create-task-attachment.component.ts b/lib/process-services/attachment/create-task-attachment.component.ts index 037136c9d5..b4fcce5dcb 100644 --- a/lib/process-services/attachment/create-task-attachment.component.ts +++ b/lib/process-services/attachment/create-task-attachment.component.ts @@ -51,7 +51,7 @@ export class AttachmentComponent implements OnChanges { } onFileUpload(event: any) { - let filesList: File[] = event.detail.files.map(obj => obj.file); + let filesList: File[] = event.detail.files.map((obj) => obj.file); for (let fileInfoObj of filesList) { let file: File = fileInfoObj; diff --git a/lib/process-services/attachment/process-attachment-list.component.ts b/lib/process-services/attachment/process-attachment-list.component.ts index a4894f81c8..577a070d5e 100644 --- a/lib/process-services/attachment/process-attachment-list.component.ts +++ b/lib/process-services/attachment/process-attachment-list.component.ts @@ -113,7 +113,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn this.isLoading = true; this.activitiContentService.getProcessRelatedContent(processInstanceId).subscribe( (res: any) => { - res.data.forEach(content => { + res.data.forEach((content) => { this.attachments.push({ id: content.id, name: content.name, @@ -136,7 +136,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn if (contentId) { this.activitiContentService.deleteRelatedContent(contentId).subscribe( (res: any) => { - this.attachments = this.attachments.filter(content => { + this.attachments = this.attachments.filter((content) => { return content.id !== contentId; }); }, diff --git a/lib/process-services/attachment/task-attachment-list.component.ts b/lib/process-services/attachment/task-attachment-list.component.ts index ee6ac135da..1da5d84868 100644 --- a/lib/process-services/attachment/task-attachment-list.component.ts +++ b/lib/process-services/attachment/task-attachment-list.component.ts @@ -111,7 +111,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit this.activitiContentService.getTaskRelatedContent(taskId).subscribe( (res: any) => { let attachList = []; - res.data.forEach(content => { + res.data.forEach((content) => { attachList.push({ id: content.id, name: content.name, @@ -135,7 +135,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit if (contentId) { this.activitiContentService.deleteRelatedContent(contentId).subscribe( (res: any) => { - this.attachments = this.attachments.filter(content => { + this.attachments = this.attachments.filter((content) => { return content.id !== contentId; }); }, diff --git a/lib/process-services/content-widget/attach-file-widget.component.ts b/lib/process-services/content-widget/attach-file-widget.component.ts index 2539ff30fd..21b367258f 100644 --- a/lib/process-services/content-widget/attach-file-widget.component.ts +++ b/lib/process-services/content-widget/attach-file-widget.component.ts @@ -205,7 +205,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements private uploadFileFromCS(fileNodeList: any[], accountId: string, siteId?: string) { const filesSaved = []; from(fileNodeList).pipe( - mergeMap(node => + mergeMap((node) => zip( of(node.content.mimeType), this.activitiContentService.applyAlfrescoNode(node, siteId, accountId), diff --git a/lib/process-services/people/components/people-list/people-list.component.spec.ts b/lib/process-services/people/components/people-list/people-list.component.spec.ts index 21c0b0b10e..ff9819f3bd 100644 --- a/lib/process-services/people/components/people-list/people-list.component.spec.ts +++ b/lib/process-services/people/components/people-list/people-list.component.spec.ts @@ -48,7 +48,7 @@ describe('PeopleListComponent', () => { let row = new ObjectDataRow(fakeUser); let rowEvent = new DataRowEvent(row, null); - peopleListComponent.clickRow.subscribe(selectedUser => { + peopleListComponent.clickRow.subscribe((selectedUser) => { expect(selectedUser.id).toEqual(1); expect(selectedUser.email).toEqual('fake@mail.com'); expect(peopleListComponent.user.id).toEqual(1); diff --git a/lib/process-services/people/components/people-search/people-search.component.ts b/lib/process-services/people/components/people-search/people-search.component.ts index 8ac6fd411b..1768050e64 100644 --- a/lib/process-services/people/components/people-search/people-search.component.ts +++ b/lib/process-services/people/components/people-search/people-search.component.ts @@ -59,7 +59,7 @@ export class PeopleSearchComponent implements OnInit { this.filteredResults$ = this.results .pipe( map((users) => { - return users.filter(user => user.id !== this.selectedUser.id); + return users.filter((user) => user.id !== this.selectedUser.id); }) ); this.performSearch = this.performSearchCallback.bind(this); diff --git a/lib/process-services/people/components/people/people.component.ts b/lib/process-services/people/components/people/people.component.ts index 4b92f8cd7d..814ec42056 100644 --- a/lib/process-services/people/components/people/people.component.ts +++ b/lib/process-services/people/components/people/people.component.ts @@ -51,7 +51,7 @@ export class PeopleComponent implements OnInit, AfterViewInit { peopleSearch$: Observable; constructor(private logService: LogService, public peopleProcessService: PeopleProcessService) { - this.peopleSearch$ = new Observable(observer => this.peopleSearchObserver = observer) + this.peopleSearch$ = new Observable((observer) => this.peopleSearchObserver = observer) .pipe( share() ); @@ -79,14 +79,14 @@ export class PeopleComponent implements OnInit, AfterViewInit { this.peopleProcessService.getWorkflowUsers(this.taskId, searchedWord) .subscribe((users) => { this.peopleSearchObserver.next(users); - }, error => this.logService.error(error)); + }, (error) => this.logService.error(error)); } involveUser(user: UserProcessModel) { this.peopleProcessService.involveUserWithTask(this.taskId, user.id.toString()) .subscribe(() => { this.people = [...this.people, user]; - }, error => this.logService.error('Impossible to involve user with task')); + }, (error) => this.logService.error('Impossible to involve user with task')); } removeInvolvedUser(user: UserProcessModel) { @@ -95,7 +95,7 @@ export class PeopleComponent implements OnInit, AfterViewInit { this.people = this.people.filter((involvedUser) => { return involvedUser.id !== user.id; }); - }, error => this.logService.error('Impossible to remove involved user from task')); + }, (error) => this.logService.error('Impossible to remove involved user from task')); } getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string { diff --git a/lib/process-services/process-comments/process-comments.component.ts b/lib/process-services/process-comments/process-comments.component.ts index 00bb17ed6b..1632a7ab6d 100644 --- a/lib/process-services/process-comments/process-comments.component.ts +++ b/lib/process-services/process-comments/process-comments.component.ts @@ -49,7 +49,7 @@ export class ProcessCommentsComponent implements OnChanges { beingAdded: boolean = false; constructor(private commentProcessService: CommentProcessService) { - this.comment$ = new Observable(observer => this.commentObserver = observer) + this.comment$ = new Observable((observer) => this.commentObserver = observer) .pipe(share()); this.comment$.subscribe((comment: CommentModel) => { this.comments.push(comment); diff --git a/lib/process-services/process-list/components/process-filters.component.ts b/lib/process-services/process-list/components/process-filters.component.ts index 0f9a755984..6a32fe94c4 100644 --- a/lib/process-services/process-list/components/process-filters.component.ts +++ b/lib/process-services/process-list/components/process-filters.component.ts @@ -132,7 +132,7 @@ export class ProcessFiltersComponent implements OnInit, OnChanges { */ getFiltersByAppName(appName: string) { this.appsProcessService.getDeployedApplicationsByName(appName).subscribe( - application => { + (application) => { this.getFiltersByAppId(application.id); this.selectProcessFilter(this.filterParam); }, diff --git a/lib/process-services/process-list/components/process-instance-tasks.component.ts b/lib/process-services/process-list/components/process-instance-tasks.component.ts index cf7ec41ede..561a962181 100644 --- a/lib/process-services/process-list/components/process-instance-tasks.component.ts +++ b/lib/process-services/process-list/components/process-instance-tasks.component.ts @@ -71,9 +71,9 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges { constructor(private activitiProcess: ProcessService, private logService: LogService, private dialog: MatDialog) { - this.task$ = new Observable(observer => this.taskObserver = observer) + this.task$ = new Observable((observer) => this.taskObserver = observer) .pipe(share()); - this.completedTask$ = new Observable(observer => this.completedTaskObserver = observer) + this.completedTask$ = new Observable((observer) => this.completedTaskObserver = observer) .pipe(share()); } diff --git a/lib/process-services/process-list/components/process-list.component.spec.ts b/lib/process-services/process-list/components/process-list.component.spec.ts index 161db14be1..5d1a8c90f3 100644 --- a/lib/process-services/process-list/components/process-list.component.spec.ts +++ b/lib/process-services/process-list/components/process-list.component.spec.ts @@ -232,7 +232,7 @@ describe('ProcessInstanceListComponent', () => { }); let rowEvent = new DataRowEvent(row, null); - component.rowClick.subscribe(taskId => { + component.rowClick.subscribe((taskId) => { expect(taskId).toEqual('999'); expect(component.getCurrentId()).toEqual('999'); done(); diff --git a/lib/process-services/process-list/components/process-list.component.ts b/lib/process-services/process-list/components/process-list.component.ts index bb3c020256..a54f99a595 100644 --- a/lib/process-services/process-list/components/process-list.component.ts +++ b/lib/process-services/process-list/components/process-list.component.ts @@ -224,7 +224,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On totalItems: response.total }); }, - error => { + (error) => { this.error.emit(error); this.isLoading = false; }); @@ -286,7 +286,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On * @param instances */ private optimizeProcessDetails(instances: any[]): any[] { - instances = instances.map(instance => { + instances = instances.map((instance) => { instance.name = this.getProcessNameOrDescription(instance, 'medium'); if (instance.started) { instance.started = moment(instance.started).format(this.FORMAT_DATE); diff --git a/lib/process-services/process-list/components/start-process.component.ts b/lib/process-services/process-list/components/start-process.component.ts index 2ecc16d325..49dc9bf509 100644 --- a/lib/process-services/process-list/components/start-process.component.ts +++ b/lib/process-services/process-list/components/start-process.component.ts @@ -115,10 +115,10 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit { this.loadStartProcess(); - this.processNameInput.valueChanges.subscribe(name => this.name = name); + this.processNameInput.valueChanges.subscribe((name) => this.name = name); this.filteredProcesses = this.processDefinitionInput.valueChanges .pipe( - map(value => this._filter(value)) + map((value) => this._filter(value)) ); } @@ -137,7 +137,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit { private _filter(value: string): ProcessDefinitionRepresentation[] { if (value !== null && value !== undefined) { const filterValue = value.toLowerCase(); - let filteredProcess = this.processDefinitions.filter(option => option.name.toLowerCase().includes(filterValue)); + let filteredProcess = this.processDefinitions.filter((option) => option.name.toLowerCase().includes(filterValue)); if (this.processFilterSelector) { this.selectedProcessDef = this.getSelectedProcess(filterValue); @@ -147,7 +147,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit { } getSelectedProcess(selectedProcess) { - let processSelected = this.processDefinitions.find(process => process.name.toLowerCase() === selectedProcess); + let processSelected = this.processDefinitions.find((process) => process.name.toLowerCase() === selectedProcess); if (!processSelected) { processSelected = new ProcessDefinitionRepresentation(); diff --git a/lib/process-services/process-list/services/process-filter.service.ts b/lib/process-services/process-list/services/process-filter.service.ts index 8b9f9e88a7..163ba273bd 100644 --- a/lib/process-services/process-list/services/process-filter.service.ts +++ b/lib/process-services/process-list/services/process-filter.service.ts @@ -45,7 +45,7 @@ export class ProcessFilterService { }); return filters; }), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -59,9 +59,9 @@ export class ProcessFilterService { return from(this.callApiProcessFilters(appId)) .pipe( map((response: any) => { - return response.data.find(filter => filter.id === filterId); + return response.data.find((filter) => filter.id === filterId); }), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -75,9 +75,9 @@ export class ProcessFilterService { return from(this.callApiProcessFilters(appId)) .pipe( map((response: any) => { - return response.data.find(filter => filter.name === filterName); + return response.data.find((filter) => filter.name === filterName); }), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -96,7 +96,7 @@ export class ProcessFilterService { let allFilter = this.getAllFilterInstance(appId); let allObservable = this.addProcessFilter(allFilter); - return new Observable(observer => { + return new Observable((observer) => { forkJoin( runningObservable, completedObservable, @@ -181,7 +181,7 @@ export class ProcessFilterService { map((response: FilterProcessRepresentationModel) => { return response; }), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } diff --git a/lib/process-services/process-list/services/process.service.ts b/lib/process-services/process-list/services/process.service.ts index 5c652349a8..392a8c2935 100644 --- a/lib/process-services/process-list/services/process.service.ts +++ b/lib/process-services/process-list/services/process.service.ts @@ -47,14 +47,14 @@ export class ProcessService { .pipe( map((res: any) => { if (processDefinitionKey) { - const filtered = res.data.filter(process => process.processDefinitionKey === processDefinitionKey); + const filtered = res.data.filter((process) => process.processDefinitionKey === processDefinitionKey); res.data = filtered; return res; } else { return res; } }), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -73,7 +73,7 @@ export class ProcessService { fetchProcessAuditPdfById(processId: string): Observable { return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessAuditPdf(processId)) .pipe( - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -85,7 +85,7 @@ export class ProcessService { fetchProcessAuditJsonById(processId: string): Observable { return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessAuditJson(processId)) .pipe( - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -97,7 +97,7 @@ export class ProcessService { getProcess(processInstanceId: string): Observable { return from(this.alfrescoApiService.getInstance().activiti.processApi.getProcessInstance(processInstanceId)) .pipe( - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -117,11 +117,11 @@ export class ProcessService { return from(this.alfrescoApiService.getInstance().activiti.taskApi.listTasks(taskOpts)) .pipe( map(this.extractData), - map(tasks => tasks.map((task: any) => { + map((tasks) => tasks.map((task: any) => { task.created = moment(task.created, 'YYYY-MM-DD').format(); return task; })), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -142,8 +142,8 @@ export class ProcessService { ) .pipe( map(this.extractData), - map(processDefs => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd))), - catchError(err => this.handleProcessError(err)) + map((processDefs) => processDefs.map((pd) => new ProcessDefinitionRepresentation(pd))), + catchError((err) => this.handleProcessError(err)) ); } @@ -175,7 +175,7 @@ export class ProcessService { ) .pipe( map((pd) => new ProcessInstance(pd)), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -189,7 +189,7 @@ export class ProcessService { this.alfrescoApiService.getInstance().activiti.processApi.deleteProcessInstance(processInstanceId) ) .pipe( - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -204,7 +204,7 @@ export class ProcessService { ) .pipe( map((processVars: any[]) => processVars.map((pd) => new ProcessInstanceVariable(pd))), - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -219,7 +219,7 @@ export class ProcessService { this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.createOrUpdateProcessInstanceVariables(processInstanceId, variables) ) .pipe( - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } @@ -234,7 +234,7 @@ export class ProcessService { this.alfrescoApiService.getInstance().activiti.processInstanceVariablesApi.deleteProcessInstanceVariable(processInstanceId, variableName) ) .pipe( - catchError(err => this.handleProcessError(err)) + catchError((err) => this.handleProcessError(err)) ); } diff --git a/lib/process-services/task-list/components/checklist.component.ts b/lib/process-services/task-list/components/checklist.component.ts index 2b6fe5e360..00139f8521 100644 --- a/lib/process-services/task-list/components/checklist.component.ts +++ b/lib/process-services/task-list/components/checklist.component.ts @@ -123,7 +123,7 @@ export class ChecklistComponent implements OnChanges { public delete(taskId: string) { this.activitiTaskList.deleteTask(taskId).subscribe( () => { - this.checklist = this.checklist.filter(check => check.id !== taskId); + this.checklist = this.checklist.filter((check) => check.id !== taskId); this.checklistTaskDeleted.emit(taskId); }, (error) => { diff --git a/lib/process-services/task-list/components/start-task.component.spec.ts b/lib/process-services/task-list/components/start-task.component.spec.ts index e4db077450..bb37a28c41 100644 --- a/lib/process-services/task-list/components/start-task.component.spec.ts +++ b/lib/process-services/task-list/components/start-task.component.spec.ts @@ -268,7 +268,7 @@ describe('StartTaskComponent', () => { let attachFormToATask = spyOn(service, 'attachFormToATask').and.returnValue(of()); spyOn(service, 'createNewTask').and.callFake( function() { - return new Observable(observer => { + return new Observable((observer) => { observer.next({ id: 'task-id'}); observer.complete(); }); diff --git a/lib/process-services/task-list/components/task-details.component.ts b/lib/process-services/task-list/components/task-details.component.ts index ae18a9b748..ac9c21a0b6 100644 --- a/lib/process-services/task-list/components/task-details.component.ts +++ b/lib/process-services/task-list/components/task-details.component.ts @@ -195,7 +195,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges { this.formRenderingService.setComponentTypeResolver('select-folder', () => AttachFolderWidgetComponent, true); this.formRenderingService.setComponentTypeResolver('upload', () => AttachFileWidgetComponent, true); - this.peopleSearch = new Observable(observer => this.peopleSearchObserver = observer) + this.peopleSearch = new Observable((observer) => this.peopleSearchObserver = observer) .pipe(share()); this.authService.getBpmLoggedUser().subscribe((user: UserRepresentation) => { this.currentLoggedUser = user; @@ -469,7 +469,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges { .subscribe((users) => { users = users.filter((user) => user.id !== this.taskDetails.assignee.id); this.peopleSearchObserver.next(users); - }, error => this.logService.error('Could not load users')); + }, (error) => this.logService.error('Could not load users')); } onCloseSearch() { diff --git a/lib/process-services/task-list/components/task-filters.component.ts b/lib/process-services/task-list/components/task-filters.component.ts index 5f4a220e90..540120c19f 100644 --- a/lib/process-services/task-list/components/task-filters.component.ts +++ b/lib/process-services/task-list/components/task-filters.component.ts @@ -130,7 +130,7 @@ export class TaskFiltersComponent implements OnInit, OnChanges { */ getFiltersByAppName(appName: string) { this.appsProcessService.getDeployedApplicationsByName(appName).subscribe( - application => { + (application) => { this.getFiltersByAppId(application.id); }, (err) => { diff --git a/lib/process-services/task-list/components/task-list.component.spec.ts b/lib/process-services/task-list/components/task-list.component.spec.ts index fda5266109..ba5c5ea9a7 100644 --- a/lib/process-services/task-list/components/task-list.component.spec.ts +++ b/lib/process-services/task-list/components/task-list.component.spec.ts @@ -322,7 +322,7 @@ describe('TaskListComponent', () => { }); let rowEvent = new DataRowEvent(row, null); - component.rowClick.subscribe(taskId => { + component.rowClick.subscribe((taskId) => { expect(taskId).toEqual('999'); expect(component.getCurrentId()).toEqual('999'); done(); diff --git a/lib/process-services/task-list/components/task-list.component.ts b/lib/process-services/task-list/components/task-list.component.ts index b59381c197..8393839c01 100644 --- a/lib/process-services/task-list/components/task-list.component.ts +++ b/lib/process-services/task-list/components/task-list.component.ts @@ -347,7 +347,7 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft * @param instances */ private optimizeTaskDetails(instances: any[]): any[] { - instances = instances.map(task => { + instances = instances.map((task) => { if (!task.name) { task.name = 'No name'; } diff --git a/lib/process-services/task-list/services/process-upload.service.ts b/lib/process-services/task-list/services/process-upload.service.ts index 51e2a83d45..7af25dcc58 100644 --- a/lib/process-services/task-list/services/process-upload.service.ts +++ b/lib/process-services/task-list/services/process-upload.service.ts @@ -35,7 +35,7 @@ export class ProcessUploadService extends UploadService { let processInstanceId = file.options.parentId; let promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnProcessInstance(processInstanceId, file.file, opts); - promise.catch(err => this.handleError(err)); + promise.catch((err) => this.handleError(err)); return promise; } diff --git a/lib/process-services/task-list/services/task-filter.service.ts b/lib/process-services/task-list/services/task-filter.service.ts index 535f2c2a24..4a91275226 100644 --- a/lib/process-services/task-list/services/task-filter.service.ts +++ b/lib/process-services/task-list/services/task-filter.service.ts @@ -48,7 +48,7 @@ export class TaskFilterService { let completedTasksFilter = this.getCompletedTasksFilterInstance(appId); let completeObservable = this.addFilter(completedTasksFilter); - return new Observable(observer => { + return new Observable((observer) => { forkJoin( involvedObservable, myTaskObservable, @@ -97,7 +97,7 @@ export class TaskFilterService { }); return filters; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -109,8 +109,8 @@ export class TaskFilterService { */ getTaskFilterById(filterId: number, appId?: number): Observable { return from(this.callApiTaskFilters(appId)).pipe( - map(response => response.data.find(filter => filter.id === filterId)), - catchError(err => this.handleError(err)) + map((response) => response.data.find((filter) => filter.id === filterId)), + catchError((err) => this.handleError(err)) ); } @@ -122,8 +122,8 @@ export class TaskFilterService { */ getTaskFilterByName(taskName: string, appId?: number): Observable { return from(this.callApiTaskFilters(appId)).pipe( - map(response => response.data.find(filter => filter.name === taskName)), - catchError(err => this.handleError(err)) + map((response) => response.data.find((filter) => filter.name === taskName)), + catchError((err) => this.handleError(err)) ); } @@ -138,7 +138,7 @@ export class TaskFilterService { map((response: FilterRepresentationModel) => { return response; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/process-services/task-list/services/task-upload.service.ts b/lib/process-services/task-list/services/task-upload.service.ts index 43fff250b2..8959cab599 100644 --- a/lib/process-services/task-list/services/task-upload.service.ts +++ b/lib/process-services/task-list/services/task-upload.service.ts @@ -35,7 +35,7 @@ export class TaskUploadService extends UploadService { let taskId = file.options.parentId; let promise = this.apiService.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts); - promise.catch(err => this.handleError(err)); + promise.catch((err) => this.handleError(err)); return promise; } diff --git a/lib/process-services/task-list/services/tasklist.service.spec.ts b/lib/process-services/task-list/services/tasklist.service.spec.ts index ce3643e47f..e5ee71117f 100644 --- a/lib/process-services/task-list/services/tasklist.service.spec.ts +++ b/lib/process-services/task-list/services/tasklist.service.spec.ts @@ -61,7 +61,7 @@ describe('Activiti TaskList Service', () => { describe('Content tests', () => { it('should return the task list filtered', (done) => { - service.getTasks( fakeFilter).subscribe(res => { + service.getTasks( fakeFilter).subscribe((res) => { expect(res).toBeDefined(); expect(res.size).toEqual(1); expect(res.start).toEqual(0); @@ -85,7 +85,7 @@ describe('Activiti TaskList Service', () => { spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); - service.findAllTaskByState( fakeFilter, 'open').subscribe(res => { + service.findAllTaskByState( fakeFilter, 'open').subscribe((res) => { expect(res).toBeDefined(); expect(res.size).toEqual(1); @@ -104,7 +104,7 @@ describe('Activiti TaskList Service', () => { spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); - service.findAllTaskByState( fakeFilter).subscribe(res => { + service.findAllTaskByState( fakeFilter).subscribe((res) => { expect(res).toBeDefined(); expect(res.size).toEqual(1); expect(res.start).toEqual(0); @@ -119,7 +119,7 @@ describe('Activiti TaskList Service', () => { }); it('should return the task list filtered by state', (done) => { - service.findTasksByState( fakeFilter, 'open').subscribe(res => { + service.findTasksByState( fakeFilter, 'open').subscribe((res) => { expect(res).toBeDefined(); expect(res.size).toEqual(1); expect(res.start).toEqual(0); @@ -140,7 +140,7 @@ describe('Activiti TaskList Service', () => { }); it('should return the task list filtered', (done) => { - service.findTasksByState( fakeFilter).subscribe(res => { + service.findTasksByState( fakeFilter).subscribe((res) => { expect(res.size).toEqual(1); expect(res.start).toEqual(0); expect(res.data).toBeDefined(); @@ -163,7 +163,7 @@ describe('Activiti TaskList Service', () => { spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); - service.findAllTasksWithoutState( fakeFilter).subscribe(res => { + service.findAllTasksWithoutState( fakeFilter).subscribe((res) => { expect(res).toBeDefined(); expect(res.data).toBeDefined(); expect(res.data.length).toEqual(2); @@ -183,7 +183,7 @@ describe('Activiti TaskList Service', () => { it('Should return both open and completed task', (done) => { spyOn(service, 'findTasksByState').and.returnValue(of(fakeOpenTaskList)); spyOn(service, 'findAllTaskByState').and.returnValue(of(fakeCompletedTaskList)); - service.findAllTasksWithoutState( fakeFilter).subscribe(res => { + service.findAllTasksWithoutState( fakeFilter).subscribe((res) => { expect(res).toBeDefined(); expect(res.data).toBeDefined(); expect(res.data.length).toEqual(4); @@ -200,7 +200,7 @@ describe('Activiti TaskList Service', () => { spyOn(service, 'getTasks').and.returnValue(of(fakeTaskList)); spyOn(service, 'getTotalTasks').and.returnValue(of(fakeTaskList)); - service.findAllTasksWithoutState( fakeFilter).subscribe(res => { + service.findAllTasksWithoutState( fakeFilter).subscribe((res) => { expect(res).toBeDefined(); expect(res.data).toBeDefined(); expect(res.data.length).toEqual(2); diff --git a/lib/process-services/task-list/services/tasklist.service.ts b/lib/process-services/task-list/services/tasklist.service.ts index 4f2783ef24..69578e8be4 100644 --- a/lib/process-services/task-list/services/tasklist.service.ts +++ b/lib/process-services/task-list/services/tasklist.service.ts @@ -73,9 +73,9 @@ export class TaskListService { return from(this.callApiTasksFiltered(requestNodeForFilter)) .pipe( map((res: any) => { - return res.data.find(element => element.id === taskId) ? filterModel : null; + return res.data.find((element) => element.id === taskId) ? filterModel : null; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -87,7 +87,7 @@ export class TaskListService { getTasks(requestNode: TaskQueryRequestRepresentationModel): Observable { return from(this.callApiTasksFiltered(requestNode)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -153,7 +153,7 @@ export class TaskListService { map((details: any) => { return new TaskDetailsModel(details); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -172,7 +172,7 @@ export class TaskListService { }); return checklists; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -196,7 +196,7 @@ export class TaskListService { }); return forms; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -209,7 +209,7 @@ export class TaskListService { attachFormToATask(taskId: string, formId: number): Observable { return from(this.apiService.taskApi.attachForm(taskId, { 'formId': formId })) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -224,7 +224,7 @@ export class TaskListService { map((response: TaskDetailsModel) => { return new TaskDetailsModel(response); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -236,7 +236,7 @@ export class TaskListService { deleteTask(taskId: string): Observable { return from(this.callApiDeleteTask(taskId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -248,7 +248,7 @@ export class TaskListService { deleteForm(taskId: string): Observable { return from(this.callApiDeleteForm(taskId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -260,7 +260,7 @@ export class TaskListService { completeTask(taskId: string) { return from(this.apiService.taskApi.completeTask(taskId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -276,7 +276,7 @@ export class TaskListService { map((res: any) => { return res; }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -291,7 +291,7 @@ export class TaskListService { map((response: TaskDetailsModel) => { return new TaskDetailsModel(response); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -308,7 +308,7 @@ export class TaskListService { map((response: TaskDetailsModel) => { return new TaskDetailsModel(response); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -325,7 +325,7 @@ export class TaskListService { map((response: TaskDetailsModel) => { return new TaskDetailsModel(response); }), - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -337,7 +337,7 @@ export class TaskListService { claimTask(taskId: string): Observable { return from(this.apiService.taskApi.claimTask(taskId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -349,7 +349,7 @@ export class TaskListService { unclaimTask(taskId: string): Observable { return from(this.apiService.taskApi.unclaimTask(taskId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } @@ -362,8 +362,8 @@ export class TaskListService { updateTask(taskId: any, updated): Observable { return from(this.apiService.taskApi.updateTask(taskId, updated)) .pipe( - map(result => result), - catchError(err => this.handleError(err)) + map((result) => result), + catchError((err) => this.handleError(err)) ); } @@ -375,8 +375,8 @@ export class TaskListService { fetchTaskAuditPdfById(taskId: string): Observable { return from(this.apiService.taskApi.getTaskAuditPdf(taskId)) .pipe( - map(data => data), - catchError(err => this.handleError(err)) + map((data) => data), + catchError((err) => this.handleError(err)) ); } @@ -388,7 +388,7 @@ export class TaskListService { fetchTaskAuditJsonById(taskId: string): Observable { return from(this.apiService.taskApi.getTaskAuditJson(taskId)) .pipe( - catchError(err => this.handleError(err)) + catchError((err) => this.handleError(err)) ); } diff --git a/lib/tslint.json b/lib/tslint.json index 31386e5535..f13e90c893 100644 --- a/lib/tslint.json +++ b/lib/tslint.json @@ -162,6 +162,7 @@ "format": "PascalCase" } ], + "arrow-parens": true, "ordered-imports": false, "use-input-property-decorator": true, "use-output-property-decorator": true,