Browse Source

Merge pull request #8311 from vvlladd28/bug/timeinterval/disable

Fix disable time interval in timewindow panel
pull/8363/head
Igor Kulikov 4 years ago
committed by GitHub
parent
commit
3ffe9dd762
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ui-ngx/src/app/shared/components/time/timeinterval.component.ts
  2. 9
      ui-ngx/src/app/shared/components/time/timewindow-panel.component.ts

4
ui-ngx/src/app/shared/components/time/timeinterval.component.ts

@ -64,8 +64,6 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
@coerceBoolean() @coerceBoolean()
isEdit = false; isEdit = false;
hideFlagValue = false;
@Input() @Input()
@coerceBoolean() @coerceBoolean()
hideFlag = false; hideFlag = false;
@ -208,7 +206,7 @@ export class TimeintervalComponent implements OnInit, ControlValueAccessor {
} }
onHideFlagChange() { onHideFlagChange() {
this.hideFlagChange.emit(this.hideFlagValue); this.hideFlagChange.emit(this.hideFlag);
} }
onTimeInputChange(type: string) { onTimeInputChange(type: string) {

9
ui-ngx/src/app/shared/components/time/timewindow-panel.component.ts

@ -157,9 +157,9 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit {
disabled: hideTimezone disabled: hideTimezone
}] }]
}); });
this.updateValidators(); this.updateValidators(this.timewindowForm.get('aggregation.type').value);
this.timewindowForm.get('aggregation.type').valueChanges.subscribe(() => { this.timewindowForm.get('aggregation.type').valueChanges.subscribe((aggregationType: AggregationType) => {
this.updateValidators(); this.updateValidators(aggregationType);
}); });
} }
@ -172,8 +172,7 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit {
return limit; return limit;
} }
private updateValidators() { private updateValidators(aggType: AggregationType) {
const aggType = this.timewindowForm.get('aggregation.type').value;
if (aggType !== AggregationType.NONE) { if (aggType !== AggregationType.NONE) {
this.timewindowForm.get('aggregation.limit').clearValidators(); this.timewindowForm.get('aggregation.limit').clearValidators();
} else { } else {

Loading…
Cancel
Save