Browse Source

Timewindow: fix disabling advanced interval and hiding intervals

pull/11633/head
Chantsova Ekaterina 2 years ago
parent
commit
fdf23d1069
  1. 10
      ui-ngx/src/app/shared/components/time/timeinterval.component.ts
  2. 20
      ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts

10
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) { set disabledAdvanced(disabledAdvanced: boolean) {
if (this.disabledAdvancedState !== disabledAdvanced) { if (this.disabledAdvancedState !== disabledAdvanced) {
this.disabledAdvancedState = disabledAdvanced; this.disabledAdvancedState = disabledAdvanced;
this.updateIntervalValue(); this.updateIntervalValue(true);
if (!this.disabledAdvancedState) {
this.boundInterval();
}
} }
} }
@ -183,7 +180,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor, OnDe
this.updateIntervalValue(); this.updateIntervalValue();
} }
private updateIntervalValue() { private updateIntervalValue(forceBoundInterval = false) {
if (typeof this.modelValue !== 'undefined') { if (typeof this.modelValue !== 'undefined') {
const min = this.timeService.boundMinInterval(this.minValue); const min = this.timeService.boundMinInterval(this.minValue);
const max = this.timeService.boundMaxInterval(this.maxValue); const max = this.timeService.boundMaxInterval(this.maxValue);
@ -196,6 +193,9 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor, OnDe
} else { } else {
this.advanced = advanced; this.advanced = advanced;
this.setInterval(this.modelValue); this.setInterval(this.modelValue);
if (forceBoundInterval) {
this.boundInterval();
}
} }
} else { } else {
this.boundInterval(); this.boundInterval();

20
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$) takeUntil(this.destroy$)
).subscribe((value: boolean) => { ).subscribe((value: boolean) => {
if (value) { if (value) {
this.timewindowForm.get('realtime.hideLastInterval').disable(); this.timewindowForm.get('realtime.hideLastInterval').disable({emitEvent: false});
this.timewindowForm.get('realtime.hideQuickInterval').disable(); this.timewindowForm.get('realtime.hideQuickInterval').disable({emitEvent: false});
} else { } else {
this.timewindowForm.get('realtime.hideLastInterval').enable(); this.timewindowForm.get('realtime.hideLastInterval').enable({emitEvent: false});
this.timewindowForm.get('realtime.hideQuickInterval').enable(); this.timewindowForm.get('realtime.hideQuickInterval').enable({emitEvent: false});
} }
}); });
this.timewindowForm.get('realtime.hideLastInterval').valueChanges.pipe( this.timewindowForm.get('realtime.hideLastInterval').valueChanges.pipe(
@ -243,13 +243,13 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
takeUntil(this.destroy$) takeUntil(this.destroy$)
).subscribe((value: boolean) => { ).subscribe((value: boolean) => {
if (value) { if (value) {
this.timewindowForm.get('history.hideLastInterval').disable(); this.timewindowForm.get('history.hideLastInterval').disable({emitEvent: false});
this.timewindowForm.get('history.hideQuickInterval').disable(); this.timewindowForm.get('history.hideQuickInterval').disable({emitEvent: false});
this.timewindowForm.get('history.hideFixedInterval').disable(); this.timewindowForm.get('history.hideFixedInterval').disable({emitEvent: false});
} else { } else {
this.timewindowForm.get('history.hideLastInterval').enable(); this.timewindowForm.get('history.hideLastInterval').enable({emitEvent: false});
this.timewindowForm.get('history.hideQuickInterval').enable(); this.timewindowForm.get('history.hideQuickInterval').enable({emitEvent: false});
this.timewindowForm.get('history.hideFixedInterval').enable(); this.timewindowForm.get('history.hideFixedInterval').enable({emitEvent: false});
} }
}); });
this.timewindowForm.get('history.hideLastInterval').valueChanges.pipe( this.timewindowForm.get('history.hideLastInterval').valueChanges.pipe(

Loading…
Cancel
Save