From 22b0b2170b721540c917e12819815f11dc79ccbb Mon Sep 17 00:00:00 2001 From: BVier <26220150+BVier@users.noreply.github.com> Date: Mon, 9 Dec 2019 10:13:32 +0100 Subject: [PATCH] TSK-975: Remove unnecessary initializers --- .../access-items-management.component.html | 6 +- .../classification-details.component.spec.ts | 5 +- .../classification-details.component.ts | 16 ++--- .../list/classification-list.component.ts | 6 +- .../import-export/import-export.component.ts | 4 +- .../type-icon/icon-type.component.ts | 2 +- .../access-items.component.spec.ts | 7 +- .../access-items/access-items.component.ts | 10 +-- .../distribution-targets.component.ts | 29 ++++---- .../workbasket-information.component.spec.ts | 8 ++- .../details/workbasket-details.component.ts | 52 +++++++------- .../workbasket-list-toolbar.component.spec.ts | 5 +- .../workbasket-list-toolbar.component.ts | 2 +- .../master/workbasket-list.component.html | 2 +- .../master/workbasket-list.component.spec.ts | 4 +- .../master/workbasket-list.component.ts | 6 +- .../services/task-query/task-query.service.ts | 2 +- web/src/app/models/access-id.ts | 4 +- .../models/access-item-workbasket-resource.ts | 2 +- web/src/app/models/access-item-workbasket.ts | 8 +-- .../app/models/classification-definition.ts | 48 ++++++------- web/src/app/models/classification-resource.ts | 2 +- web/src/app/models/classification.ts | 20 +++--- web/src/app/models/links-classfication.ts | 12 ++-- .../app/models/links-workbasket-summary.ts | 8 +-- web/src/app/models/links.ts | 10 +-- web/src/app/models/message-modal.ts | 4 +- web/src/app/models/page.ts | 8 +-- web/src/app/models/pair.ts | 4 +- .../app/models/task-history-event-resource.ts | 2 +- web/src/app/models/tree-node.ts | 20 +++--- web/src/app/models/user-info.ts | 2 +- web/src/app/models/version.ts | 2 +- .../workbasket-access-items-resource.ts | 2 +- web/src/app/models/workbasket-access-items.ts | 2 +- web/src/app/models/workbasket-resource.ts | 2 +- web/src/app/models/workbasket-summary.ts | 26 +++---- web/src/app/models/workbasket.ts | 32 ++++----- .../custom-fields.service.spec.ts | 2 +- .../custom-fields/custom-fields.service.ts | 4 +- web/src/app/services/domain/domain.service.ts | 2 +- .../orientation/orientation.service.ts | 2 +- .../services/selected-route/selected-route.ts | 2 +- web/src/app/services/titles/titles.service.ts | 2 +- web/src/app/shared/alert/alert.component.ts | 2 +- ...classification-types-selector.component.ts | 5 +- .../master-and-detail.component.ts | 2 +- .../services/access-ids/access-ids.service.ts | 12 ++-- .../classifications.service.ts | 6 +- .../services/workbasket/workbasket.service.ts | 46 ++++++------ .../app/shared/spinner/spinner.component.ts | 6 +- web/src/app/shared/tree/tree.component.ts | 4 +- .../shared/type-ahead/type-ahead.component.ts | 2 +- .../app/shared/util/query-parameters.spec.ts | 4 +- .../app/workplace/models/object-reference.ts | 12 ++-- web/src/app/workplace/models/task-resource.ts | 2 +- web/src/app/workplace/models/task.ts | 72 +++++++++---------- .../app/workplace/services/task.service.ts | 8 +-- .../workplace/services/workplace.service.ts | 10 +-- .../general/general-fields.component.ts | 2 +- .../taskdetails/taskdetails.component.ts | 12 ++-- .../task-list-toolbar.component.ts | 20 +++--- .../task-list/task-list.component.ts | 2 +- .../taskmaster/task-master.component.ts | 14 ++-- 64 files changed, 325 insertions(+), 318 deletions(-) diff --git a/web/src/app/administration/access-items-management/access-items-management.component.html b/web/src/app/administration/access-items-management/access-items-management.component.html index eac6455c0..d468c0641 100644 --- a/web/src/app/administration/access-items-management/access-items-management.component.html +++ b/web/src/app/administration/access-items-management/access-items-management.component.html @@ -173,10 +173,10 @@ - \ No newline at end of file + 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 ce24255b4..f30ca650a 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 @@ -67,9 +67,8 @@ describe('ClassificationDetailsComponent', () => { spyOn(classificationCategoriesService, 'getCategories').and.returnValue(of(['firstCategory', 'secondCategory'])); spyOn(classificationsService, 'deleteClassification').and.returnValue(of(true)); spyOn(classificationCategoriesService, 'getCategoryIcon').and.returnValue(new Pair('assets/icons/categories/external.svg')); - component.classification = new ClassificationDefinition('id1', undefined, undefined, undefined, undefined, undefined, undefined, - undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, - undefined, undefined, undefined, undefined, new LinksClassification({ 'self': '' })); + component.classification = new ClassificationDefinition('id1'); + component.classification._links = new LinksClassification({ 'self': '' }); treeService = TestBed.get(TreeService); fixture.detectChanges(); done(); 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 8636580d8..8a3f4ea8a 100644 --- a/web/src/app/administration/classification/details/classification-details.component.ts +++ b/web/src/app/administration/classification/details/classification-details.component.ts @@ -102,18 +102,18 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { this.routeSubscription = this.route.params.subscribe(params => { let id = params['id']; - this.action = undefined; + delete this.action; if (id && id.indexOf('new-classification') !== -1) { this.action = ACTION.CREATE; this.badgeMessage = 'Creating new classification'; id = id.replace('new-classification/', ''); if (id === 'undefined') { - id = undefined; + id = ''; } this.fillClassificationInformation(this.classification ? this.classification : new ClassificationDefinition()) } - if (!this.classification || this.classification.classificationId !== id && id && id !== '') { + if (!this.classification || this.classification.classificationId !== id && id ) { this.selectClassification(id); } }); @@ -140,7 +140,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { } backClicked(): void { - this.classificationsService.selectClassification(undefined); + this.classificationsService.selectClassification(); this.router.navigate(['./'], { relativeTo: this.route.parent }); } @@ -167,8 +167,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { } private initProperties() { - this.classification = undefined; - this.action = undefined + delete this.classification; + delete this.action; } private async onSave() { @@ -287,9 +287,9 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy { .deleteClassification(this.classification._links.self.href) .subscribe(() => { const key = this.classification.key; - this.classification = undefined; + delete this.classification; this.afterRequest(); - this.classificationsService.selectClassification(undefined); + this.classificationsService.selectClassification(); this.router.navigate(['taskana/administration/classifications']); this.alertService.triggerAlert(new AlertModel(AlertType.SUCCESS, `Classification ${key} was removed successfully`)) }, error => { diff --git a/web/src/app/administration/classification/master/list/classification-list.component.ts b/web/src/app/administration/classification/master/list/classification-list.component.ts index 70bbf4bec..abc3f684d 100644 --- a/web/src/app/administration/classification/master/list/classification-list.component.ts +++ b/web/src/app/administration/classification/master/list/classification-list.component.ts @@ -75,10 +75,10 @@ export class ClassificationListComponent implements OnInit, OnDestroy { this.classifications = []; this.categoryService.selectClassificationType(classificationTypeSelected); this.getClassifications(); - this.selectClassification(undefined); + this.selectClassification(); } - selectClassification(id: string) { + selectClassification(id?: string) { this.selectedId = id; if (!id) { this.router.navigate(['taskana/administration/classifications']); @@ -128,7 +128,7 @@ export class ClassificationListComponent implements OnInit, OnDestroy { } - private getClassifications(key: string = undefined) { + private getClassifications(key?: string) { this.requestInProgress = true; this.classificationService.getClassifications() .subscribe((classifications: Array) => { 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 5a6f805fa..6100e60c2 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 @@ -87,7 +87,7 @@ export class ImportExportComponent implements OnInit { break; default: file.value = ''; - this.generalModalService.triggerMessage(new MessageModal(undefined, + this.generalModalService.triggerMessage(new MessageModal('Wrong format', `This file format is not allowed! Please use a .json file.`)); } return check; @@ -133,7 +133,7 @@ export class ImportExportComponent implements OnInit { message ) ); - this.selectedFileInput.files = undefined; + delete this.selectedFileInput.files; this.resetProgress(); } } 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 933803c02..a977f9812 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 @@ -19,7 +19,7 @@ export class IconTypeComponent implements OnInit { tooltip = false; @Input() - text: string = undefined; + text: string; public static get allTypes(): Map { return new Map([['PERSONAL', 'Personal'], ['GROUP', 'Group'], ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']]) 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 dd91607bf..aec6c48dd 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 @@ -42,8 +42,11 @@ describe('AccessItemsComponent', () => { configureTests(configure).then(testBed => { fixture = TestBed.createComponent(AccessItemsComponent); component = fixture.componentInstance; - component.workbasket = new Workbasket('1', '', '', '', ICONTYPES.TOPIC, '', '', '', '', '', '', '', '', '', '', '', '', - new Links(undefined, undefined, { 'href': 'someurl' })); + component.workbasket = new Workbasket('1'); + component.workbasket.type = ICONTYPES.TOPIC; + component.workbasket._links = new Links() + component.workbasket._links.accessItems = { 'href': 'someurl' }; + workbasketService = TestBed.get(WorkbasketService); alertService = TestBed.get(AlertService); spyOn(workbasketService, 'getWorkBasketAccessItems').and.returnValue(of(new WorkbasketAccessItemsResource( 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 8602cb721..243a276a1 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 @@ -123,11 +123,13 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { } addAccessItem() { - const newForm = this.formBuilder.group( - new WorkbasketAccessItems(undefined, this.workbasket.workbasketId, '', '', true)); + const workbasketAccessItems = new WorkbasketAccessItems(); + workbasketAccessItems.workbasketId = this.workbasket.workbasketId; + workbasketAccessItems.permRead = true; + const newForm = this.formBuilder.group(workbasketAccessItems); newForm.controls['accessId'].setValidators(Validators.required); this.accessItemsGroups.push(newForm); - this.accessItemsClone.push(new WorkbasketAccessItems(undefined, this.workbasket.workbasketId, '', '', true)); + this.accessItemsClone.push(workbasketAccessItems); } clear() { @@ -200,7 +202,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { } private setWorkbasketIdForCopy(workbasketId: string) { this.accessItemsGroups.value.forEach(element => { - element.accessItemId = undefined; + delete element.accessItemId; element.workbasketId = workbasketId; }); } 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 ee284780a..00422efae 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 @@ -140,16 +140,16 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy { } performFilter(dualListFilter: any) { - dualListFilter.side === Side.RIGHT ? this.distributionTargetsRight = undefined : this.distributionTargetsLeft = undefined; - this.onRequest(dualListFilter.side, false); - this.workbasketFilterSubscription = this.workbasketService.getWorkBasketsSummary(true, undefined, undefined, undefined, - dualListFilter.filterBy.filterParams.name, dualListFilter.filterBy.filterParams.description, undefined, - dualListFilter.filterBy.filterParams.owner, dualListFilter.filterBy.filterParams.type, undefined, - dualListFilter.filterBy.filterParams.key, undefined, true).subscribe(resultList => { + dualListFilter.side === Side.RIGHT ? delete this.distributionTargetsRight : delete this.distributionTargetsLeft; + 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.key, '', true).subscribe(resultList => { (dualListFilter.side === Side.RIGHT) ? this.distributionTargetsRight = (resultList.workbaskets) : this.distributionTargetsLeft = (resultList.workbaskets); - this.onRequest(dualListFilter.side, true); + this.onRequest(true, dualListFilter.side); }); } @@ -162,7 +162,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy { } private init() { - this.onRequest(undefined); + this.onRequest(); if (!this.workbasket._links.distributionTargets) { return; } @@ -215,9 +215,8 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy { TaskanaQueryParameters.pageSize = this.cards + this.distributionTargetsSelected.length; } - this.workbasketSubscription = this.workbasketService.getWorkBasketsSummary(true, - undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, - undefined, undefined, undefined, false).subscribe( + this.workbasketSubscription = this.workbasketService.getWorkBasketsSummary(true) + .subscribe( (distributionTargetsAvailable: WorkbasketSummaryResource) => { if (TaskanaQueryParameters.page === 1) { this.distributionTargetsLeft = []; @@ -232,7 +231,7 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy { this.distributionTargetsRight = Object.assign([], distributionTargetsAvailable.workbaskets); this.distributionTargetsClone = Object.assign([], distributionTargetsAvailable.workbaskets); } - this.onRequest(undefined, true); + this.onRequest(true); }); } @@ -255,16 +254,16 @@ export class DistributionTargetsComponent implements OnChanges, OnDestroy { return originList; } - private onRequest(side: Side = undefined, finished: boolean = false) { + private onRequest(finished: boolean = false, side?: Side) { if (this.loadingItems) { this.loadingItems = false; } if (finished) { - side === undefined ? (this.requestInProgressLeft = false, this.requestInProgressRight = false) : + typeof side === 'undefined' ? (this.requestInProgressLeft = false, this.requestInProgressRight = false) : side === Side.LEFT ? this.requestInProgressLeft = false : this.requestInProgressRight = false; return; } - side === undefined ? (this.requestInProgressLeft = true, this.requestInProgressRight = true) : + typeof side === 'undefined' ? (this.requestInProgressLeft = true, this.requestInProgressRight = true) : side === Side.LEFT ? this.requestInProgressLeft = true : this.requestInProgressRight = true; } diff --git a/web/src/app/administration/workbasket/details/information/workbasket-information.component.spec.ts b/web/src/app/administration/workbasket/details/information/workbasket-information.component.spec.ts index 91d9da0e8..5263434b4 100644 --- a/web/src/app/administration/workbasket/details/information/workbasket-information.component.spec.ts +++ b/web/src/app/administration/workbasket/details/information/workbasket-information.component.spec.ts @@ -101,7 +101,7 @@ describe('WorkbasketInformationComponent', () => { it('should create a copy of workbasket when workbasket is selected', () => { expect(component.workbasketClone).toBeUndefined(); component.workbasket = new Workbasket('id', 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', - 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'orgLevel3', 'orgLevel4', null); + 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', 'orgLevel3', 'orgLevel4'); component.ngOnChanges( undefined ); @@ -185,12 +185,14 @@ describe('WorkbasketInformationComponent', () => { })); it('should trigger requestInProgress service true before and requestInProgress false after remove a workbasket', () => { + const links = new Links({ 'href': 'someUrl' }); + links.removeDistributionTargets = { 'href': 'someUrl' }; const workbasket = new Workbasket(undefined, 'created', 'keyModified', 'domain', ICONTYPES.TOPIC, 'modified', 'name', 'description', 'owner', 'custom1', 'custom2', 'custom3', 'custom4', 'orgLevel1', 'orgLevel2', - 'orgLevel3', 'orgLevel4', new Links({ 'href': 'someUrl' }, undefined, undefined, undefined, { 'href': 'someUrl' })); + 'orgLevel3', 'orgLevel4', links); component.workbasket = workbasket; - spyOn(workbasketService, 'removeDistributionTarget').and.returnValue(of('')); + spyOn(workbasketService, 'removeDistributionTarget').and.returnValue(of(undefined)); const requestInProgressServiceSpy = spyOn(requestInProgressService, 'setRequestInProgress'); component.removeDistributionTargets(); diff --git a/web/src/app/administration/workbasket/details/workbasket-details.component.ts b/web/src/app/administration/workbasket/details/workbasket-details.component.ts index fbfb10062..2090d53e2 100644 --- a/web/src/app/administration/workbasket/details/workbasket-details.component.ts +++ b/web/src/app/administration/workbasket/details/workbasket-details.component.ts @@ -20,7 +20,7 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { workbasket: Workbasket; workbasketCopy: Workbasket; - selectedId: string = undefined; + selectedId: string; showDetail = false; requestInProgress = false; action: string; @@ -46,32 +46,30 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { ngOnInit() { this.workbasketSelectedSubscription = this.service.getSelectedWorkBasket().subscribe(workbasketIdSelected => { - this.workbasket = undefined; + delete this.workbasket; this.getWorkbasketInformation(workbasketIdSelected); }); this.routeSubscription = this.route.params.subscribe(params => { - let id = params['id']; - this.action = undefined; - if (id && id.indexOf('new-workbasket') !== -1) { - this.tabSelected = 'information'; - this.action = ACTION.CREATE; - id = undefined; - this.getWorkbasketInformation(id); - } else if (id && id.indexOf('copy-workbasket') !== -1) { - if (!this.selectedId) { - this.router.navigate(['./'], { relativeTo: this.route.parent }); - return; + const id = params['id']; + delete this.action; + if (id) { + if (id.indexOf('new-workbasket') !== -1) { + this.tabSelected = 'information'; + this.action = ACTION.CREATE; + this.getWorkbasketInformation(); + } else if (id.indexOf('copy-workbasket') !== -1) { + if (!this.selectedId) { + this.router.navigate(['./'], { relativeTo: this.route.parent }); + return; + } + this.action = ACTION.COPY; + delete this.workbasket.key; + this.workbasketCopy = this.workbasket; + this.getWorkbasketInformation(); + } else { + this.selectWorkbasket(id); } - this.action = ACTION.COPY; - this.workbasket.key = undefined; - this.workbasketCopy = this.workbasket; - id = undefined; - this.getWorkbasketInformation(id, this.selectedId); - } - - if (id && id !== '') { - this.selectWorkbasket(id); } }); @@ -79,13 +77,13 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { this.showDetail = showDetail; }); - this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe((value: Boolean) => { + this.importingExportingSubscription = this.importExportService.getImportingFinished().subscribe(() => { if (this.workbasket) { this.getWorkbasketInformation(this.workbasket.workbasketId); } }) } backClicked(): void { - this.service.selectWorkBasket(undefined); + this.service.selectWorkBasket(); this.router.navigate(['./'], { relativeTo: this.route.parent }); } @@ -98,18 +96,18 @@ export class WorkbasketDetailsComponent implements OnInit, OnDestroy { this.service.selectWorkBasket(id); } - private getWorkbasketInformation(workbasketIdSelected: string, copyId: string = undefined) { + private getWorkbasketInformation(workbasketIdSelected?: string) { this.requestInProgress = true; if (!workbasketIdSelected && this.action === ACTION.CREATE) { // CREATE - this.workbasket = new Workbasket(undefined); + this.workbasket = new Workbasket(); this.domainSubscription = this.domainService.getSelectedDomain().subscribe(domain => { this.workbasket.domain = domain; }); this.requestInProgress = false; } else if (!workbasketIdSelected && this.action === ACTION.COPY) { // COPY this.workbasket = { ...this.workbasketCopy }; - this.workbasket.workbasketId = undefined; + delete this.workbasket.workbasketId; this.requestInProgress = false; } if (workbasketIdSelected) { diff --git a/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts b/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts index b56dd0a0d..2d9a535ac 100644 --- a/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts +++ b/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.spec.ts @@ -65,8 +65,9 @@ describe('WorkbasketListToolbarComponent', () => { debugElement = fixture.debugElement.nativeElement; component = fixture.componentInstance; component.workbaskets = new Array( - new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1', - undefined, undefined, undefined, undefined, undefined, undefined, undefined, false, new Links({ 'href': 'selfLink' }))); + new WorkbasketSummary('1', 'key1', 'NAME1', 'description 1', 'owner 1')); + component.workbaskets[0].markedForDeletion = false; + component.workbaskets[0]._links = new Links({ 'href': 'selfLink' }); fixture.detectChanges(); done(); diff --git a/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.ts b/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.ts index aec180a82..c982b8136 100644 --- a/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.ts +++ b/web/src/app/administration/workbasket/master/workbasket-list-toolbar/workbasket-list-toolbar.component.ts @@ -49,7 +49,7 @@ export class WorkbasketListToolbarComponent implements OnInit { } addWorkbasket() { - this.workbasketService.selectWorkBasket(undefined); + this.workbasketService.selectWorkBasket(); this.router.navigate([{ outlets: { detail: ['new-workbasket'] } }], { relativeTo: this.route }); } diff --git a/web/src/app/administration/workbasket/master/workbasket-list.component.html b/web/src/app/administration/workbasket/master/workbasket-list.component.html index de291620b..48deb44eb 100644 --- a/web/src/app/administration/workbasket/master/workbasket-list.component.html +++ b/web/src/app/administration/workbasket/master/workbasket-list.component.html @@ -36,5 +36,5 @@ - 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 23fc73d24..a47c444a9 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 @@ -53,7 +53,7 @@ const workbasketSummaryResource: WorkbasketSummaryResource = new WorkbasketSumma describe('WorkbasketListComponent', () => { let component: WorkbasketListComponent; let fixture: ComponentFixture; - let debugElement: any = undefined; + let debugElement: any; let workbasketService: WorkbasketService; let workbasketSummarySpy; @@ -167,7 +167,7 @@ describe('WorkbasketListComponent', () => { component.performFilter(filter); expect(workbasketSummarySpy.calls.all()[1].args).toEqual([true, 'key', 'asc', - undefined, 'someName', 'someDescription', undefined, 'someOwner', 'PERSONAL', undefined, 'someKey', undefined]); + '', 'someName', 'someDescription', '', 'someOwner', 'PERSONAL', '', 'someKey', '']); })); diff --git a/web/src/app/administration/workbasket/master/workbasket-list.component.ts b/web/src/app/administration/workbasket/master/workbasket-list.component.ts index 53afa8e25..835cf4057 100644 --- a/web/src/app/administration/workbasket/master/workbasket-list.component.ts +++ b/web/src/app/administration/workbasket/master/workbasket-list.component.ts @@ -104,9 +104,9 @@ export class WorkbasketListComponent implements OnInit, OnDestroy { this.requestInProgress = true; this.workbaskets = []; this.workbasketServiceSubscription = this.workbasketService.getWorkBasketsSummary( - true, this.sort.sortBy, this.sort.sortDirection, undefined, - this.filterBy.filterParams.name, this.filterBy.filterParams.description, undefined, this.filterBy.filterParams.owner, - this.filterBy.filterParams.type, undefined, this.filterBy.filterParams.key, undefined) + true, this.sort.sortBy, this.sort.sortDirection, '', + this.filterBy.filterParams.name, this.filterBy.filterParams.description, '', this.filterBy.filterParams.owner, + this.filterBy.filterParams.type, '', this.filterBy.filterParams.key, '') .subscribe(resultList => { this.workbasketsResource = resultList; this.workbaskets = resultList.workbaskets; diff --git a/web/src/app/history/services/task-query/task-query.service.ts b/web/src/app/history/services/task-query/task-query.service.ts index dd21706eb..c6c6259ac 100644 --- a/web/src/app/history/services/task-query/task-query.service.ts +++ b/web/src/app/history/services/task-query/task-query.service.ts @@ -100,7 +100,7 @@ export class TaskQueryService { parameters.CUSTOM_4_LIKE = custom4; parameters.CREATED = created; - if (allPages) { TaskanaQueryParameters.page = undefined; TaskanaQueryParameters.pageSize = undefined; } + if (allPages) { delete TaskanaQueryParameters.page; delete TaskanaQueryParameters.pageSize; } return TaskanaQueryParameters.getQueryParameters(parameters); } diff --git a/web/src/app/models/access-id.ts b/web/src/app/models/access-id.ts index 16cfb5e4d..2042b731b 100644 --- a/web/src/app/models/access-id.ts +++ b/web/src/app/models/access-id.ts @@ -2,7 +2,7 @@ import { LinksClassification } from 'app/models/links-classfication'; export class AccessIdDefinition { constructor( - public accessId: string = undefined, - public name: string = undefined) { + public accessId?: string, + public name?: string) { } } diff --git a/web/src/app/models/access-item-workbasket-resource.ts b/web/src/app/models/access-item-workbasket-resource.ts index 948f4f1c9..eb5ec699c 100644 --- a/web/src/app/models/access-item-workbasket-resource.ts +++ b/web/src/app/models/access-item-workbasket-resource.ts @@ -4,6 +4,6 @@ import { AccessItemWorkbasket } from './access-item-workbasket'; export class AccessItemsWorkbasketResource { constructor( public accessItems: Array = [], - public _links: Links = undefined + public _links?: Links ) { } } diff --git a/web/src/app/models/access-item-workbasket.ts b/web/src/app/models/access-item-workbasket.ts index 5596cf1d7..0e3a14416 100644 --- a/web/src/app/models/access-item-workbasket.ts +++ b/web/src/app/models/access-item-workbasket.ts @@ -2,9 +2,9 @@ import { Links } from './links'; export class AccessItemWorkbasket { constructor( - public accessItemId: string = '', - public workbasketKey: string = '', - public accessId: string = '', + public accessItemId: string, + public workbasketKey: string, + public accessId: string, public permRead: boolean = false, public permOpen: boolean = false, public permAppend: boolean = false, @@ -22,6 +22,6 @@ export class AccessItemWorkbasket { public permCustom10: boolean = false, public permCustom11: boolean = false, public permCustom12: boolean = false, - public _links: Links = undefined + public _links?: Links ) { } } diff --git a/web/src/app/models/classification-definition.ts b/web/src/app/models/classification-definition.ts index 8ec132848..731cf419c 100644 --- a/web/src/app/models/classification-definition.ts +++ b/web/src/app/models/classification-definition.ts @@ -1,29 +1,29 @@ import { LinksClassification } from 'app/models/links-classfication'; export class ClassificationDefinition { - constructor(public classificationId: string = undefined, - public key: string = undefined, - public parentId: string = undefined, - public parentKey: string = undefined, - public category: string = undefined, - public domain: string = undefined, - public type: string = undefined, - public isValidInDomain: boolean = undefined, - public created: string = undefined, - public modified: string = undefined, - public name: string = undefined, - public description: string = undefined, - public priority: number = undefined, - public serviceLevel: string = undefined, - public applicationEntryPoint: string = undefined, - public custom1: string = undefined, - public custom2: string = undefined, - public custom3: string = undefined, - public custom4: string = undefined, - public custom5: string = undefined, - public custom6: string = undefined, - public custom7: string = undefined, - public custom8: string = undefined, - public _links: LinksClassification = new LinksClassification()) { + constructor(public classificationId?: string, + public key?: string, + public parentId?: string, + public parentKey?: string, + public category?: string, + public domain?: string, + public type?: string, + public isValidInDomain?: boolean, + public created?: string, + public modified?: string, + public name?: string, + public description?: string, + public priority?: number, + public serviceLevel?: string, + public applicationEntryPoint?: string, + public custom1?: string, + public custom2?: string, + public custom3?: string, + public custom4?: string, + public custom5?: string, + public custom6?: string, + public custom7?: string, + public custom8?: string, + public _links?: LinksClassification) { } } diff --git a/web/src/app/models/classification-resource.ts b/web/src/app/models/classification-resource.ts index 746dbc453..0769dd5c7 100644 --- a/web/src/app/models/classification-resource.ts +++ b/web/src/app/models/classification-resource.ts @@ -4,7 +4,7 @@ import { Links } from './links'; export class ClassificationResource { constructor( public classifications: Array = [], - public _links: Links = new Links(), + public _links?: Links ) { } } diff --git a/web/src/app/models/classification.ts b/web/src/app/models/classification.ts index fa0907da9..b492215a6 100644 --- a/web/src/app/models/classification.ts +++ b/web/src/app/models/classification.ts @@ -1,15 +1,15 @@ import {Links} from 'app/models/links'; export class Classification { - constructor(public classificationId: string = undefined, // newly created classifications don't have an id yet. - public key: string = undefined, - public category: string = undefined, - public type: string = undefined, - public domain: string = undefined, - public name: string = undefined, - public parentId: string = undefined, - public priority: number = undefined, - public serviceLevel: string = undefined, - public _links: Links = new Links()) { + constructor(public classificationId?: string, // newly created classifications don't have an id yet. + public key?: string, + public category?: string, + public type?: string, + public domain?: string, + public name?: string, + public parentId?: string, + public priority?: number, + public serviceLevel?: string, + public _links?: Links ) { } } diff --git a/web/src/app/models/links-classfication.ts b/web/src/app/models/links-classfication.ts index 78ae70853..d2e7845ae 100644 --- a/web/src/app/models/links-classfication.ts +++ b/web/src/app/models/links-classfication.ts @@ -2,11 +2,11 @@ import { Links } from './links'; export class LinksClassification extends Links { constructor( - self = undefined, - distributionTargets = undefined, - accessItems = undefined, - public getAllClassifications: { 'href': string } = undefined, - public createClassification: { 'href': string } = undefined, - public updateClassification: { 'href': string } = undefined, + self?, + distributionTargets?, + accessItems?, + public getAllClassifications?: { 'href': string }, + public createClassification?: { 'href': string }, + public updateClassification?: { 'href': string }, ) { super(self, distributionTargets, accessItems) } } diff --git a/web/src/app/models/links-workbasket-summary.ts b/web/src/app/models/links-workbasket-summary.ts index f13b18be1..f4a632637 100644 --- a/web/src/app/models/links-workbasket-summary.ts +++ b/web/src/app/models/links-workbasket-summary.ts @@ -2,9 +2,9 @@ import { Links } from './links'; export class LinksWorkbasketSummary extends Links { constructor( - self = undefined, - distributionTargets = undefined, - accessItems = undefined, - public allWorkbaskets: { 'href': string } = undefined + self?, + distributionTargets?, + accessItems?, + public allWorkbaskets?: { 'href': string } ) { super(self, distributionTargets, accessItems) } } diff --git a/web/src/app/models/links.ts b/web/src/app/models/links.ts index 8fde46b7b..4cef12d93 100644 --- a/web/src/app/models/links.ts +++ b/web/src/app/models/links.ts @@ -1,9 +1,9 @@ export class Links { constructor( - public self: { 'href': string } = undefined, - public distributionTargets: { 'href': string } = undefined, - public accessItems: { 'href': string } = undefined, - public allWorkbasketUrl: { 'href': string } = undefined, - public removeDistributionTargets: {'href': string} = undefined + public self?: { 'href': string }, + public distributionTargets?: { 'href': string }, + public accessItems?: { 'href': string }, + public allWorkbasketUrl?: { 'href': string }, + public removeDistributionTargets?: {'href': string} ) { } } diff --git a/web/src/app/models/message-modal.ts b/web/src/app/models/message-modal.ts index f52ecabbf..213861de0 100644 --- a/web/src/app/models/message-modal.ts +++ b/web/src/app/models/message-modal.ts @@ -1,7 +1,7 @@ export class MessageModal { constructor( - public title: string = undefined, - public message: any = undefined, + public title?: string, + public message?: any, public type = 'error' ) { } } diff --git a/web/src/app/models/page.ts b/web/src/app/models/page.ts index a25f61efe..e969ac427 100644 --- a/web/src/app/models/page.ts +++ b/web/src/app/models/page.ts @@ -1,8 +1,8 @@ export class Page { constructor( - public size: number = undefined, - public totalElements: number = undefined, - public totalPages: number = undefined, - public number: number = undefined + public size?: number, + public totalElements?: number, + public totalPages?: number, + public number?: number ) { } } diff --git a/web/src/app/models/pair.ts b/web/src/app/models/pair.ts index 2e9cae442..b737b6d62 100644 --- a/web/src/app/models/pair.ts +++ b/web/src/app/models/pair.ts @@ -1,6 +1,6 @@ export class Pair { constructor( - public name: string = undefined, - public text: string = undefined, + public name?: string, + public text?: string, ) { } } diff --git a/web/src/app/models/task-history-event-resource.ts b/web/src/app/models/task-history-event-resource.ts index 443002496..9caa68717 100644 --- a/web/src/app/models/task-history-event-resource.ts +++ b/web/src/app/models/task-history-event-resource.ts @@ -3,5 +3,5 @@ import { TaskHistoryEventData } from './task-history-event'; export class TaskHistoryEventResourceData { public taskHistoryEvents: Array - public _links: Links = undefined + public _links: Links = new Links() } diff --git a/web/src/app/models/tree-node.ts b/web/src/app/models/tree-node.ts index fb824c621..7235a8f22 100644 --- a/web/src/app/models/tree-node.ts +++ b/web/src/app/models/tree-node.ts @@ -1,16 +1,16 @@ import { Classification } from 'app/models/classification'; export class TreeNodeModel extends Classification { - constructor(public id: string = '', - public key: string = '', - public category: string = '', - public type: string = '', - public domain: string = '', - public name: string = '', - public parentId: string = '', - public priority: number = 0, - public serviceLevel: string = '', - public children: Array = undefined) { + constructor(public id?: string, + public key?: string, + public category?: string, + public type?: string, + public domain?: string, + public name?: string, + public parentId?: string, + public priority?: number, + public serviceLevel?: string, + public children: Array = []) { super(id, key, category, type, domain, name, parentId, priority, serviceLevel); } } diff --git a/web/src/app/models/user-info.ts b/web/src/app/models/user-info.ts index c0dfeaeae..a85a2e593 100644 --- a/web/src/app/models/user-info.ts +++ b/web/src/app/models/user-info.ts @@ -1,7 +1,7 @@ export class UserInfoModel { constructor( - public userId: string = undefined, + public userId: string = '', public groupIds: Array = [], public roles: Array = []) { }; diff --git a/web/src/app/models/version.ts b/web/src/app/models/version.ts index db7665217..7bcee8e54 100644 --- a/web/src/app/models/version.ts +++ b/web/src/app/models/version.ts @@ -1,6 +1,6 @@ export class VersionModel { constructor( - public version: string = undefined + public version: string = '' ) { }; } diff --git a/web/src/app/models/workbasket-access-items-resource.ts b/web/src/app/models/workbasket-access-items-resource.ts index 03f1e4249..1cb3df651 100644 --- a/web/src/app/models/workbasket-access-items-resource.ts +++ b/web/src/app/models/workbasket-access-items-resource.ts @@ -4,6 +4,6 @@ import { WorkbasketAccessItems } from './workbasket-access-items'; export class WorkbasketAccessItemsResource { constructor( public accessItems: Array = [], - public _links: Links = undefined + public _links: Links = new Links() ) { } } diff --git a/web/src/app/models/workbasket-access-items.ts b/web/src/app/models/workbasket-access-items.ts index edc1ca5e9..b55401dc1 100644 --- a/web/src/app/models/workbasket-access-items.ts +++ b/web/src/app/models/workbasket-access-items.ts @@ -23,6 +23,6 @@ export class WorkbasketAccessItems { public permCustom10: boolean = false, public permCustom11: boolean = false, public permCustom12: boolean = false, - public _links: Links = undefined + public _links: Links = new Links() ) { } } diff --git a/web/src/app/models/workbasket-resource.ts b/web/src/app/models/workbasket-resource.ts index e2effc6b8..7cf2091ba 100644 --- a/web/src/app/models/workbasket-resource.ts +++ b/web/src/app/models/workbasket-resource.ts @@ -4,5 +4,5 @@ import { Workbasket } from './workbasket'; export class WorkbasketResource { constructor( public workbaskets: Array = [], - public _links: Links = undefined) { } + public _links: Links = new Links() ) { } } diff --git a/web/src/app/models/workbasket-summary.ts b/web/src/app/models/workbasket-summary.ts index 44baf6221..464cd13cb 100644 --- a/web/src/app/models/workbasket-summary.ts +++ b/web/src/app/models/workbasket-summary.ts @@ -4,20 +4,20 @@ import { Links } from './links'; export class WorkbasketSummary { constructor( - public workbasketId: string = undefined, - public key: string = undefined, - public name: string = undefined, - public description: string = undefined, - public owner: string = undefined, - public modified: string = undefined, - public domain: string = undefined, + public workbasketId?: string, + public key?: string, + public name?: string, + public description?: string, + public owner?: string, + public modified?: string, + public domain?: string, public type: string = ICONTYPES.PERSONAL, - public orgLevel1: string = undefined, - public orgLevel2: string = undefined, - public orgLevel3: string = undefined, - public orgLevel4: string = undefined, + public orgLevel1?: string, + public orgLevel2?: string, + public orgLevel3?: string, + public orgLevel4?: string, public markedForDeletion: boolean = false, - public _links: Links = undefined, - public page: Page = undefined) { + public _links?: Links, + public page?: Page ) { } } diff --git a/web/src/app/models/workbasket.ts b/web/src/app/models/workbasket.ts index aaaae7b2e..40898c2b9 100644 --- a/web/src/app/models/workbasket.ts +++ b/web/src/app/models/workbasket.ts @@ -25,23 +25,23 @@ export class Workbasket { } constructor( - public workbasketId: string, - public created: string = undefined, - public key: string = undefined, - public domain: string = undefined, + public workbasketId?: string, + public created?: string, + public key?: string, + public domain?: string, public type: ICONTYPES = ICONTYPES.PERSONAL, - public modified: string = undefined, - public name: string = undefined, - public description: string = undefined, - public owner: string = undefined, - public custom1: string = undefined, - public custom2: string = undefined, - public custom3: string = undefined, - public custom4: string = undefined, - public orgLevel1: string = undefined, - public orgLevel2: string = undefined, - public orgLevel3: string = undefined, - public orgLevel4: string = undefined, + public modified?: string, + public name?: string, + public description?: string, + public owner?: string, + public custom1?: string, + public custom2?: string, + public custom3?: string, + public custom4?: string, + public orgLevel1?: string, + public orgLevel2?: string, + public orgLevel3?: string, + public orgLevel4?: string, public _links: Links = new Links()) { } } 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 dbbaf36a5..f8a89c4ae 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 @@ -15,7 +15,7 @@ describe('CustomFieldsService', () => { it('should take default icon path', inject([CustomFieldsService], (service: CustomFieldsService) => { const categoriesData = {'DEFAULT': 'assets/icons/categories/default.svg'} - const returnedValue = service.getCustomObject(categoriesData, undefined); + const returnedValue = service.getCustomObject(categoriesData); expect(returnedValue).toBe(categoriesData); expect(service).toBeTruthy(); })); 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 0e201dc4f..029d84150 100644 --- a/web/src/app/services/custom-fields/custom-fields.service.ts +++ b/web/src/app/services/custom-fields/custom-fields.service.ts @@ -10,14 +10,14 @@ export class CustomFieldsService { this.customizedFields = jsonFile[language]; } - getCustomField(fallbacktext: string, customPath: string = undefined): CustomField { + getCustomField(fallbacktext: string, customPath?: string): CustomField { if (!customPath) { return new CustomField(true, fallbacktext) } return this.jsonPath(customPath, fallbacktext); } - getCustomObject(fallbackObject: Object, customPath: string = undefined): Object { + getCustomObject(fallbackObject: Object, customPath?: string): Object { if (!customPath) { return fallbackObject; } diff --git a/web/src/app/services/domain/domain.service.ts b/web/src/app/services/domain/domain.service.ts index 1bcd3cb97..96a7e5276 100644 --- a/web/src/app/services/domain/domain.service.ts +++ b/web/src/app/services/domain/domain.service.ts @@ -46,7 +46,7 @@ export class DomainService { this.domainRestValue = domains; this.domainValue = domains; this.dataObs$.next(this.hasMasterDomain ? this.addEmptyDomain(domains) : domains); - if (this.domainSelectedValue === undefined && this.domainValue.length > 0) { + if (!this.domainSelectedValue && this.domainValue.length > 0) { this.selectDomain(this.domainValue[0]); } }, diff --git a/web/src/app/services/orientation/orientation.service.ts b/web/src/app/services/orientation/orientation.service.ts index 89f981b86..755ac9d27 100644 --- a/web/src/app/services/orientation/orientation.service.ts +++ b/web/src/app/services/orientation/orientation.service.ts @@ -7,7 +7,7 @@ import { TaskanaQueryParameters } from 'app/shared/util/query-parameters'; export class OrientationService { private lock = false; - private currentOrientation = undefined; + private currentOrientation; public orientation = new BehaviorSubject(this.currentOrientation); constructor() { } diff --git a/web/src/app/services/selected-route/selected-route.ts b/web/src/app/services/selected-route/selected-route.ts index 7e78acd81..81a3a1495 100644 --- a/web/src/app/services/selected-route/selected-route.ts +++ b/web/src/app/services/selected-route/selected-route.ts @@ -21,7 +21,7 @@ export class SelectedRouteService { } private getRoute(event): string { - if (event === undefined) { + if (!event) { return this.checkUrl(this.router.url); } return this.checkUrl(event.url) diff --git a/web/src/app/services/titles/titles.service.ts b/web/src/app/services/titles/titles.service.ts index cc0ed18d0..d5cdf885a 100644 --- a/web/src/app/services/titles/titles.service.ts +++ b/web/src/app/services/titles/titles.service.ts @@ -11,7 +11,7 @@ export class TitlesService { this.titles = jsonFile[language]; } - getTitle(id: number, fallBacktext: string, customPath: string = undefined) { + getTitle(id: number, fallBacktext: string, customPath?: string) { return this.titles[id] ? this.titles[id] : fallBacktext } diff --git a/web/src/app/shared/alert/alert.component.ts b/web/src/app/shared/alert/alert.component.ts index 1ef2057f9..3c14f9130 100644 --- a/web/src/app/shared/alert/alert.component.ts +++ b/web/src/app/shared/alert/alert.component.ts @@ -26,7 +26,7 @@ export class AlertComponent implements OnInit { setTimeOutForClosing(time: number) { setTimeout(() => { - this.alert = undefined; + delete this.alert; }, time); } } 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 f8b70b050..0668c37c0 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 @@ -7,9 +7,10 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; }) export class ClassificationTypesSelectorComponent implements OnInit { - @Input() classificationTypes: Array = []; @Input() - classificationTypeSelected: string = undefined; + classificationTypes: Array = []; + @Input() + classificationTypeSelected: string; @Output() classificationTypeSelectedChange = new EventEmitter(); @Output() diff --git a/web/src/app/shared/master-and-detail/master-and-detail.component.ts b/web/src/app/shared/master-and-detail/master-and-detail.component.ts index 41fb86a75..48ebe5a7b 100644 --- a/web/src/app/shared/master-and-detail/master-and-detail.component.ts +++ b/web/src/app/shared/master-and-detail/master-and-detail.component.ts @@ -35,7 +35,7 @@ export class MasterAndDetailComponent implements OnInit { } private showDetails(event?: RouterEvent): boolean { - if (event === undefined) { + if (!event) { return this.checkUrl(this.router.url); } return this.checkUrl(event.url) 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 709767533..a0f8ff34e 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 @@ -31,8 +31,8 @@ export class AccessIdsService { getAccessItemsPermissions( accessIds: Array, - accessIdLike: string = undefined, - workbasketKeyLike: string = undefined, + accessIdLike?: string, + workbasketKeyLike?: string, sortModel: SortingModel = new SortingModel('workbasket-key'), forceRequest: boolean = false): Observable { @@ -55,8 +55,8 @@ export class AccessIdsService { private accessIdsParameters( sortModel: SortingModel, accessIds: Array, - accessIdLike: string = undefined, - workbasketKeyLike: string = undefined): QueryParametersModel { + accessIdLike?: string, + workbasketKeyLike?: string ): QueryParametersModel { const parameters = new QueryParametersModel(); parameters.SORTBY = sortModel.sortBy; @@ -66,8 +66,8 @@ export class AccessIdsService { }).join('|'); parameters.ACCESSIDLIKE = accessIdLike; parameters.WORKBASKETKEYLIKE = workbasketKeyLike; - TaskanaQueryParameters.page = undefined; - TaskanaQueryParameters.pageSize = undefined; + delete TaskanaQueryParameters.page; + delete TaskanaQueryParameters.pageSize; return parameters; } } diff --git a/web/src/app/shared/services/classifications/classifications.service.ts b/web/src/app/shared/services/classifications/classifications.service.ts index 1c7bc662d..ae67de061 100644 --- a/web/src/app/shared/services/classifications/classifications.service.ts +++ b/web/src/app/shared/services/classifications/classifications.service.ts @@ -79,7 +79,7 @@ export class ClassificationsService { } // #region "Service extras" - selectClassification(classification: ClassificationDefinition) { + selectClassification(classification?: ClassificationDefinition) { this.classificationSelected.next(classification); } @@ -103,8 +103,8 @@ export class ClassificationsService { parameters.SORTBY = TaskanaQueryParameters.parameters.KEY; parameters.SORTDIRECTION = Direction.ASC; parameters.DOMAIN = domain; - TaskanaQueryParameters.page = undefined; - TaskanaQueryParameters.pageSize = undefined; + delete TaskanaQueryParameters.page; + delete TaskanaQueryParameters.pageSize; return parameters; } diff --git a/web/src/app/shared/services/workbasket/workbasket.service.ts b/web/src/app/shared/services/workbasket/workbasket.service.ts index 150f5ba80..c37aa4827 100644 --- a/web/src/app/shared/services/workbasket/workbasket.service.ts +++ b/web/src/app/shared/services/workbasket/workbasket.service.ts @@ -33,15 +33,15 @@ export class WorkbasketService { getWorkBasketsSummary(forceRequest: boolean = false, sortBy: string = TaskanaQueryParameters.parameters.KEY, order: string = Direction.ASC, - name: string = undefined, - nameLike: string = undefined, - descLike: string = undefined, - owner: string = undefined, - ownerLike: string = undefined, - type: string = undefined, - key: string = undefined, - keyLike: string = undefined, - requiredPermission: string = undefined, + name?: string, + nameLike?: string, + descLike?: string, + owner?: string, + ownerLike?: string, + type?: string, + key?: string, + keyLike?: string, + requiredPermission?: string, allPages: boolean = false) { if (this.workbasketSummaryRef && !forceRequest) { @@ -121,7 +121,7 @@ export class WorkbasketService { // #endregion // #region "Service extras" - selectWorkBasket(id: string) { + selectWorkBasket(id?: string) { this.workBasketSelected.next(id); } @@ -158,17 +158,17 @@ export class WorkbasketService { private workbasketParameters( sortBy: string = TaskanaQueryParameters.parameters.KEY, order: string = Direction.ASC, - name: string = undefined, - nameLike: string = undefined, - descLike: string = undefined, - owner: string = undefined, - ownerLike: string = undefined, - type: string = undefined, - key: string = undefined, - keyLike: string = undefined, - requiredPermission: string = undefined, - allPages: boolean = false, - domain: string = ''): QueryParametersModel { + name?: string, + nameLike?: string, + descLike?: string, + owner?: string, + ownerLike?: string, + type?: string, + key?: string, + keyLike?: string, + requiredPermission?: string, + allPages?: boolean, + domain?: string): QueryParametersModel { const parameters = new QueryParametersModel(); parameters.SORTBY = sortBy; @@ -184,8 +184,8 @@ export class WorkbasketService { parameters.REQUIREDPERMISSION = requiredPermission; parameters.DOMAIN = domain; if (allPages) { - TaskanaQueryParameters.page = undefined; - TaskanaQueryParameters.pageSize = undefined; + delete TaskanaQueryParameters.page; + delete TaskanaQueryParameters.pageSize; } return parameters; } diff --git a/web/src/app/shared/spinner/spinner.component.ts b/web/src/app/shared/spinner/spinner.component.ts index cc5c6a19f..b60e643f8 100644 --- a/web/src/app/shared/spinner/spinner.component.ts +++ b/web/src/app/shared/spinner/spinner.component.ts @@ -45,7 +45,7 @@ export class SpinnerComponent implements OnDestroy { isModal = false; @Input() - positionClass: string = undefined; + positionClass: string; @Output() spinnerIsRunning = new EventEmitter(); @@ -81,8 +81,8 @@ export class SpinnerComponent implements OnDestroy { private cancelTimeout(): void { clearTimeout(this.currentTimeout); clearTimeout(this.requestTimeout); - this.currentTimeout = undefined; - this.requestTimeout = undefined; + delete this.currentTimeout; // do we need this? + delete this.requestTimeout; } ngOnDestroy(): any { diff --git a/web/src/app/shared/tree/tree.component.ts b/web/src/app/shared/tree/tree.component.ts index d331547ae..c2c63951c 100644 --- a/web/src/app/shared/tree/tree.component.ts +++ b/web/src/app/shared/tree/tree.component.ts @@ -106,7 +106,7 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy } onDeactivate(treeNode: any) { - this.selectNodeIdChanged.emit(undefined); + this.selectNodeIdChanged.emit(); } async onMoveNode($event) { @@ -145,7 +145,7 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked, OnDestroy private unSelectActiveNode() { const activeNode = this.tree.treeModel.getActiveNode(); - this.selectNodeId = undefined; + delete this.selectNodeId; activeNode.setIsActive(false); activeNode.blur(); } 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 ee8338841..28df92652 100644 --- a/web/src/app/shared/type-ahead/type-ahead.component.ts +++ b/web/src/app/shared/type-ahead/type-ahead.component.ts @@ -56,7 +56,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor { typeaheadOptionsInScrollableView = 6; // The internal data model - private innerValue: any = undefined; + private innerValue: any; // Placeholders for the callbacks which are later provided // by the Control Value Accessor diff --git a/web/src/app/shared/util/query-parameters.spec.ts b/web/src/app/shared/util/query-parameters.spec.ts index a64948345..080e7f1c0 100644 --- a/web/src/app/shared/util/query-parameters.spec.ts +++ b/web/src/app/shared/util/query-parameters.spec.ts @@ -10,8 +10,8 @@ describe('TaskanaQueryParameters', () => { }) it('should create a empty query', () => { - TaskanaQueryParameters.page = undefined; - TaskanaQueryParameters.pageSize = undefined; + delete TaskanaQueryParameters.page; + delete TaskanaQueryParameters.pageSize; expect(TaskanaQueryParameters.getQueryParameters(new QueryParametersModel())).toBe('?'); TaskanaQueryParameters.page = 1; TaskanaQueryParameters.pageSize = 9; diff --git a/web/src/app/workplace/models/object-reference.ts b/web/src/app/workplace/models/object-reference.ts index 7b58a3f3c..1a89243a7 100644 --- a/web/src/app/workplace/models/object-reference.ts +++ b/web/src/app/workplace/models/object-reference.ts @@ -1,9 +1,9 @@ export class ObjectReference { - constructor(public id: string = undefined, - public company: string = undefined, - public system: string = undefined, - public systemInstance: string = undefined, - public type: string = undefined, - public value: string = undefined) { + constructor(public id?: string, + public company?: string, + public system?: string, + public systemInstance?: string, + public type?: string, + public value?: string) { } } diff --git a/web/src/app/workplace/models/task-resource.ts b/web/src/app/workplace/models/task-resource.ts index 38073c9f3..a23055c62 100644 --- a/web/src/app/workplace/models/task-resource.ts +++ b/web/src/app/workplace/models/task-resource.ts @@ -4,6 +4,6 @@ import { Page } from 'app/models/page'; export class TaskResource { constructor(public tasks: Array, - public _links: Links = undefined, + public _links?: Links, public page: Page = new Page()) {} } diff --git a/web/src/app/workplace/models/task.ts b/web/src/app/workplace/models/task.ts index b7d8871b1..98ef2e695 100644 --- a/web/src/app/workplace/models/task.ts +++ b/web/src/app/workplace/models/task.ts @@ -4,44 +4,44 @@ import {ObjectReference} from './object-reference'; export class Task { constructor(public taskId: string, - public primaryObjRef: ObjectReference = undefined, - public workbasketSummaryResource: Workbasket = undefined, - public classificationSummaryResource: Classification = undefined, - public businessProcessId: string = undefined, - public parentBusinessProcessId: string = undefined, - public owner: string = undefined, - public created: string = undefined, // ISO-8601 - public claimed: string = undefined, // ISO-8601 - public completed: string = undefined, // ISO-8601 - public modified: string = undefined, // ISO-8601 - public planned: string = undefined, // ISO-8601 - public due: string = undefined, // ISO-8601 - public name: string = undefined, - public creator: string = undefined, - public description: string = undefined, - public note: string = undefined, - public state: any = undefined, - public read: boolean = undefined, - public transferred: boolean = undefined, - public priority: number = undefined, + public primaryObjRef: ObjectReference = new ObjectReference(), + public workbasketSummaryResource?: Workbasket, + public classificationSummaryResource?: Classification, + public businessProcessId?: string, + public parentBusinessProcessId?: string, + public owner?: string, + public created?: string, // ISO-8601 + public claimed?: string, // ISO-8601 + public completed?: string, // ISO-8601 + public modified?: string, // ISO-8601 + public planned?: string, // ISO-8601 + public due?: string, // ISO-8601 + public name?: string, + public creator?: string, + public description?: string, + public note?: string, + public state?: any, + public read?: boolean, + public transferred?: boolean, + public priority?: number, public customAttributes: Array = [], public callbackInfo: Array = [], - public custom1: string = undefined, - public custom2: string = undefined, - public custom3: string = undefined, - public custom4: string = undefined, - public custom5: string = undefined, - public custom6: string = undefined, - public custom7: string = undefined, - public custom8: string = undefined, - public custom9: string = undefined, - public custom10: string = undefined, - public custom11: string = undefined, - public custom12: string = undefined, - public custom13: string = undefined, - public custom14: string = undefined, - public custom15: string = undefined, - public custom16: string = undefined) { + public custom1?: string, + public custom2?: string, + public custom3?: string, + public custom4?: string, + public custom5?: string, + public custom6?: string, + public custom7?: string, + public custom8?: string, + public custom9?: string, + public custom10?: string, + public custom11?: string, + public custom12?: string, + public custom13?: string, + public custom14?: string, + public custom15?: string, + public custom16?: string) { } } diff --git a/web/src/app/workplace/services/task.service.ts b/web/src/app/workplace/services/task.service.ts index 092f84f51..f5d5ffdd1 100644 --- a/web/src/app/workplace/services/task.service.ts +++ b/web/src/app/workplace/services/task.service.ts @@ -23,11 +23,11 @@ export class TaskService { constructor(private httpClient: HttpClient) { } - publishUpdatedTask(task: Task = undefined) { + publishUpdatedTask(task: Task = new Task('empty')) { this.taskChangedSource.next(task); } - selectTask(task: Task) { + selectTask(task?: Task) { this.taskSelectedSource.next(task); } @@ -121,8 +121,8 @@ export class TaskService { parameters.TASK_PRIMARY_OBJ_REF_TYPE_LIKE = objRefTypeLike; parameters.TASK_PRIMARY_OBJ_REF_VALUE_LIKE = objRefValueLike; if (allPages) { - TaskanaQueryParameters.page = undefined; - TaskanaQueryParameters.pageSize = undefined; + delete TaskanaQueryParameters.page; + delete TaskanaQueryParameters.pageSize; } return parameters; diff --git a/web/src/app/workplace/services/workplace.service.ts b/web/src/app/workplace/services/workplace.service.ts index b80b1f8c0..2e03038f0 100644 --- a/web/src/app/workplace/services/workplace.service.ts +++ b/web/src/app/workplace/services/workplace.service.ts @@ -13,7 +13,7 @@ export class WorkplaceService { private objectReferenceSource = new Subject(); objectReferenceSelectedStream = this.objectReferenceSource.asObservable(); - selectWorkbasket(workbasket: Workbasket) { + selectWorkbasket(workbasket?: Workbasket) { this.currentWorkbasket = workbasket; this.workbasketSelectedSource.next(workbasket); } @@ -22,11 +22,11 @@ export class WorkplaceService { return this.workbasketSelectedStream; } - selectObjectReference(objectReference: ObjectReference) { + selectObjectReference(objectReference?: ObjectReference) { + this.objectReference = new ObjectReference(); if (objectReference) { - this.objectReference = new ObjectReference(undefined, undefined, undefined, undefined, objectReference.type, objectReference.value); - } else { - this.objectReference = new ObjectReference(undefined); + this.objectReference.type = objectReference.type; + this.objectReference.value = objectReference.value; } this.objectReferenceSource.next(objectReference); } diff --git a/web/src/app/workplace/taskdetails/general/general-fields.component.ts b/web/src/app/workplace/taskdetails/general/general-fields.component.ts index 5c5f9f842..7301be9c1 100644 --- a/web/src/app/workplace/taskdetails/general/general-fields.component.ts +++ b/web/src/app/workplace/taskdetails/general/general-fields.component.ts @@ -27,7 +27,7 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges { toogleValidationMap = new Map(); requestInProgress = false; - classifications: Classification[] = undefined; + classifications: Classification[]; ownerField = this.customFieldsService.getCustomField( 'Owner', diff --git a/web/src/app/workplace/taskdetails/taskdetails.component.ts b/web/src/app/workplace/taskdetails/taskdetails.component.ts index 208571a92..89e95cc4b 100644 --- a/web/src/app/workplace/taskdetails/taskdetails.component.ts +++ b/web/src/app/workplace/taskdetails/taskdetails.component.ts @@ -23,12 +23,12 @@ import {MasterAndDetailService} from 'app/services/masterAndDetail/master-and-de styleUrls: ['./taskdetails.component.scss'] }) export class TaskdetailsComponent implements OnInit, OnDestroy { - task: Task = undefined; - taskClone: Task = undefined; + task: Task; + taskClone: Task; requestInProgress = false; tabSelected = 'general'; - currentWorkbasket: Workbasket = undefined; - currentId: string = undefined; + currentWorkbasket: Workbasket; + currentId: string; showDetail = false; private routeSubscription: Subscription; @@ -77,7 +77,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { this.requestInProgress = true; if (this.currentId === 'new-task') { this.requestInProgress = false; - this.task = new Task(undefined, new ObjectReference(), this.currentWorkbasket); + this.task = new Task('', new ObjectReference(), this.currentWorkbasket); } else { this.taskService.getTask(this.currentId).subscribe(task => { this.requestInProgress = false; @@ -124,7 +124,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { } backClicked(): void { - this.task = undefined; + delete this.task; this.taskService.selectTask(this.task); this.router.navigate(['./'], {relativeTo: this.route.parent}); } diff --git a/web/src/app/workplace/taskmaster/task-list-toolbar/task-list-toolbar.component.ts b/web/src/app/workplace/taskmaster/task-list-toolbar/task-list-toolbar.component.ts index 2223d18f5..a639ba081 100644 --- a/web/src/app/workplace/taskmaster/task-list-toolbar/task-list-toolbar.component.ts +++ b/web/src/app/workplace/taskmaster/task-list-toolbar/task-list-toolbar.component.ts @@ -83,11 +83,13 @@ export class TaskListToolbarComponent implements OnInit { this.toolbarState = false; this.workbasketSelected = true; if (this.searchSelected === this.search.byTypeAndValue) { - this.workplaceService.selectObjectReference( - new ObjectReference(undefined, undefined, undefined, undefined, this.resultType, this.resultValue)); - this.searched = true; + const objectReference = new ObjectReference(); + objectReference.type = this.resultType; + objectReference.value = this.resultValue; + this.workplaceService.selectObjectReference(objectReference); + this.searched = true; } else { - this.workplaceService.selectObjectReference(undefined); + this.workplaceService.selectObjectReference(); if (this.workbaskets) { this.workbaskets.forEach(workbasket => { if (workbasket.name === this.resultName) { @@ -99,8 +101,8 @@ export class TaskListToolbarComponent implements OnInit { }); if (!this.resultId) { - this.currentBasket = undefined; - this.workplaceService.selectWorkbasket(undefined); + delete this.currentBasket; + this.workplaceService.selectWorkbasket(); } } } @@ -118,14 +120,14 @@ export class TaskListToolbarComponent implements OnInit { } createTask() { - this.taskService.selectTask(undefined); + this.taskService.selectTask(); this.router.navigate([{ outlets: { detail: 'taskdetail/new-task' } }], { relativeTo: this.route }); } selectSearch(type: Search) { this.searched = false; - this.resultId = undefined; - this.currentBasket = undefined; + delete this.resultId; + delete this.currentBasket; this.selectSearchType.emit(type); this.searchSelected = type; diff --git a/web/src/app/workplace/taskmaster/task-list/task-list.component.ts b/web/src/app/workplace/taskmaster/task-list/task-list.component.ts index 675d234e0..3b33620d2 100644 --- a/web/src/app/workplace/taskmaster/task-list/task-list.component.ts +++ b/web/src/app/workplace/taskmaster/task-list/task-list.component.ts @@ -30,7 +30,7 @@ export class TaskListComponent implements OnInit { } selectTask(taskId: string) { - this.workplaceService.selectObjectReference(undefined); + this.workplaceService.selectObjectReference(); this.selectedId = taskId; this.selectedIdChange.emit(taskId); this.router.navigate([{outlets: {detail: `taskdetail/${this.selectedId}`}}], {relativeTo: this.route}); diff --git a/web/src/app/workplace/taskmaster/task-master.component.ts b/web/src/app/workplace/taskmaster/task-master.component.ts index 4a799f542..5f4613d0b 100644 --- a/web/src/app/workplace/taskmaster/task-master.component.ts +++ b/web/src/app/workplace/taskmaster/task-master.component.ts @@ -56,7 +56,7 @@ export class TaskMasterComponent implements OnInit, OnDestroy { private orientationService: OrientationService) { this.taskChangeSubscription = this.taskService.taskChangedStream.subscribe(task => { this.getTasks(); - this.selectedId = task ? task.taskId : undefined; + this.selectedId = task ? task.taskId : ''; }); this.workbasketChangeSubscription = this.workplaceService.workbasketSelectedStream.subscribe(workbasket => { @@ -68,7 +68,7 @@ export class TaskMasterComponent implements OnInit, OnDestroy { this.objectReferenceSubscription = this.workplaceService.objectReferenceSelectedStream.subscribe(objectReference => { this.objectReference = objectReference; - this.currentBasket = undefined; + delete this.currentBasket; if (objectReference) { this.getTasks(); } @@ -83,7 +83,7 @@ export class TaskMasterComponent implements OnInit, OnDestroy { this.currentBasket = task.workbasketSummaryResource; } if (!task) { - this.selectedId = undefined; + this.selectedId = ''; } }); this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => { @@ -131,15 +131,15 @@ export class TaskMasterComponent implements OnInit, OnDestroy { private getTasks(): void { this.requestInProgress = true; - if (this.currentBasket === undefined && !this.objectReference) { + if (!this.currentBasket && !this.objectReference) { this.requestInProgress = false; this.tasks = []; } else { this.calculateHeightCard(); - this.taskService.findTasksWithWorkbasket(this.currentBasket ? this.currentBasket.workbasketId : undefined, + this.taskService.findTasksWithWorkbasket(this.currentBasket ? this.currentBasket.workbasketId : '', this.sort.sortBy, this.sort.sortDirection, this.filterBy.filterParams.name, this.filterBy.filterParams.owner, - this.filterBy.filterParams.priority, this.filterBy.filterParams.state, this.objectReference ? this.objectReference.type : undefined, - this.objectReference ? this.objectReference.value : undefined) + this.filterBy.filterParams.priority, this.filterBy.filterParams.state, this.objectReference ? this.objectReference.type : '', + this.objectReference ? this.objectReference.value : '') .subscribe(tasks => { this.requestInProgress = false; if (tasks.tasks) {