in frontend/src/app/modules/config-editor/components/config-editor/config-editor.component.ts [852:881]
private validateSwap(): void {
let tempArray: any[] = [];
this.ldspFaDevices.value.forEach((element: any) => {
tempArray.push(element.purpose)
});
const notSwap = tempArray.find((element: any) => {
return element === 'diag' || element === 'software';
});
if(notSwap && this.configEditorForm.get('misc_config_values')?.get('is_swap_configured')?.value) {
this.configEditorForm.get('misc_config_values')?.get('is_swap_configured')?.setErrors(null);
}
if (
(tempArray.length === 1 && tempArray[0] === 'swap') ||
(tempArray.length > 1 && !notSwap)
) {
tempArray.forEach((el, i) => {
this.ldspFaDevices.controls[i].get('purpose')?.setErrors({'incorrectSwap': true});
});
}
if (tempArray.length > 1 && notSwap) {
tempArray.forEach((el, i) => {
this.ldspFaDevices.controls[i].get('purpose')?.setErrors(null);
});
}
}