Merge pull request #9307 from rusikv/enhancement/timewindow-switch-tab
Timewindow config transfer on tab switch
This commit is contained in:
commit
f6c99385b4
@ -17,7 +17,7 @@
|
|||||||
-->
|
-->
|
||||||
<form [formGroup]="timewindowForm" class="mat-content">
|
<form [formGroup]="timewindowForm" class="mat-content">
|
||||||
<mat-tab-group [ngClass]="{'tb-headless': historyOnly}"
|
<mat-tab-group [ngClass]="{'tb-headless': historyOnly}"
|
||||||
(selectedIndexChange)="timewindowForm.markAsDirty()" [(selectedIndex)]="timewindow.selectedTab">
|
(selectedTabChange)="onTimewindowTypeChange()" [(selectedIndex)]="timewindow.selectedTab">
|
||||||
<mat-tab label="{{ 'timewindow.realtime' | translate }}">
|
<mat-tab label="{{ 'timewindow.realtime' | translate }}">
|
||||||
<section fxLayout="row">
|
<section fxLayout="row">
|
||||||
<section *ngIf="isEdit" fxLayout="column" fxLayoutAlign="start center"
|
<section *ngIf="isEdit" fxLayout="column" fxLayoutAlign="start center"
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import {
|
|||||||
AggregationType,
|
AggregationType,
|
||||||
DAY,
|
DAY,
|
||||||
HistoryWindowType,
|
HistoryWindowType,
|
||||||
|
QuickTimeInterval,
|
||||||
quickTimeIntervalPeriod,
|
quickTimeIntervalPeriod,
|
||||||
RealtimeWindowType,
|
RealtimeWindowType,
|
||||||
Timewindow,
|
Timewindow,
|
||||||
@ -186,6 +187,38 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit {
|
|||||||
this.timewindowForm.get('aggregation.limit').updateValueAndValidity({emitEvent: false});
|
this.timewindowForm.get('aggregation.limit').updateValueAndValidity({emitEvent: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTimewindowTypeChange() {
|
||||||
|
this.timewindowForm.markAsDirty();
|
||||||
|
const timewindowFormValue = this.timewindowForm.getRawValue();
|
||||||
|
if (this.timewindow.selectedTab === TimewindowType.REALTIME) {
|
||||||
|
if (timewindowFormValue.history.historyType !== HistoryWindowType.FIXED) {
|
||||||
|
this.timewindowForm.get('realtime').patchValue({
|
||||||
|
realtimeType: Object.keys(RealtimeWindowType).includes(HistoryWindowType[timewindowFormValue.history.historyType]) ?
|
||||||
|
RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]] :
|
||||||
|
timewindowFormValue.realtime.realtimeType,
|
||||||
|
timewindowMs: timewindowFormValue.history.timewindowMs,
|
||||||
|
quickInterval: timewindowFormValue.history.quickInterval.startsWith('CURRENT') ?
|
||||||
|
timewindowFormValue.history.quickInterval : timewindowFormValue.realtime.quickInterval
|
||||||
|
});
|
||||||
|
setTimeout(() => this.timewindowForm.get('realtime.interval').patchValue(timewindowFormValue.history.interval));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.timewindowForm.get('history').patchValue({
|
||||||
|
historyType: HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]],
|
||||||
|
timewindowMs: timewindowFormValue.realtime.timewindowMs,
|
||||||
|
quickInterval: timewindowFormValue.realtime.quickInterval
|
||||||
|
});
|
||||||
|
setTimeout(() => this.timewindowForm.get('history.interval').patchValue(timewindowFormValue.realtime.interval));
|
||||||
|
}
|
||||||
|
this.timewindowForm.patchValue({
|
||||||
|
aggregation: {
|
||||||
|
type: timewindowFormValue.aggregation.type,
|
||||||
|
limit: timewindowFormValue.aggregation.limit
|
||||||
|
},
|
||||||
|
timezone: timewindowFormValue.timezone
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
const timewindowFormValue = this.timewindowForm.getRawValue();
|
const timewindowFormValue = this.timewindowForm.getRawValue();
|
||||||
this.timewindow.realtime = {
|
this.timewindow.realtime = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user