diff --git a/web/.eslintrc.js b/web/.eslintrc.js index a42787a41..1538daecb 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -31,31 +31,14 @@ module.exports = { "import/no-unresolved": "off", "import/prefer-default-export": "off", "max-classes-per-file": "off", - "no-useless-escape": "off", "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-unused-expressions": "off", // all following rules MUST be removed (mostly autofix) "linebreak-style": ["off", "unix"], // own PR "no-restricted-syntax": "off", - "consistent-return": "off", - "no-return-assign": "off", - "prefer-destructuring": "off", - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-useless-constructor": "off", "@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/camelcase": "off", - "no-multi-assign": "off", - "no-new-object": "off", "no-plusplus": "off", - "array-callback-return": "off", - "no-mixed-operators": "off", - "no-multi-str": "off", - "no-nested-ternary": "off", - "no-sequences": "off", - "no-tabs": "off", - "no-self-assign": "off", - "global-require": "off", "no-prototype-builtins": "off", } }; diff --git a/web/src/app/administration/access-items-management/access-items-management.component.ts b/web/src/app/administration/access-items-management/access-items-management.component.ts index 114f594b1..d5daadd61 100644 --- a/web/src/app/administration/access-items-management/access-items-management.component.ts +++ b/web/src/app/administration/access-items-management/access-items-management.component.ts @@ -53,7 +53,7 @@ export class AccessItemsManagementComponent implements OnInit, OnDestroy { setAccessItemsGroups(accessItems: Array) { const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); - AccessItemsFormGroups.map(accessItemGroup => { + AccessItemsFormGroups.forEach(accessItemGroup => { accessItemGroup.controls.accessId.setValidators(Validators.required); for (const key of Object.keys(accessItemGroup.controls)) { accessItemGroup.controls[key].disable(); diff --git a/web/src/app/administration/administration.module.ts b/web/src/app/administration/administration.module.ts index 1258279d8..95ad9c7ff 100644 --- a/web/src/app/administration/administration.module.ts +++ b/web/src/app/administration/administration.module.ts @@ -1,4 +1,3 @@ -// tslint:enable:max-line-length import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -71,5 +70,3 @@ const DECLARATIONS = [ }) export class AdministrationModule { } - -// tslint:enable:max-line-length diff --git a/web/src/app/administration/classification/details/classification-details.component.spec.ts b/web/src/app/administration/classification/details/classification-details.component.spec.ts index b1df22f1d..fb3ff7980 100644 --- a/web/src/app/administration/classification/details/classification-details.component.spec.ts +++ b/web/src/app/administration/classification/details/classification-details.component.spec.ts @@ -13,9 +13,7 @@ import { ClassificationDefinition } from 'app/models/classification-definition'; import { LinksClassification } from 'app/models/links-classfication'; import { Pair } from 'app/models/pair'; -// tslint:disable:max-line-length import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service'; -// tslint:enable:max-line-length import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service'; import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service'; import { ClassificationsService } from 'app/shared/services/classifications/classifications.service'; diff --git a/web/src/app/administration/classification/details/classification-details.component.ts b/web/src/app/administration/classification/details/classification-details.component.ts index 1c7027ad6..3e6328e06 100644 --- a/web/src/app/administration/classification/details/classification-details.component.ts +++ b/web/src/app/administration/classification/details/classification-details.component.ts @@ -18,9 +18,7 @@ import { AlertService } from 'app/services/alert/alert.service'; import { TreeService } from 'app/services/tree/tree.service'; import { RemoveConfirmationService } from 'app/services/remove-confirmation/remove-confirmation.service'; -// tslint:disable:max-line-length import { ClassificationCategoriesService } from 'app/shared/services/classifications/classification-categories.service'; -// tslint:enable:max-line-length import { DomainService } from 'app/services/domain/domain.service'; import { Pair } from 'app/models/pair'; import { NgForm } from '@angular/forms'; @@ -112,7 +110,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { this.fillClassificationInformation(this.classification ? this.classification : new ClassificationDefinition()); } - if (!this.classification || this.classification.classificationId !== id && id) { + if (!this.classification || (this.classification.classificationId !== id && id)) { this.selectClassification(id); } }); @@ -128,7 +126,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { // TSK-891 fix: The property is already set and is crucial value // Wrapped with an if to set a default if not already set. if (!this.classification.category) { - this.classification.category = categories[0]; + [this.classification.category] = categories; } } }); @@ -224,18 +222,17 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { } private async selectClassification(id: string) { - if (this.classificationIsAlreadySelected()) { - return true; + if (!this.classificationIsAlreadySelected()) { + this.requestInProgress = true; + const classification = await this.classificationsService.getClassification(id); + this.fillClassificationInformation(classification); + this.classificationsService.selectClassification(classification); + this.requestInProgress = false; } - this.requestInProgress = true; - const classification = await this.classificationsService.getClassification(id); - this.fillClassificationInformation(classification); - this.classificationsService.selectClassification(classification); - this.requestInProgress = false; } private classificationIsAlreadySelected(): boolean { - if (this.action === ACTION.CREATE && this.classification) { return true; } + return this.action === ACTION.CREATE && !!this.classification; } private fillClassificationInformation(classificationSelected: ClassificationDefinition) { @@ -280,7 +277,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { this.generalModalService.triggerMessage( new MessageModal('There is no classification selected', 'Please check if you are creating a classification') ); - return false; + return; } this.requestInProgressService.setRequestInProgress(true); this.treeService.setRemovedNodeId(this.classification.classificationId); diff --git a/web/src/app/administration/components/import-export/import-export.component.ts b/web/src/app/administration/components/import-export/import-export.component.ts index 32fabb0ad..b6c40b742 100644 --- a/web/src/app/administration/components/import-export/import-export.component.ts +++ b/web/src/app/administration/components/import-export/import-export.component.ts @@ -38,7 +38,7 @@ export class ImportExportComponent implements OnInit { ngOnInit() { this.domainService.getDomains().subscribe( - data => this.domains = data + data => { this.domains = data; } ); } @@ -54,23 +54,24 @@ export class ImportExportComponent implements OnInit { const file = this.selectedFileInput.nativeElement.files[0]; const formdata = new FormData(); const ajax = new XMLHttpRequest(); - if (!this.checkFormatFile(file)) { return false; } - formdata.append('file', file); - ajax.upload.addEventListener('progress', this.progressHandler.bind(this), false); - ajax.addEventListener('load', this.resetProgress.bind(this), false); - ajax.addEventListener('error', this.onFailedResponse.bind(this, ajax), false); - ajax.onreadystatechange = this.onReadyStateChangeHandler.bind(this, ajax); - if (this.currentSelection === TaskanaType.WORKBASKETS) { - ajax.open('POST', `${environment.taskanaRestUrl}/v1/workbasket-definitions`); - } else { - ajax.open('POST', `${environment.taskanaRestUrl}/v1/classification-definitions`); + if (this.checkFormatFile(file)) { + formdata.append('file', file); + ajax.upload.addEventListener('progress', this.progressHandler.bind(this), false); + ajax.addEventListener('load', this.resetProgress.bind(this), false); + ajax.addEventListener('error', this.onFailedResponse.bind(this, ajax), false); + ajax.onreadystatechange = this.onReadyStateChangeHandler.bind(this, ajax); + if (this.currentSelection === TaskanaType.WORKBASKETS) { + ajax.open('POST', `${environment.taskanaRestUrl}/v1/workbasket-definitions`); + } else { + ajax.open('POST', `${environment.taskanaRestUrl}/v1/classification-definitions`); + } + if (!environment.production) { + ajax.setRequestHeader('Authorization', 'Basic YWRtaW46YWRtaW4='); + } + ajax.send(formdata); + this.uploadservice.isInUse = true; + this.uploadservice.setCurrentProgressValue(1); } - if (!environment.production) { - ajax.setRequestHeader('Authorization', 'Basic YWRtaW46YWRtaW4='); - } - ajax.send(formdata); - this.uploadservice.isInUse = true; - this.uploadservice.setCurrentProgressValue(1); } progressHandler(event) { @@ -79,7 +80,7 @@ export class ImportExportComponent implements OnInit { } private checkFormatFile(file): boolean { - const ending = file.name.match(/\.([^\.]+)$/)[1]; + const ending = file.name.match(/\.([^.]+)$/)[1]; let check = false; switch (ending) { case 'json': @@ -120,8 +121,8 @@ export class ImportExportComponent implements OnInit { } private onFailedResponse(event) { - this.errorHandler('Upload failed', 'The upload didn\'t proceed sucessfully. \ - \n Probably the uploaded file exceeded the maximum file size of 10 MB'); + this.errorHandler('Upload failed', 'The upload didn\'t proceed sucessfully. \n' + + 'Probably the uploaded file exceeded the maximum file size of 10 MB'); } private errorHandler(title = 'Import was not successful', message) { diff --git a/web/src/app/administration/components/type-icon/icon-type.component.ts b/web/src/app/administration/components/type-icon/icon-type.component.ts index 5277f5514..bb7e1caae 100644 --- a/web/src/app/administration/components/type-icon/icon-type.component.ts +++ b/web/src/app/administration/components/type-icon/icon-type.component.ts @@ -23,16 +23,17 @@ export class IconTypeComponent implements OnInit { return new Map([['PERSONAL', 'Personal'], ['GROUP', 'Group'], ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]); } - constructor() { } - ngOnInit() { } getIconPath(type: string) { - return type === 'PERSONAL' ? 'user.svg' - : type === 'GROUP' ? 'users.svg' - : type === 'TOPIC' ? 'topic.svg' - : type === 'CLEARANCE' ? 'clearance.svg' : 'asterisk.svg'; + switch (type) { + case 'PERSONAL': return 'user.svg'; + case 'GROUP': return 'users.svg'; + case 'TOPIC': return 'topic.svg'; + case 'CLEARANCE': return 'clearance.svg'; + default: return 'asterisk.svg'; + } } } diff --git a/web/src/app/administration/services/import-export/import-export.service.ts b/web/src/app/administration/services/import-export/import-export.service.ts index eb830dc24..a1bd2bd8c 100644 --- a/web/src/app/administration/services/import-export/import-export.service.ts +++ b/web/src/app/administration/services/import-export/import-export.service.ts @@ -5,8 +5,6 @@ import { Subject, Observable } from 'rxjs'; export class ImportExportService { public importingFinished = new Subject(); - constructor() { } - setImportingFinished(value: boolean) { this.importingFinished.next(value); } diff --git a/web/src/app/administration/services/saving-workbaskets/saving-workbaskets.service.ts b/web/src/app/administration/services/saving-workbaskets/saving-workbaskets.service.ts index a0e75b079..1ed9d6f8e 100644 --- a/web/src/app/administration/services/saving-workbaskets/saving-workbaskets.service.ts +++ b/web/src/app/administration/services/saving-workbaskets/saving-workbaskets.service.ts @@ -13,8 +13,6 @@ export class SavingWorkbasketService { public distributionTargetsSavingInformation = new Subject(); public accessItemsSavingInformation = new Subject(); - constructor() { } - triggerDistributionTargetSaving(distributionTargetInformation: SavingInformation) { this.distributionTargetsSavingInformation.next(distributionTargetInformation); } diff --git a/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts b/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts index 603b01df4..2782e4143 100644 --- a/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts +++ b/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts @@ -61,8 +61,8 @@ describe('AccessItemsComponent', () => { ), new Links({ href: 'someurl' }) ))); - spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(of(true)), - spyOn(alertService, 'triggerAlert').and.returnValue(of(true)), + spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(of(true)); + spyOn(alertService, 'triggerAlert').and.returnValue(of(true)); debugElement = fixture.debugElement.nativeElement; accessIdsService = TestBed.get(AccessIdsService); spyOn(accessIdsService, 'getAccessItemsInformation').and.returnValue(of(new Array( diff --git a/web/src/app/administration/workbasket/details/access-items/access-items.component.ts b/web/src/app/administration/workbasket/details/access-items/access-items.component.ts index 1cc474195..59e59c07d 100644 --- a/web/src/app/administration/workbasket/details/access-items/access-items.component.ts +++ b/web/src/app/administration/workbasket/details/access-items/access-items.component.ts @@ -69,7 +69,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { setAccessItemsGroups(accessItems: Array) { const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); - AccessItemsFormGroups.map(accessItemGroup => { + AccessItemsFormGroups.forEach(accessItemGroup => { accessItemGroup.controls.accessId.setValidators(Validators.required); }); const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups); diff --git a/web/src/app/administration/workbasket/details/distribution-targets/distribution-targets.component.ts b/web/src/app/administration/workbasket/details/distribution-targets/distribution-targets.component.ts index c34e5fe87..9b428b4e8 100644 --- a/web/src/app/administration/workbasket/details/distribution-targets/distribution-targets.component.ts +++ b/web/src/app/administration/workbasket/details/distribution-targets/distribution-targets.component.ts @@ -147,7 +147,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy { this.onRequest(false, dualListFilter.side); this.workbasketFilterSubscription = this.workbasketService.getWorkBasketsSummary(true, '', '', '', dualListFilter.filterBy.filterParams.name, dualListFilter.filterBy.filterParams.description, '', - dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, '', + dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, '', dualListFilter.filterBy.filterParams.key, '', true).subscribe(resultList => { (dualListFilter.side === Side.RIGHT) ? this.distributionTargetsRight = (resultList.workbaskets) diff --git a/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts b/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts index da0056ad8..edecc5628 100644 --- a/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts +++ b/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts @@ -186,7 +186,7 @@ implements OnInit, OnChanges, OnDestroy { this.beforeRequest(); if (!this.workbasket.workbasketId) { this.postNewWorkbasket(); - return true; + return; } this.workbasketSubscription = this.workbasketService diff --git a/web/src/app/administration/workbasket/master/workbasket-list.component.spec.ts b/web/src/app/administration/workbasket/master/workbasket-list.component.spec.ts index eff24f477..e3335b83b 100644 --- a/web/src/app/administration/workbasket/master/workbasket-list.component.spec.ts +++ b/web/src/app/administration/workbasket/master/workbasket-list.component.spec.ts @@ -134,15 +134,15 @@ describe('WorkbasketListComponent', () => { }); // it('should have two workbasketsummary rows created with the second one selected.', fakeAsync(() => { - // tick(0); - // fixture.detectChanges(); - // fixture.whenStable().then(() => { - // expect(debugElement.querySelectorAll('#wb-list-container > li').length).toBe(3); - // expect(debugElement.querySelectorAll('#wb-list-container > li')[1].getAttribute('class')) - // .toBe('list-group-item ng-star-inserted'); - // expect(debugElement.querySelectorAll('#wb-list-container > li')[2].getAttribute('class')) - // .toBe('list-group-item ng-star-inserted active'); - // }) + // tick(0); + // fixture.detectChanges(); + // fixture.whenStable().then(() => { + // expect(debugElement.querySelectorAll('#wb-list-container > li').length).toBe(3); + // expect(debugElement.querySelectorAll('#wb-list-container > li')[1].getAttribute('class')) + // .toBe('list-group-item ng-star-inserted'); + // expect(debugElement.querySelectorAll('#wb-list-container > li')[2].getAttribute('class')) + // .toBe('list-group-item ng-star-inserted active'); + // }) // // })); diff --git a/web/src/app/app.module.ts b/web/src/app/app.module.ts index 627507ab5..e1d89c5c3 100644 --- a/web/src/app/app.module.ts +++ b/web/src/app/app.module.ts @@ -1,4 +1,3 @@ -// tslint:disable:max-line-length /** * Modules */ @@ -113,5 +112,3 @@ export function startupServiceFactory(startupService: StartupService): () => Pro }) export class AppModule { } - -// tslint:enable:max-line-length diff --git a/web/src/app/history/task-query/task-query.component.ts b/web/src/app/history/task-query/task-query.component.ts index d7cc96962..6b39637f5 100644 --- a/web/src/app/history/task-query/task-query.component.ts +++ b/web/src/app/history/task-query/task-query.component.ts @@ -134,13 +134,12 @@ export class TaskQueryComponent implements OnInit { } changeOrderBy(key: string) { - if (!this.filterFieldsToAllowQuerying(key)) { - return null; + if (this.filterFieldsToAllowQuerying(key)) { + if (this.orderBy.sortBy === key) { + this.orderBy.sortDirection = this.toggleSortDirection(this.orderBy.sortDirection); + } + this.orderBy.sortBy = key; } - if (this.orderBy.sortBy === key) { - this.orderBy.sortDirection = this.toggleSortDirection(this.orderBy.sortDirection); - } - this.orderBy.sortBy = key; } openDetails(key: string, val: string) { @@ -184,13 +183,8 @@ export class TaskQueryComponent implements OnInit { false ).subscribe(taskQueryResource => { this.requestInProgressService.setRequestInProgress(false); - if (!taskQueryResource.taskHistoryEvents) { - this.taskQuery = null; - this.taskQueryResource = null; - return null; - } - this.taskQueryResource = taskQueryResource; - this.taskQuery = taskQueryResource.taskHistoryEvents; + this.taskQueryResource = taskQueryResource.taskHistoryEvents ? taskQueryResource : null; + this.taskQuery = taskQueryResource.taskHistoryEvents ? taskQueryResource.taskHistoryEvents : null; }); } @@ -206,8 +200,8 @@ export class TaskQueryComponent implements OnInit { const unusedHeight = 300; const totalHeight = window.innerHeight; const cards = Math.round((totalHeight - (unusedHeight)) / rowHeight); - TaskanaQueryParameters.page ? TaskanaQueryParameters.page = TaskanaQueryParameters.page : TaskanaQueryParameters.page = 1; - cards > 0 ? TaskanaQueryParameters.pageSize = cards : TaskanaQueryParameters.pageSize = 1; + TaskanaQueryParameters.page = TaskanaQueryParameters.page ? TaskanaQueryParameters.page : 1; + TaskanaQueryParameters.pageSize = cards > 0 ? cards : 1; } updateDate($event: string) { diff --git a/web/src/app/models/workbasket-definition.ts b/web/src/app/models/workbasket-definition.ts index 8c377bcf7..cded1b56f 100644 --- a/web/src/app/models/workbasket-definition.ts +++ b/web/src/app/models/workbasket-definition.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable @typescript-eslint/no-useless-constructor */ import { WorkbasketAccessItems } from './workbasket-access-items'; import { Workbasket } from './workbasket'; diff --git a/web/src/app/monitor/report/report.component.ts b/web/src/app/monitor/report/report.component.ts index 6bc253347..994835d6d 100644 --- a/web/src/app/monitor/report/report.component.ts +++ b/web/src/app/monitor/report/report.component.ts @@ -12,9 +12,6 @@ export class ReportComponent implements OnInit { @Input() reportData: ReportData; - constructor() { - } - ngOnInit(): void { } diff --git a/web/src/app/monitor/services/restConnector/rest-connector.service.ts b/web/src/app/monitor/services/restConnector/rest-connector.service.ts index 76d8a1a68..75d0f6413 100644 --- a/web/src/app/monitor/services/restConnector/rest-connector.service.ts +++ b/web/src/app/monitor/services/restConnector/rest-connector.service.ts @@ -40,7 +40,7 @@ export class RestConnectorService { getChartData(source: ReportData): Array { return source.rows.map(row => { const rowData = new ChartData(); - rowData.label = row.desc[0]; + [rowData.label] = row.desc; rowData.data = row.cells; return rowData; }); diff --git a/web/src/app/monitor/workbasket/monitor-workbasket-query-switcher/monitor-workbasket-query-switcher.component.ts b/web/src/app/monitor/workbasket/monitor-workbasket-query-switcher/monitor-workbasket-query-switcher.component.ts index 3fe89689e..6e4eac5ce 100644 --- a/web/src/app/monitor/workbasket/monitor-workbasket-query-switcher/monitor-workbasket-query-switcher.component.ts +++ b/web/src/app/monitor/workbasket/monitor-workbasket-query-switcher/monitor-workbasket-query-switcher.component.ts @@ -14,9 +14,6 @@ export class MonitorWorkbasketQuerySwitcherComponent implements OnInit { monitorQueryPlannedDateType = MonitorQueryType.PlannedDate; monitorQueryDueDateType = MonitorQueryType.DueDate; - constructor() { - } - ngOnInit() { this.selectedChartType = MonitorQueryType.DueDate; this.queryChanged.emit(MonitorQueryType.DueDate); diff --git a/web/src/app/monitor/workbasket/monitor-workbaskets.component.ts b/web/src/app/monitor/workbasket/monitor-workbaskets.component.ts index baa4515ce..db6dedc63 100644 --- a/web/src/app/monitor/workbasket/monitor-workbaskets.component.ts +++ b/web/src/app/monitor/workbasket/monitor-workbaskets.component.ts @@ -12,9 +12,6 @@ export class MonitorWorkbasketsComponent implements OnInit { showMonitorQueryPlannedDate: Boolean; showMonitorQueryDueDate: Boolean; - constructor() { - } - ngOnInit() { } diff --git a/web/src/app/services/alert/alert.service.ts b/web/src/app/services/alert/alert.service.ts index 3c5c41ac7..879d155f3 100644 --- a/web/src/app/services/alert/alert.service.ts +++ b/web/src/app/services/alert/alert.service.ts @@ -6,8 +6,6 @@ import { AlertModel } from 'app/models/alert'; export class AlertService { public alertTriggered = new Subject(); - constructor() { } - triggerAlert(alert: AlertModel) { this.alertTriggered.next(alert); } diff --git a/web/src/app/services/custom-fields/custom-fields.service.spec.ts b/web/src/app/services/custom-fields/custom-fields.service.spec.ts index 69930f0f0..c7d09583b 100644 --- a/web/src/app/services/custom-fields/custom-fields.service.spec.ts +++ b/web/src/app/services/custom-fields/custom-fields.service.spec.ts @@ -2,6 +2,8 @@ import { TestBed, inject } from '@angular/core/testing'; import { CustomFieldsService } from './custom-fields.service'; +const json = require('./taskana-customization-test.json'); + describe('CustomFieldsService', () => { beforeEach(() => { TestBed.configureTestingModule({ @@ -21,7 +23,6 @@ describe('CustomFieldsService', () => { })); it('should take default icon path in merge', inject([CustomFieldsService], (service: CustomFieldsService) => { - const json = require('./taskana-customization-test.json'); service.initCustomFields('EN', json); const categoriesDefault = json.EN.classifications.categories; const categoriesData = { @@ -36,7 +37,6 @@ describe('CustomFieldsService', () => { })); it('should take merge icon path', inject([CustomFieldsService], (service: CustomFieldsService) => { - const json = require('./taskana-customization-test.json'); service.initCustomFields('EN', json); const categoriesData = { DEFAULT: 'assets/icons/categories/default.svg' }; const result = { diff --git a/web/src/app/services/custom-fields/custom-fields.service.ts b/web/src/app/services/custom-fields/custom-fields.service.ts index b9918e783..f892079da 100644 --- a/web/src/app/services/custom-fields/custom-fields.service.ts +++ b/web/src/app/services/custom-fields/custom-fields.service.ts @@ -4,7 +4,6 @@ import { CustomField } from '../../models/customField'; @Injectable() export class CustomFieldsService { private customizedFields: any = {}; - constructor() { } initCustomFields(language: string = 'EN', jsonFile: any) { this.customizedFields = jsonFile[language]; @@ -64,7 +63,7 @@ export class CustomFieldsService { } private mergeKeys(defaultObject: Object, newObject: Object) { - const value = new Object(); + const value = {}; for (const item of Object.keys(defaultObject)) { if (!value[item]) { diff --git a/web/src/app/services/domain/domain.service.mock.ts b/web/src/app/services/domain/domain.service.mock.ts index c9ae84ef2..d3b4c99c5 100644 --- a/web/src/app/services/domain/domain.service.mock.ts +++ b/web/src/app/services/domain/domain.service.mock.ts @@ -6,9 +6,6 @@ export class DomainServiceMock { private domainSelectedValue; private domainSelected = new BehaviorSubject('DOMAIN_A'); - constructor() { - } - // GET getDomains(): Observable { return of([]); diff --git a/web/src/app/services/domain/domain.service.ts b/web/src/app/services/domain/domain.service.ts index 5ee567b35..0d1db8c2e 100644 --- a/web/src/app/services/domain/domain.service.ts +++ b/web/src/app/services/domain/domain.service.ts @@ -110,5 +110,6 @@ export class DomainService { } if (this.router.url.indexOf('classifications') !== -1) { return 'taskana/administration/classifications'; } + return ''; } } diff --git a/web/src/app/services/general-modal/general-modal.service.ts b/web/src/app/services/general-modal/general-modal.service.ts index 3dbbabebe..88d61d540 100644 --- a/web/src/app/services/general-modal/general-modal.service.ts +++ b/web/src/app/services/general-modal/general-modal.service.ts @@ -6,8 +6,6 @@ import { MessageModal } from 'app/models/message-modal'; export class GeneralModalService { private messageTriggered = new Subject(); - constructor() { } - triggerMessage(message: MessageModal) { this.messageTriggered.next(message); } diff --git a/web/src/app/services/masterAndDetail/master-and-detail.service.ts b/web/src/app/services/masterAndDetail/master-and-detail.service.ts index bf2ae60e1..7bd3db9f0 100644 --- a/web/src/app/services/masterAndDetail/master-and-detail.service.ts +++ b/web/src/app/services/masterAndDetail/master-and-detail.service.ts @@ -5,9 +5,6 @@ import { Observable, BehaviorSubject } from 'rxjs'; export class MasterAndDetailService { public showDetail = new BehaviorSubject(false); - - constructor() { } - setShowDetail(newValue: boolean) { this.showDetail.next(newValue); } diff --git a/web/src/app/services/orientation/orientation.service.ts b/web/src/app/services/orientation/orientation.service.ts index b3f50dd87..178adca9e 100644 --- a/web/src/app/services/orientation/orientation.service.ts +++ b/web/src/app/services/orientation/orientation.service.ts @@ -9,8 +9,6 @@ export class OrientationService { private currentOrientation; public orientation = new BehaviorSubject(this.currentOrientation); - constructor() { } - onResize() { const orientation = this.detectOrientation(); if (orientation !== this.currentOrientation) { @@ -36,7 +34,7 @@ export class OrientationService { calculateNumberItemsList(heightContainer: number, cardHeight: number, unusedHeight: number, doubleList = false): number { let cards = Math.round((heightContainer - unusedHeight) / cardHeight); if (doubleList && window.innerWidth < 992) { cards = Math.floor(cards / 2); } - cards > 0 ? TaskanaQueryParameters.pageSize = cards : TaskanaQueryParameters.pageSize = 1; + TaskanaQueryParameters.pageSize = cards > 0 ? cards : 1; return cards; } diff --git a/web/src/app/services/remove-confirmation/remove-confirmation.service.ts b/web/src/app/services/remove-confirmation/remove-confirmation.service.ts index 436e88a00..823d8416c 100644 --- a/web/src/app/services/remove-confirmation/remove-confirmation.service.ts +++ b/web/src/app/services/remove-confirmation/remove-confirmation.service.ts @@ -6,8 +6,6 @@ export class RemoveConfirmationService { private removeConfirmationCallbackSubject = new Subject<{ callback: Function, message: string }>(); private removeConfirmationCallback: Function; - constructor() { } - setRemoveConfirmation(callback: Function, message: string) { this.removeConfirmationCallback = callback; this.removeConfirmationCallbackSubject.next({ callback, message }); diff --git a/web/src/app/services/requestInProgress/request-in-progress.service.ts b/web/src/app/services/requestInProgress/request-in-progress.service.ts index 4d2f6aaff..605371781 100644 --- a/web/src/app/services/requestInProgress/request-in-progress.service.ts +++ b/web/src/app/services/requestInProgress/request-in-progress.service.ts @@ -5,8 +5,6 @@ import { Subject, Observable } from 'rxjs'; export class RequestInProgressService { public requestInProgressTriggered = new Subject(); - constructor() { } - setRequestInProgress(value: boolean) { setTimeout(() => this.requestInProgressTriggered.next(value), 0); } diff --git a/web/src/app/services/taskana-engine/taskana-engine.mock.service.ts b/web/src/app/services/taskana-engine/taskana-engine.mock.service.ts index f1a127029..d94d7b22c 100644 --- a/web/src/app/services/taskana-engine/taskana-engine.mock.service.ts +++ b/web/src/app/services/taskana-engine/taskana-engine.mock.service.ts @@ -38,10 +38,6 @@ export class TaskanaEngineServiceMock { } private findRole(roles2Find: Array) { - return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => { - if (role === roleLookingFor) { - return true; - } - })); + return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => role === roleLookingFor)); } } diff --git a/web/src/app/services/taskana-engine/taskana-engine.service.ts b/web/src/app/services/taskana-engine/taskana-engine.service.ts index f1b94bab7..6d4b65acf 100644 --- a/web/src/app/services/taskana-engine/taskana-engine.service.ts +++ b/web/src/app/services/taskana-engine/taskana-engine.service.ts @@ -48,10 +48,6 @@ export class TaskanaEngineService { } private findRole(roles2Find: Array) { - return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => { - if (role === roleLookingFor) { - return true; - } - })); + return this.currentUserInfo.roles.find(role => roles2Find.some(roleLookingFor => role === roleLookingFor)); } } diff --git a/web/src/app/services/titles/titles.service.ts b/web/src/app/services/titles/titles.service.ts index 2efee9ccd..517a8733f 100644 --- a/web/src/app/services/titles/titles.service.ts +++ b/web/src/app/services/titles/titles.service.ts @@ -4,7 +4,6 @@ import { Injectable } from '@angular/core'; export class TitlesService { titles = new Map(); customizedTitles: any = {}; - constructor() { } initTitles(language: string = 'EN', jsonFile: any) { this.titles = jsonFile[language]; diff --git a/web/src/app/services/tree/tree.service.ts b/web/src/app/services/tree/tree.service.ts index 6bc9665e8..a914f4acd 100644 --- a/web/src/app/services/tree/tree.service.ts +++ b/web/src/app/services/tree/tree.service.ts @@ -5,8 +5,6 @@ import { Subject } from 'rxjs'; export class TreeService { public removedNodeId = new Subject(); - constructor() { } - setRemovedNodeId(value: string) { this.removedNodeId.next(value); } diff --git a/web/src/app/shared/classification-types-selector/classification-types-selector.component.ts b/web/src/app/shared/classification-types-selector/classification-types-selector.component.ts index 67b672ed2..945bef962 100644 --- a/web/src/app/shared/classification-types-selector/classification-types-selector.component.ts +++ b/web/src/app/shared/classification-types-selector/classification-types-selector.component.ts @@ -18,8 +18,6 @@ export class ClassificationTypesSelectorComponent implements OnInit { @Output() classificationTypeChanged = new EventEmitter(); - constructor() { } - ngOnInit() { } diff --git a/web/src/app/shared/dropdown/dropdown.component.ts b/web/src/app/shared/dropdown/dropdown.component.ts index 3ba6e5570..b32dc40b1 100644 --- a/web/src/app/shared/dropdown/dropdown.component.ts +++ b/web/src/app/shared/dropdown/dropdown.component.ts @@ -12,9 +12,6 @@ export class DropdownComponent implements OnInit { @Input() list: Array; @Output() performClassification = new EventEmitter(); - constructor() { - } - ngOnInit(): void { } diff --git a/web/src/app/shared/field-error-display/field-error-display.component.ts b/web/src/app/shared/field-error-display/field-error-display.component.ts index 01749acf8..5fac7baf3 100644 --- a/web/src/app/shared/field-error-display/field-error-display.component.ts +++ b/web/src/app/shared/field-error-display/field-error-display.component.ts @@ -17,8 +17,6 @@ export class FieldErrorDisplayComponent implements OnInit { @Input() validationTrigger: boolean; - constructor() { } - ngOnInit() { } } diff --git a/web/src/app/shared/general-message-modal/general-message-modal.component.ts b/web/src/app/shared/general-message-modal/general-message-modal.component.ts index ce6112538..0a312d69c 100644 --- a/web/src/app/shared/general-message-modal/general-message-modal.component.ts +++ b/web/src/app/shared/general-message-modal/general-message-modal.component.ts @@ -20,8 +20,6 @@ export class GeneralMessageModalComponent implements OnChanges { @ViewChild('generalModal', { static: true }) private modal; - constructor() { } - ngOnChanges(changes: SimpleChanges) { if (this.message) { $(this.modal.nativeElement).modal('toggle'); diff --git a/web/src/app/shared/number-picker/number-picker.component.ts b/web/src/app/shared/number-picker/number-picker.component.ts index a24d1890d..4190a425c 100644 --- a/web/src/app/shared/number-picker/number-picker.component.ts +++ b/web/src/app/shared/number-picker/number-picker.component.ts @@ -52,9 +52,6 @@ export class NumberPickerComponent implements OnInit, ControlValueAccessor { this.onTouchedCallback = fn; } - constructor() { - } - ngOnInit() { } diff --git a/web/src/app/shared/pagination/pagination.component.ts b/web/src/app/shared/pagination/pagination.component.ts index aef9c39e3..b4cfffc0f 100644 --- a/web/src/app/shared/pagination/pagination.component.ts +++ b/web/src/app/shared/pagination/pagination.component.ts @@ -33,8 +33,6 @@ export class PaginationComponent implements OnChanges { pageSelected = 1; maxPagesAvailable = 8; - constructor() {} - ngOnChanges(changes: SimpleChanges): void { if (changes.page && changes.page.currentValue) { this.pageSelected = changes.page.currentValue.number; @@ -44,7 +42,8 @@ export class PaginationComponent implements OnChanges { changeToPage(page) { if (page < 1) { - page = this.pageSelected = 1; + this.pageSelected = 1; + page = this.pageSelected; } if (page > this.page.totalPages) { page = this.page.totalPages; diff --git a/web/src/app/shared/pipes/selectedWorkbasket/seleted-workbasket.pipe.ts b/web/src/app/shared/pipes/selectedWorkbasket/seleted-workbasket.pipe.ts index 3cf5ee5e6..49d9f972d 100644 --- a/web/src/app/shared/pipes/selectedWorkbasket/seleted-workbasket.pipe.ts +++ b/web/src/app/shared/pipes/selectedWorkbasket/seleted-workbasket.pipe.ts @@ -11,7 +11,7 @@ export class SelectWorkBasketPipe implements PipeTransform { for (let index = originArray.length - 1; index >= 0; index--) { if ((arg1 && !selectionArray.some(elementToRemove => originArray[index].workbasketId === elementToRemove.workbasketId)) - || !arg1 && selectionArray.some(elementToRemove => originArray[index].workbasketId === elementToRemove.workbasketId)) { + || (!arg1 && selectionArray.some(elementToRemove => originArray[index].workbasketId === elementToRemove.workbasketId))) { originArray.splice(index, 1); } } diff --git a/web/src/app/shared/progress-bar/progress-bar.component.ts b/web/src/app/shared/progress-bar/progress-bar.component.ts index 48be27f84..c6d41188e 100644 --- a/web/src/app/shared/progress-bar/progress-bar.component.ts +++ b/web/src/app/shared/progress-bar/progress-bar.component.ts @@ -16,8 +16,6 @@ export class ProgressBarComponent implements OnInit, OnChanges { inProgress = false; - constructor() { } - ngOnInit() { } diff --git a/web/src/app/shared/services/access-ids/access-ids.service.ts b/web/src/app/shared/services/access-ids/access-ids.service.ts index 43a8d4c68..f9dfc5f65 100644 --- a/web/src/app/shared/services/access-ids/access-ids.service.ts +++ b/web/src/app/shared/services/access-ids/access-ids.service.ts @@ -39,13 +39,14 @@ export class AccessIdsService { return this.accessItemsRef; } - return this.accessItemsRef = this.httpClient.get(encodeURI( + this.accessItemsRef = this.httpClient.get(encodeURI( `${environment.taskanaRestUrl}/v1/workbasket-access-items/${TaskanaQueryParameters.getQueryParameters( this.accessIdsParameters(sortModel, accessIds, accessIdLike, workbasketKeyLike) )}` )); + return this.accessItemsRef; } removeAccessItemsPermissions(accessId: string) { diff --git a/web/src/app/shared/services/classifications/classification-categories.service.ts b/web/src/app/shared/services/classifications/classification-categories.service.ts index f7cd10528..35965cde2 100644 --- a/web/src/app/shared/services/classifications/classification-categories.service.ts +++ b/web/src/app/shared/services/classifications/classification-categories.service.ts @@ -14,7 +14,7 @@ export class ClassificationCategoriesService { private urlCategories = `${this.mainUrl}/v1/classification-categories`; private param = '/?type='; private dataObsCategories$ = new ReplaySubject>(1); - private categoriesObject = new Object(); + private categoriesObject = {}; private missingIcon = 'assets/icons/categories/missing-icon.svg'; private type = 'UNKNOW'; @@ -56,7 +56,7 @@ export class ClassificationCategoriesService { } private getDefaultCategoryMap(categoryList: Array): Object { - const defaultCategoryMap = new Object(); + const defaultCategoryMap = {}; categoryList.forEach(element => { defaultCategoryMap[element] = `assets/icons/categories/${element.toLowerCase()}.svg`; }); diff --git a/web/src/app/shared/services/forms/forms-validator.service.ts b/web/src/app/shared/services/forms/forms-validator.service.ts index 102b4436f..eb496a877 100644 --- a/web/src/app/shared/services/forms/forms-validator.service.ts +++ b/web/src/app/shared/services/forms/forms-validator.service.ts @@ -18,7 +18,7 @@ export class FormsValidatorService { public async validateFormInformation(form: NgForm, toogleValidationMap: Map): Promise { let validSync = true; if (!form) { - return; + return false; } const forFieldsPromise = new Promise((resolve, reject) => { for (const control in form.form.controls) { diff --git a/web/src/app/shared/services/upload/upload.service.ts b/web/src/app/shared/services/upload/upload.service.ts index 5a22dd2c4..d2818a1e9 100644 --- a/web/src/app/shared/services/upload/upload.service.ts +++ b/web/src/app/shared/services/upload/upload.service.ts @@ -8,8 +8,6 @@ export class UploadService { private currentProgressValue = new Subject(); public isInUse = false; - constructor() { } - setCurrentProgressValue(value: number) { this.currentProgressValue.next(value); } diff --git a/web/src/app/shared/sort/sort.component.ts b/web/src/app/shared/sort/sort.component.ts index 6e1ffefb8..f60164080 100644 --- a/web/src/app/shared/sort/sort.component.ts +++ b/web/src/app/shared/sort/sort.component.ts @@ -15,9 +15,6 @@ export class SortComponent implements OnInit { sort: SortingModel = new SortingModel(); - constructor() { - } - ngOnInit() { this.sort.sortBy = this.defaultSortBy; } diff --git a/web/src/app/shared/tree/tree.component.spec.ts b/web/src/app/shared/tree/tree.component.spec.ts index a2fdeb844..e28256ce0 100644 --- a/web/src/app/shared/tree/tree.component.spec.ts +++ b/web/src/app/shared/tree/tree.component.spec.ts @@ -13,7 +13,6 @@ import { LinksClassification } from '../../models/links-classfication'; import { ClassificationCategoriesService } from '../services/classifications/classification-categories.service'; import { ClassificationsService } from '../services/classifications/classifications.service'; -// tslint:disable:component-selector @Component({ selector: 'tree-root', template: '' @@ -28,8 +27,6 @@ class TreeVendorComponent { }; } -// tslint:enable:component-selector - describe('TaskanaTreeComponent', () => { let component: TaskanaTreeComponent; let fixture: ComponentFixture; diff --git a/web/src/app/shared/type-ahead/type-ahead.component.ts b/web/src/app/shared/type-ahead/type-ahead.component.ts index 607080fef..cc20a6fd4 100644 --- a/web/src/app/shared/type-ahead/type-ahead.component.ts +++ b/web/src/app/shared/type-ahead/type-ahead.component.ts @@ -124,7 +124,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor { } setTyping(value) { - if (this.disable) { return true; } + if (this.disable) { return; } if (value) { setTimeout(() => { this.inputTypeAhead.nativeElement.focus(); diff --git a/web/src/app/workplace/components/code/code.component.ts b/web/src/app/workplace/components/code/code.component.ts index a1343eb06..5a1132b99 100644 --- a/web/src/app/workplace/components/code/code.component.ts +++ b/web/src/app/workplace/components/code/code.component.ts @@ -15,17 +15,15 @@ export class CodeComponent implements OnInit { @HostListener('window:keyup', ['$event']) keyEvent(event: KeyboardEvent) { if (this.bufferKeys === '') { - setTimeout(() => this.bufferKeys = '', 5000); + setTimeout(() => { this.bufferKeys = ''; }, 5000); } this.bufferKeys += event.code; if (this.code === this.bufferKeys) { this.showCode = true; - setTimeout(() => this.showCode = false, 5000); + setTimeout(() => { this.showCode = false; }, 5000); } } - constructor() { } - ngOnInit() { } } diff --git a/web/src/app/workplace/services/custom-http-interceptor/custom-http-interceptor.service.ts b/web/src/app/workplace/services/custom-http-interceptor/custom-http-interceptor.service.ts index 40fe6b3f3..cae832f0f 100644 --- a/web/src/app/workplace/services/custom-http-interceptor/custom-http-interceptor.service.ts +++ b/web/src/app/workplace/services/custom-http-interceptor/custom-http-interceptor.service.ts @@ -6,9 +6,6 @@ import { environment } from 'environments/environment'; @Injectable() export class CustomHttpClientInterceptor implements HttpInterceptor { - constructor() { - } - intercept(req: HttpRequest, next: HttpHandler): Observable> { if (!environment.production) { req = req.clone({ headers: req.headers.set('Authorization', 'Basic YWRtaW46YWRtaW4=') }); diff --git a/web/src/app/workplace/taskdetails/attribute/attribute.component.ts b/web/src/app/workplace/taskdetails/attribute/attribute.component.ts index ce4268519..7baf3bef9 100644 --- a/web/src/app/workplace/taskdetails/attribute/attribute.component.ts +++ b/web/src/app/workplace/taskdetails/attribute/attribute.component.ts @@ -11,10 +11,6 @@ export class TaskdetailsAttributeComponent implements OnInit { @Input() attributes: CustomAttribute[] = []; @Output() attributesChange: EventEmitter = new EventEmitter(); - - constructor() { - } - ngOnInit() { } diff --git a/web/src/app/workplace/taskdetails/custom/custom-fields.component.ts b/web/src/app/workplace/taskdetails/custom/custom-fields.component.ts index 3ffb6b8b0..1bad239db 100644 --- a/web/src/app/workplace/taskdetails/custom/custom-fields.component.ts +++ b/web/src/app/workplace/taskdetails/custom/custom-fields.component.ts @@ -9,9 +9,6 @@ export class TaskdetailsCustomFieldsComponent implements OnInit { @Input() task: Task; @Output() taskChange: EventEmitter = new EventEmitter(); - constructor() { - } - ngOnInit() { } } diff --git a/web/src/app/workplace/taskdetails/general-fields-extension/general-fields-extension.component.ts b/web/src/app/workplace/taskdetails/general-fields-extension/general-fields-extension.component.ts index 11ecb0c87..73cc86dc2 100644 --- a/web/src/app/workplace/taskdetails/general-fields-extension/general-fields-extension.component.ts +++ b/web/src/app/workplace/taskdetails/general-fields-extension/general-fields-extension.component.ts @@ -10,8 +10,6 @@ export class GeneralFieldsExtensionComponent implements OnInit { @Input() task: Task; @Output() taskChange: EventEmitter = new EventEmitter(); - constructor() { } - ngOnInit() { } } diff --git a/web/src/app/workplace/taskmaster/task-list/task-list.component.spec.ts b/web/src/app/workplace/taskmaster/task-list/task-list.component.spec.ts index 4dd79d48d..6c59a2f6f 100644 --- a/web/src/app/workplace/taskmaster/task-list/task-list.component.spec.ts +++ b/web/src/app/workplace/taskmaster/task-list/task-list.component.spec.ts @@ -18,7 +18,6 @@ export class DummyDetailComponent { } @Component({ - // tslint:disable-next-line: component-selector selector: 'svg-icon', template: '

Mock Icon Component

' })