Browse Source

Merge pull request #15852 from thingsboard/rc

Merge rc into master
pull/15856/head
Vladyslav Prykhodko 1 month ago
committed by GitHub
parent
commit
e70298792a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts

16
ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts

@ -143,19 +143,23 @@ export class CfAlarmRuleConditionComponent implements ControlValueAccessor, Vali
ngOnChanges(changes: SimpleChanges) {
if (changes.arguments && !changes.arguments.firstChange) {
this.recalculateArgumentValidity();
this.onValidatorChange();
if (this.recalculateArgumentValidity()) {
this.onValidatorChange();
}
}
}
private recalculateArgumentValidity(): void {
private recalculateArgumentValidity(): boolean {
const prevFiltersValid = this.filtersArgumentsValid;
const prevSchedulerValid = this.schedulerArgumentsValid;
if (!this.modelValue || !this.arguments) {
this.filtersArgumentsValid = true;
this.schedulerArgumentsValid = true;
return;
} else {
this.filtersArgumentsValid = this.areFilterAndPredicateArgumentsValid(this.modelValue, this.arguments);
this.schedulerArgumentsValid = this.isScheduleArgumentValid(this.modelValue, Object.keys(this.arguments));
}
this.filtersArgumentsValid = this.areFilterAndPredicateArgumentsValid(this.modelValue, this.arguments);
this.schedulerArgumentsValid = this.isScheduleArgumentValid(this.modelValue, Object.keys(this.arguments));
return prevFiltersValid !== this.filtersArgumentsValid || prevSchedulerValid !== this.schedulerArgumentsValid;
}
private isScheduleArgumentValid(obj: any, validArguments: string[]): boolean {

Loading…
Cancel
Save