mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
tslint arrow-parens rule (#4003)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('Breadcrumb', () => {
|
||||
|
||||
it('should emit navigation event', (done) => {
|
||||
let node = <PathElementEntity> { id: '-id-', name: 'name' };
|
||||
component.navigate.subscribe(val => {
|
||||
component.navigate.subscribe((val) => {
|
||||
expect(val).toBe(node);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+2
-2
@@ -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 = (<string[]> aspectProperties)
|
||||
.map((propertyName) => getProperty(propertyGroups, aspectName, propertyName))
|
||||
.filter(props => props !== undefined);
|
||||
.filter((props) => props !== undefined);
|
||||
}
|
||||
|
||||
newGroup = [ { title: group.title, properties } ];
|
||||
|
||||
@@ -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])
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,8 +30,8 @@ export class PropertyDescriptorsService {
|
||||
|
||||
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
||||
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)
|
||||
|
||||
+2
-2
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -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']);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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}'`;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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('<obj>');
|
||||
done();
|
||||
});
|
||||
|
||||
+7
-7
@@ -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);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<PaginationModel> {
|
||||
@@ -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 => <DataColumn> c);
|
||||
schema = this.columnList.columns.map((c) => <DataColumn> 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> 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<ShareDataRow> }) {
|
||||
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<ShareDataRow> }) {
|
||||
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 = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -50,7 +50,7 @@ export class CustomResourcesService {
|
||||
* @returns List of nodes for the recently used files
|
||||
*/
|
||||
getRecentFiles(personId: string, pagination: PaginationModel): Observable<NodePaging> {
|
||||
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([]);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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<MinimalNodeEntity> {
|
||||
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<NodePaging> {
|
||||
return from(this.getNodesPromise(folder, opts, includeFields))
|
||||
.pipe(
|
||||
catchError(err => this.handleError(err))
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((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<any>(observer => {
|
||||
return new Observable<any>((observer) => {
|
||||
observer.next();
|
||||
observer.complete();
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ describe('FolderCreateDirective', () => {
|
||||
node = { entry: { id: 'nodeId' } };
|
||||
|
||||
dialogRefMock = {
|
||||
afterClosed: val => of(val),
|
||||
afterClosed: (val) => of(val),
|
||||
componentInstance: {
|
||||
error: new Subject<any>(),
|
||||
success: new Subject<MinimalNodeEntryEntity>()
|
||||
|
||||
@@ -71,7 +71,7 @@ describe('FolderEditDirective', () => {
|
||||
node = { entry: { id: 'folderId' } };
|
||||
|
||||
dialogRefMock = {
|
||||
afterClosed: val => of(val),
|
||||
afterClosed: (val) => of(val),
|
||||
componentInstance: {
|
||||
error: new Subject<any>(),
|
||||
success: new Subject<MinimalNodeEntryEntity>()
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -84,10 +84,10 @@ export class NodePermissionDialogService {
|
||||
updateNodePermissionByDialog(nodeId?: string, title?: string): Observable<MinimalNodeEntryEntity> {
|
||||
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);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -78,7 +78,7 @@ export class NodePermissionService {
|
||||
*/
|
||||
updateNodePermissions(nodeId: string, permissionList: MinimalNodeEntity[]): Observable<MinimalNodeEntryEntity> {
|
||||
return this.nodeService.getNode(nodeId).pipe(
|
||||
switchMap(node => {
|
||||
switchMap((node) => {
|
||||
return this.getNodeRoles(node).pipe(
|
||||
switchMap((nodeRoles) => of({node, nodeRoles}) )
|
||||
);
|
||||
|
||||
+3
-3
@@ -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} `);
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ export class ResponseFacetQueryList extends SearchFilterList<FacetQuery> {
|
||||
constructor(items: FacetQuery[] = [], translationService, pageSize: number = 5) {
|
||||
super(
|
||||
items
|
||||
.filter(item => {
|
||||
.filter((item) => {
|
||||
return item.count > 0;
|
||||
}),
|
||||
pageSize
|
||||
|
||||
@@ -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 <FacetFieldBucket> {
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -69,7 +69,7 @@ export class SearchQueryBuilderService {
|
||||
const template = this.appConfig.get<SearchConfiguration>('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 <FacetQuery> { ...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 => <RequestFacetField> {
|
||||
facets: facetFields.map((facet) => <RequestFacetField> {
|
||||
field: facet.field,
|
||||
mincount: facet.mincount,
|
||||
label: facet.label,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<TagPaging> {
|
||||
return from(this.apiService.getInstance().core.tagsApi.getTags(opts))
|
||||
.pipe(catchError(err => this.handleError(err)));
|
||||
.pipe(catchError((err) => this.handleError(err)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export class TreeViewDataSource {
|
||||
}
|
||||
|
||||
connect(collectionViewer: CollectionViewer): Observable<TreeBaseNode[]> {
|
||||
this.changeSubscription = this.treeControl.expansionModel.onChange.subscribe(change => {
|
||||
this.changeSubscription = this.treeControl.expansionModel.onChange.subscribe((change) => {
|
||||
if ((change as SelectionChange<TreeBaseNode>).added &&
|
||||
(change as SelectionChange<TreeBaseNode>).added.length > 0) {
|
||||
this.expandTreeNodes(change as SelectionChange<TreeBaseNode>);
|
||||
@@ -67,11 +67,11 @@ export class TreeViewDataSource {
|
||||
}
|
||||
|
||||
private expandTreeNodes(change: SelectionChange<TreeBaseNode>) {
|
||||
change.added.forEach(node => this.expandNode(node));
|
||||
change.added.forEach((node) => this.expandNode(node));
|
||||
}
|
||||
|
||||
private reduceTreeNodes(change: SelectionChange<TreeBaseNode>) {
|
||||
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;
|
||||
});
|
||||
|
||||
@@ -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)))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -126,7 +126,7 @@ describe('AppConfigService', () => {
|
||||
});
|
||||
|
||||
it('should load external settings', () => {
|
||||
appConfigService.load().then(config => {
|
||||
appConfigService.load().then((config) => {
|
||||
expect(config).toEqual(mockResponse);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ export class AppConfigService {
|
||||
* @returns Notification when loading is complete
|
||||
*/
|
||||
load(): Promise<any> {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve) => {
|
||||
const configUrl = `app.config.json?v=${Date.now()}`;
|
||||
|
||||
this.http.get(configUrl).subscribe(
|
||||
|
||||
+2
-2
@@ -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;
|
||||
});
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -34,8 +34,8 @@ export class CardViewSelectItemModel<T> 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 : '');
|
||||
})
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -55,7 +55,7 @@ export class CommentsComponent implements OnChanges {
|
||||
beingAdded: boolean = false;
|
||||
|
||||
constructor(private commentProcessService: CommentProcessService, private commentContentService: CommentContentService) {
|
||||
this.comment$ = new Observable<CommentModel>(observer => this.commentObserver = observer)
|
||||
this.comment$ = new Observable<CommentModel>((observer) => this.commentObserver = observer)
|
||||
.pipe(share());
|
||||
this.comment$.subscribe((comment: CommentModel) => {
|
||||
this.comments.push(comment);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = <DataRow> {};
|
||||
|
||||
dataTable.rowClick.subscribe(e => {
|
||||
dataTable.rowClick.subscribe((e) => {
|
||||
expect(e.value).toBe(row);
|
||||
done();
|
||||
});
|
||||
@@ -744,12 +744,12 @@ describe('DataTable', () => {
|
||||
dataTable.ngAfterContentInit();
|
||||
dataTable.onSelectAllClick(<MatCheckboxChange> { 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', () => {
|
||||
|
||||
@@ -182,7 +182,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
if (differs) {
|
||||
this.differ = differs.find([]).create(null);
|
||||
}
|
||||
this.click$ = new Observable<DataRowEvent>(observer => this.clickObserver = observer)
|
||||
this.click$ = new Observable<DataRowEvent>((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 => <DataColumn> c);
|
||||
schema = this.columnList.columns.map((c) => <DataColumn> 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) {
|
||||
|
||||
@@ -56,7 +56,7 @@ export class DateCellComponent extends DataTableCellComponent {
|
||||
if (userPreferenceService) {
|
||||
userPreferenceService
|
||||
.select(UserPreferenceValues.Locale)
|
||||
.subscribe(locale => {
|
||||
.subscribe((locale) => {
|
||||
this.currentLocale = locale;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 => <DataColumn> c);
|
||||
schema = columnList.columns.map((c) => <DataColumn> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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-', <any> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -115,7 +115,7 @@ describe('UploadDirective', () => {
|
||||
<FileInfo> {},
|
||||
<FileInfo> {}
|
||||
]));
|
||||
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();
|
||||
|
||||
@@ -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<FileInfo[]> {
|
||||
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 => <FileInfo> {
|
||||
.map((file) => <FileInfo> {
|
||||
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 = (<HTMLInputElement> e.currentTarget);
|
||||
const files = FileUtils.toFileArray(input.files);
|
||||
this.onUploadFiles(files.map(file => <FileInfo> {
|
||||
this.onUploadFiles(files.map((file) => <FileInfo> {
|
||||
entry: null,
|
||||
file: file,
|
||||
relativeFolder: '/'
|
||||
|
||||
@@ -95,7 +95,7 @@ export class FormFieldComponent implements OnInit, OnDestroy {
|
||||
this.componentRef = this.container.createComponent(factory);
|
||||
let instance = <WidgetComponent> 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<any> = compiler.compileModuleAndAllComponentsSync(RuntimeComponentModule);
|
||||
return module.componentFactories.find(x => x.componentType === decoratedCmp);
|
||||
return module.componentFactories.find((x) => x.componentType === decoratedCmp);
|
||||
}
|
||||
|
||||
focusToggle() {
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('FormFieldModel', () => {
|
||||
value: '<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
|
||||
|
||||
@@ -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: <id>, name: <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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = <FormFieldOption> { id: '1', name: 'Option1' };
|
||||
spyOn(formService, 'getRestFieldValues').and.callFake(() => {
|
||||
return new Observable(observer => {
|
||||
return new Observable((observer) => {
|
||||
observer.next([restFieldValue]);
|
||||
observer.complete();
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 => <DynamicTableRow> {selected: false, value: obj});
|
||||
this.rows = field.json.value.map((obj) => <DynamicTableRow> {selected: false, value: obj});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export class DynamicTableModel extends FormWidgetModel {
|
||||
}
|
||||
|
||||
if (definitions) {
|
||||
return definitions.map(obj => <DynamicTableColumn> obj);
|
||||
return definitions.map((obj) => <DynamicTableColumn> 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
+2
-2
@@ -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();
|
||||
})
|
||||
|
||||
@@ -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 = (<HTMLInputElement> event).value;
|
||||
value = column.options.find(opt => opt.name === value);
|
||||
value = column.options.find((opt) => opt.name === value);
|
||||
row.value[column.id] = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
<DynamicRowValidationSummary> {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', () => {
|
||||
<DynamicRowValidationSummary> {isValid: false, message: 'error'}
|
||||
);
|
||||
let raised = false;
|
||||
component.save.subscribe(e => raised = true);
|
||||
component.save.subscribe((e) => raised = true);
|
||||
component.onSaveChanges();
|
||||
expect(raised).toBeFalsy();
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
})
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}));
|
||||
|
||||
@@ -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();
|
||||
})
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
restUrl: '<url>'
|
||||
});
|
||||
|
||||
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: '<url>'
|
||||
});
|
||||
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();
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user