mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-4269] ProcessCloud - fix start task with invalid Asignee or Candidat… (#4727)
* [ADF-4269] - prevent starting a task with invalid Asignee or CandidateUser * [ADF-4269] - refractor people/group cloud * [ADF-4269] - change docs
This commit is contained in:
committed by
Maurizio Vitale
parent
4a363c731b
commit
b4e3a71bef
@@ -99,6 +99,9 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
|
||||
formKey: string;
|
||||
|
||||
private assigneeForm: AbstractControl = new FormControl('', [Validators.required]);
|
||||
private groupForm: AbstractControl = new FormControl('');
|
||||
|
||||
private localeSub: Subscription;
|
||||
private createTaskSub: Subscription;
|
||||
|
||||
@@ -190,9 +193,13 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
|
||||
onAssigneeSelect(assignee: IdentityUserModel) {
|
||||
this.assigneeName = assignee ? assignee.username : '';
|
||||
this.groupForm.clearValidators();
|
||||
this.groupForm.updateValueAndValidity();
|
||||
}
|
||||
|
||||
onAssigneeRemove() {
|
||||
this.groupForm.setValidators(Validators.required);
|
||||
this.groupForm.updateValueAndValidity();
|
||||
this.assigneeName = '';
|
||||
}
|
||||
|
||||
@@ -210,6 +217,14 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
canStartTask(): boolean {
|
||||
return !(this.dateError ||
|
||||
!this.taskForm.valid ||
|
||||
this.submitted ||
|
||||
this.assignee.hasError() ||
|
||||
this.candidateGroups.hasError());
|
||||
}
|
||||
|
||||
public whitespaceValidator(control: FormControl) {
|
||||
const isWhitespace = (control.value || '').trim().length === 0;
|
||||
const isValid = control.value.length === 0 || !isWhitespace;
|
||||
@@ -224,6 +239,14 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
return this.taskForm.get('priority');
|
||||
}
|
||||
|
||||
get assigneeFormControl(): AbstractControl {
|
||||
return this.assigneeForm;
|
||||
}
|
||||
|
||||
get candidateUserFormControl(): AbstractControl {
|
||||
return this.groupForm;
|
||||
}
|
||||
|
||||
onFormSelect(formKey: string) {
|
||||
this.formKey = formKey || '';
|
||||
}
|
||||
|
Reference in New Issue
Block a user