TSK-1371: Inform user about empty classification when creating a task
This commit is contained in:
parent
9acf972734
commit
9103508596
|
@ -82,6 +82,9 @@
|
|||
<taskana-shared-dropdown [list]="classifications" (performClassification)="changedClassification($event)"
|
||||
[itemSelected]="task?.classificationSummary"
|
||||
id="classification"></taskana-shared-dropdown>
|
||||
<taskana-shared-field-error-display [displayError]="isClassificationEmpty"
|
||||
errorMessage="* Classification is required">
|
||||
</taskana-shared-field-error-display>
|
||||
</div>
|
||||
<div class="form-group col-xs-4">
|
||||
<label for="task-due" class="control-label">Due date</label>
|
||||
|
|
|
@ -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<string, boolean>();
|
||||
requestInProgress = false;
|
||||
classifications: Classification[];
|
||||
isClassificationEmpty: boolean;
|
||||
|
||||
readonly lengthError = 'You have reached the maximum length';
|
||||
inputOverflowMap = new Map<string, boolean>();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
'expand_more' : 'expand_less'}}</span>
|
||||
</button>
|
||||
<taskana-task-details-general-fields [task]="task" [saveToggleTriggered]="toggleFormValidation"
|
||||
(formValid)="onSubmit()"></taskana-task-details-general-fields>
|
||||
(formValid)="onSave()"></taskana-task-details-general-fields>
|
||||
</accordion-group>
|
||||
<!--Status Details-->
|
||||
<accordion-group panelClass="customClass" (isOpenChange)="accordion2State = $event">
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue