From fdf23d1069f629ee1617a4364d323b072e8f7241 Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Thu, 12 Sep 2024 14:48:53 +0300 Subject: [PATCH] Timewindow: fix disabling advanced interval and hiding intervals --- .../components/time/timeinterval.component.ts | 10 +++++----- .../timewindow-config-dialog.component.ts | 20 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts index 9cb43388cb..96841290d5 100644 --- a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts +++ b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts @@ -76,10 +76,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor, OnDe set disabledAdvanced(disabledAdvanced: boolean) { if (this.disabledAdvancedState !== disabledAdvanced) { this.disabledAdvancedState = disabledAdvanced; - this.updateIntervalValue(); - if (!this.disabledAdvancedState) { - this.boundInterval(); - } + this.updateIntervalValue(true); } } @@ -183,7 +180,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor, OnDe this.updateIntervalValue(); } - private updateIntervalValue() { + private updateIntervalValue(forceBoundInterval = false) { if (typeof this.modelValue !== 'undefined') { const min = this.timeService.boundMinInterval(this.minValue); const max = this.timeService.boundMaxInterval(this.maxValue); @@ -196,6 +193,9 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor, OnDe } else { this.advanced = advanced; this.setInterval(this.modelValue); + if (forceBoundInterval) { + this.boundInterval(); + } } } else { this.boundInterval(); diff --git a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts index 2e33ef0390..77297dbe05 100644 --- a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts +++ b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts @@ -217,11 +217,11 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On takeUntil(this.destroy$) ).subscribe((value: boolean) => { if (value) { - this.timewindowForm.get('realtime.hideLastInterval').disable(); - this.timewindowForm.get('realtime.hideQuickInterval').disable(); + this.timewindowForm.get('realtime.hideLastInterval').disable({emitEvent: false}); + this.timewindowForm.get('realtime.hideQuickInterval').disable({emitEvent: false}); } else { - this.timewindowForm.get('realtime.hideLastInterval').enable(); - this.timewindowForm.get('realtime.hideQuickInterval').enable(); + this.timewindowForm.get('realtime.hideLastInterval').enable({emitEvent: false}); + this.timewindowForm.get('realtime.hideQuickInterval').enable({emitEvent: false}); } }); this.timewindowForm.get('realtime.hideLastInterval').valueChanges.pipe( @@ -243,13 +243,13 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On takeUntil(this.destroy$) ).subscribe((value: boolean) => { if (value) { - this.timewindowForm.get('history.hideLastInterval').disable(); - this.timewindowForm.get('history.hideQuickInterval').disable(); - this.timewindowForm.get('history.hideFixedInterval').disable(); + this.timewindowForm.get('history.hideLastInterval').disable({emitEvent: false}); + this.timewindowForm.get('history.hideQuickInterval').disable({emitEvent: false}); + this.timewindowForm.get('history.hideFixedInterval').disable({emitEvent: false}); } else { - this.timewindowForm.get('history.hideLastInterval').enable(); - this.timewindowForm.get('history.hideQuickInterval').enable(); - this.timewindowForm.get('history.hideFixedInterval').enable(); + this.timewindowForm.get('history.hideLastInterval').enable({emitEvent: false}); + this.timewindowForm.get('history.hideQuickInterval').enable({emitEvent: false}); + this.timewindowForm.get('history.hideFixedInterval').enable({emitEvent: false}); } }); this.timewindowForm.get('history.hideLastInterval').valueChanges.pipe(