|
|
@@ -1,4 +1,5 @@
|
|
|
import { Component, Input, QueryList, ViewChildren } from '@angular/core';
|
|
|
+import { ValidationErrors } from '@angular/forms';
|
|
|
import { faCaretDown, faCaretUp, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
|
|
import { ServiceCheckAdapterComponent } from 'src/app/components/service-check-editor/service-check-adapter/service-check-adapter.component';
|
|
|
@@ -19,6 +20,15 @@ export class ServiceCheckConjunctionComponent extends ServiceCheckEditorComponen
|
|
|
return { and: this.adapters.map(adpt => adpt.collect()) };
|
|
|
}
|
|
|
|
|
|
+ public validate(): ValidationErrors | null {
|
|
|
+ if (!this.model?.and.length) return { 'empty-and': 'There is an empty AND-expression. Please remove.' };
|
|
|
+ let subValid = {};
|
|
|
+ for (const adp of this.adapters) {
|
|
|
+ subValid = { ...subValid, ...adp.validate() };
|
|
|
+ }
|
|
|
+ return Object.keys(subValid).length > 0 ? subValid : null;
|
|
|
+ }
|
|
|
+
|
|
|
public onSubSort(idx: number, dir: SortDirection) {
|
|
|
if (!this.model?.and) return;
|
|
|
|