diff --git a/web/src/app/workplace/components/taskdetails-general/general-fields.component.html b/web/src/app/workplace/components/taskdetails-general/general-fields.component.html index e462b5cda..f0e8818f4 100644 --- a/web/src/app/workplace/components/taskdetails-general/general-fields.component.html +++ b/web/src/app/workplace/components/taskdetails-general/general-fields.component.html @@ -82,6 +82,9 @@ + +
diff --git a/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts b/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts index 61230a29a..6081df054 100644 --- a/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts +++ b/web/src/app/workplace/components/taskdetails-general/general-fields.component.ts @@ -7,7 +7,6 @@ import { ViewChild, SimpleChanges, OnChanges, - HostListener, OnDestroy } from '@angular/core'; import { Task } from 'app/workplace/models/task'; @@ -44,6 +43,7 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges, OnD toggleValidationMap = new Map(); requestInProgress = false; classifications: Classification[]; + isClassificationEmpty: boolean; readonly lengthError = 'You have reached the maximum length'; inputOverflowMap = new Map(); @@ -77,11 +77,6 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges, OnD } } - ngOnDestroy() { - this.destroy$.next(); - this.destroy$.complete(); - } - isFieldValid(field: string): boolean { return this.formsValidatorService.isFieldValid(this.taskForm, field); } @@ -92,24 +87,33 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges, OnD } } + changedClassification(itemSelected: Classification) { + this.task.classificationSummary = itemSelected; + this.isClassificationEmpty = false; + } + private validate() { + this.isClassificationEmpty = typeof this.task.classificationSummary === 'undefined'; this.formsValidatorService.formSubmitAttempt = true; this.formsValidatorService.validateFormInformation(this.taskForm, this.toggleValidationMap).then((value) => { - if (value) { + if (value && !this.isClassificationEmpty) { this.formValid.emit(true); } }); } - changedClassification(itemSelected: Classification) { - this.task.classificationSummary = itemSelected; - } - - private async getClassificationByDomain() { + private getClassificationByDomain() { this.requestInProgress = true; - this.classifications = ( - await this.classificationService.getClassificationsByDomain(this.domainService.getSelectedDomainValue()) - ).classifications; + this.classificationService + .getClassificationsByDomain(this.domainService.getSelectedDomainValue()) + .then((classificationPagingList) => { + this.classifications = classificationPagingList.classifications; + }); this.requestInProgress = false; } + + ngOnDestroy() { + this.destroy$.next(); + this.destroy$.complete(); + } } diff --git a/web/src/app/workplace/components/taskdetails/taskdetails.component.html b/web/src/app/workplace/components/taskdetails/taskdetails.component.html index 2ab945bbb..29dfead20 100644 --- a/web/src/app/workplace/components/taskdetails/taskdetails.component.html +++ b/web/src/app/workplace/components/taskdetails/taskdetails.component.html @@ -40,7 +40,7 @@ 'expand_more' : 'expand_less'}} + (formValid)="onSave()"> diff --git a/web/src/app/workplace/components/taskdetails/taskdetails.component.ts b/web/src/app/workplace/components/taskdetails/taskdetails.component.ts index 1cf38ad67..b812292b7 100644 --- a/web/src/app/workplace/components/taskdetails/taskdetails.component.ts +++ b/web/src/app/workplace/components/taskdetails/taskdetails.component.ts @@ -88,10 +88,6 @@ export class TaskdetailsComponent implements OnInit, OnDestroy { } } - onSubmit() { - this.onSave(); - } - openTask() { this.router.navigate([{ outlets: { detail: `task/${this.currentId}` } }], { relativeTo: this.route.parent }); }