Merge pull request #14081 from ChantsovaEkaterina/bug/timewindow-hidden-option-displayed
Timewindow: fix hidden options displaying when switching between Realtime and History
This commit is contained in:
commit
20e4b3970b
@ -411,9 +411,10 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
|
|||||||
const timewindowFormValue = this.timewindowForm.getRawValue();
|
const timewindowFormValue = this.timewindowForm.getRawValue();
|
||||||
const realtimeDisableCustomInterval = timewindowFormValue.realtime.disableCustomInterval;
|
const realtimeDisableCustomInterval = timewindowFormValue.realtime.disableCustomInterval;
|
||||||
const historyDisableCustomInterval = timewindowFormValue.history.disableCustomInterval;
|
const historyDisableCustomInterval = timewindowFormValue.history.disableCustomInterval;
|
||||||
updateFormValuesOnTimewindowTypeChange(selectedTab, this.quickIntervalOnly, this.timewindowForm,
|
updateFormValuesOnTimewindowTypeChange(selectedTab, this.timewindowForm,
|
||||||
realtimeDisableCustomInterval, historyDisableCustomInterval,
|
realtimeDisableCustomInterval, historyDisableCustomInterval,
|
||||||
timewindowFormValue.realtime.advancedParams, timewindowFormValue.history.advancedParams);
|
timewindowFormValue.realtime.advancedParams, timewindowFormValue.history.advancedParams,
|
||||||
|
this.realtimeTimewindowOptions, this.historyTimewindowOptions);
|
||||||
this.timewindowForm.patchValue({
|
this.timewindowForm.patchValue({
|
||||||
hideAggregation: timewindowFormValue.hideAggregation,
|
hideAggregation: timewindowFormValue.hideAggregation,
|
||||||
hideAggInterval: timewindowFormValue.hideAggInterval,
|
hideAggInterval: timewindowFormValue.hideAggInterval,
|
||||||
|
|||||||
@ -400,9 +400,10 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onTimewindowTypeChange(selectedTab: TimewindowType) {
|
private onTimewindowTypeChange(selectedTab: TimewindowType) {
|
||||||
updateFormValuesOnTimewindowTypeChange(selectedTab, this.quickIntervalOnly, this.timewindowForm,
|
updateFormValuesOnTimewindowTypeChange(selectedTab, this.timewindowForm,
|
||||||
this.realtimeDisableCustomInterval, this.historyDisableCustomInterval,
|
this.realtimeDisableCustomInterval, this.historyDisableCustomInterval,
|
||||||
this.realtimeAdvancedParams, this.historyAdvancedParams);
|
this.realtimeAdvancedParams, this.historyAdvancedParams,
|
||||||
|
this.realtimeTimewindowOptions, this.historyTimewindowOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import moment_ from 'moment';
|
|||||||
import * as momentTz from 'moment-timezone';
|
import * as momentTz from 'moment-timezone';
|
||||||
import { IntervalType } from '@shared/models/telemetry/telemetry.models';
|
import { IntervalType } from '@shared/models/telemetry/telemetry.models';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
|
import { ToggleHeaderOption } from '@shared/components/toggle-header.component';
|
||||||
|
|
||||||
const moment = moment_;
|
const moment = moment_;
|
||||||
|
|
||||||
@ -526,17 +527,20 @@ export const timewindowTypeChanged = (newTimewindow: Timewindow, oldTimewindow:
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const updateFormValuesOnTimewindowTypeChange = (selectedTab: TimewindowType,
|
export const updateFormValuesOnTimewindowTypeChange = (selectedTab: TimewindowType,
|
||||||
quickIntervalOnly: boolean, timewindowForm: FormGroup,
|
timewindowForm: FormGroup,
|
||||||
realtimeDisableCustomInterval: boolean, historyDisableCustomInterval: boolean,
|
realtimeDisableCustomInterval: boolean, historyDisableCustomInterval: boolean,
|
||||||
realtimeAdvancedParams?: TimewindowAdvancedParams,
|
realtimeAdvancedParams: TimewindowAdvancedParams,
|
||||||
historyAdvancedParams?: TimewindowAdvancedParams) => {
|
historyAdvancedParams: TimewindowAdvancedParams,
|
||||||
|
realtimeTimewindowOptions: ToggleHeaderOption[],
|
||||||
|
historyTimewindowOptions: ToggleHeaderOption[]) => {
|
||||||
const timewindowFormValue = timewindowForm.getRawValue();
|
const timewindowFormValue = timewindowForm.getRawValue();
|
||||||
if (selectedTab === TimewindowType.REALTIME) {
|
if (selectedTab === TimewindowType.REALTIME) {
|
||||||
if (timewindowFormValue.history.historyType !== HistoryWindowType.FIXED
|
const sameWindowTypeOptionAvailable = realtimeTimewindowOptions.some(
|
||||||
&& !(quickIntervalOnly && timewindowFormValue.history.historyType === HistoryWindowType.LAST_INTERVAL)) {
|
option => {
|
||||||
if (Object.keys(RealtimeWindowType).includes(HistoryWindowType[timewindowFormValue.history.historyType])) {
|
return option.value === RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]]
|
||||||
|
});
|
||||||
|
if (sameWindowTypeOptionAvailable) {
|
||||||
timewindowForm.get('realtime.realtimeType').patchValue(RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]]);
|
timewindowForm.get('realtime.realtimeType').patchValue(RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]]);
|
||||||
}
|
|
||||||
if (!realtimeDisableCustomInterval ||
|
if (!realtimeDisableCustomInterval ||
|
||||||
!realtimeAdvancedParams?.allowedLastIntervals?.length || realtimeAdvancedParams.allowedLastIntervals.includes(timewindowFormValue.history.timewindowMs)) {
|
!realtimeAdvancedParams?.allowedLastIntervals?.length || realtimeAdvancedParams.allowedLastIntervals.includes(timewindowFormValue.history.timewindowMs)) {
|
||||||
timewindowForm.get('realtime.timewindowMs').patchValue(timewindowFormValue.history.timewindowMs);
|
timewindowForm.get('realtime.timewindowMs').patchValue(timewindowFormValue.history.timewindowMs);
|
||||||
@ -554,6 +558,11 @@ export const updateFormValuesOnTimewindowTypeChange = (selectedTab: TimewindowTy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const sameWindowTypeOptionAvailable = historyTimewindowOptions.some(
|
||||||
|
option => {
|
||||||
|
return option.value === HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]]
|
||||||
|
});
|
||||||
|
if (sameWindowTypeOptionAvailable) {
|
||||||
timewindowForm.get('history.historyType').patchValue(HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]]);
|
timewindowForm.get('history.historyType').patchValue(HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]]);
|
||||||
if (!historyDisableCustomInterval ||
|
if (!historyDisableCustomInterval ||
|
||||||
!historyAdvancedParams?.allowedLastIntervals?.length || historyAdvancedParams.allowedLastIntervals?.includes(timewindowFormValue.realtime.timewindowMs)) {
|
!historyAdvancedParams?.allowedLastIntervals?.length || historyAdvancedParams.allowedLastIntervals?.includes(timewindowFormValue.realtime.timewindowMs)) {
|
||||||
@ -570,6 +579,7 @@ export const updateFormValuesOnTimewindowTypeChange = (selectedTab: TimewindowTy
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
timewindowForm.patchValue({
|
timewindowForm.patchValue({
|
||||||
aggregation: {
|
aggregation: {
|
||||||
type: timewindowFormValue.aggregation.type,
|
type: timewindowFormValue.aggregation.type,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user