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)"
|
<taskana-shared-dropdown [list]="classifications" (performClassification)="changedClassification($event)"
|
||||||
[itemSelected]="task?.classificationSummary"
|
[itemSelected]="task?.classificationSummary"
|
||||||
id="classification"></taskana-shared-dropdown>
|
id="classification"></taskana-shared-dropdown>
|
||||||
|
<taskana-shared-field-error-display [displayError]="isClassificationEmpty"
|
||||||
|
errorMessage="* Classification is required">
|
||||||
|
</taskana-shared-field-error-display>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-xs-4">
|
<div class="form-group col-xs-4">
|
||||||
<label for="task-due" class="control-label">Due date</label>
|
<label for="task-due" class="control-label">Due date</label>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import {
|
||||||
ViewChild,
|
ViewChild,
|
||||||
SimpleChanges,
|
SimpleChanges,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
HostListener,
|
|
||||||
OnDestroy
|
OnDestroy
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Task } from 'app/workplace/models/task';
|
import { Task } from 'app/workplace/models/task';
|
||||||
|
|
@ -44,6 +43,7 @@ export class TaskdetailsGeneralFieldsComponent implements OnInit, OnChanges, OnD
|
||||||
toggleValidationMap = new Map<string, boolean>();
|
toggleValidationMap = new Map<string, boolean>();
|
||||||
requestInProgress = false;
|
requestInProgress = false;
|
||||||
classifications: Classification[];
|
classifications: Classification[];
|
||||||
|
isClassificationEmpty: boolean;
|
||||||
|
|
||||||
readonly lengthError = 'You have reached the maximum length';
|
readonly lengthError = 'You have reached the maximum length';
|
||||||
inputOverflowMap = new Map<string, boolean>();
|
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 {
|
isFieldValid(field: string): boolean {
|
||||||
return this.formsValidatorService.isFieldValid(this.taskForm, field);
|
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() {
|
private validate() {
|
||||||
|
this.isClassificationEmpty = typeof this.task.classificationSummary === 'undefined';
|
||||||
this.formsValidatorService.formSubmitAttempt = true;
|
this.formsValidatorService.formSubmitAttempt = true;
|
||||||
this.formsValidatorService.validateFormInformation(this.taskForm, this.toggleValidationMap).then((value) => {
|
this.formsValidatorService.validateFormInformation(this.taskForm, this.toggleValidationMap).then((value) => {
|
||||||
if (value) {
|
if (value && !this.isClassificationEmpty) {
|
||||||
this.formValid.emit(true);
|
this.formValid.emit(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changedClassification(itemSelected: Classification) {
|
private getClassificationByDomain() {
|
||||||
this.task.classificationSummary = itemSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getClassificationByDomain() {
|
|
||||||
this.requestInProgress = true;
|
this.requestInProgress = true;
|
||||||
this.classifications = (
|
this.classificationService
|
||||||
await this.classificationService.getClassificationsByDomain(this.domainService.getSelectedDomainValue())
|
.getClassificationsByDomain(this.domainService.getSelectedDomainValue())
|
||||||
).classifications;
|
.then((classificationPagingList) => {
|
||||||
|
this.classifications = classificationPagingList.classifications;
|
||||||
|
});
|
||||||
this.requestInProgress = false;
|
this.requestInProgress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.destroy$.next();
|
||||||
|
this.destroy$.complete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
'expand_more' : 'expand_less'}}</span>
|
'expand_more' : 'expand_less'}}</span>
|
||||||
</button>
|
</button>
|
||||||
<taskana-task-details-general-fields [task]="task" [saveToggleTriggered]="toggleFormValidation"
|
<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>
|
</accordion-group>
|
||||||
<!--Status Details-->
|
<!--Status Details-->
|
||||||
<accordion-group panelClass="customClass" (isOpenChange)="accordion2State = $event">
|
<accordion-group panelClass="customClass" (isOpenChange)="accordion2State = $event">
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,6 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
|
||||||
this.onSave();
|
|
||||||
}
|
|
||||||
|
|
||||||
openTask() {
|
openTask() {
|
||||||
this.router.navigate([{ outlets: { detail: `task/${this.currentId}` } }], { relativeTo: this.route.parent });
|
this.router.navigate([{ outlets: { detail: `task/${this.currentId}` } }], { relativeTo: this.route.parent });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue