From 7885e0f585e9665e3ca13f13925b1a95589141e6 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Fri, 26 Jun 2026 17:31:05 +0200 Subject: [PATCH] Fixed false "Unsaved changes" popup on the Alarm rule details page (#15851) --- .../cf-alarm-rule-condition.component.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts index ef539af6f5..f9347d9961 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition.component.ts +++ b/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 {