Skip to content
Snippets Groups Projects
Commit aee61f2c authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #15011 TIME 0:15 fix validator

(cherry picked from commit 28c4186e)
parent 146d6c60
No related branches found
No related tags found
No related merge requests found
......@@ -888,6 +888,8 @@ export class IndexingFormComponent implements OnInit {
if (field.mandatory) {
valArr.push(Validators.required);
valArr.push(this.requireDestValidator({ 'isDest': '' }));
} else {
valArr.push(this.requireDestValidatorOrEmpty({ 'isDest': '' }));
}
this.arrFormControl['diffusionList'] = new FormControl({ value: null, disabled: false });
......@@ -908,6 +910,15 @@ export class IndexingFormComponent implements OnInit {
};
}
requireDestValidatorOrEmpty(error: ValidationErrors): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } => {
if (!control.value) {
return null;
}
return control.value.filter((item: any) => item.mode === 'dest').length > 0 || this.functions.empty(this.arrFormControl['destination'].value) ? null : error;
};
}
regexValidator(regex: RegExp, error: ValidationErrors): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } => {
if (!control.value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment