Merge pull request #12104 from ChantsovaEkaterina/bug/timewindow-fix-applying-disable-custom-interval-parameter

Timewindow: fixed applying "disable custom interval" parameter
This commit is contained in:
Igor Kulikov 2024-11-25 12:58:51 +02:00 committed by GitHub
commit b0ac44fe0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 2 deletions

View File

@ -340,6 +340,18 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
update() {
const timewindowFormValue = this.timewindowForm.getRawValue();
this.timewindow = mergeDeep(this.timewindow, timewindowFormValue);
if (!this.timewindow.realtime.disableCustomInterval) {
delete this.timewindow.realtime.disableCustomInterval;
}
if (!this.timewindow.realtime.disableCustomGroupInterval) {
delete this.timewindow.realtime.disableCustomGroupInterval;
}
if (!this.timewindow.history.disableCustomInterval) {
delete this.timewindow.history.disableCustomInterval;
}
if (!this.timewindow.history.disableCustomGroupInterval) {
delete this.timewindow.history.disableCustomGroupInterval;
}
if (!this.aggregation) {
delete this.timewindow.aggregation;
}

View File

@ -331,6 +331,12 @@ export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalO
if (isDefinedAndNotNull(value.realtime.hideQuickInterval)) {
model.realtime.hideQuickInterval = value.realtime.hideQuickInterval;
}
if (value.realtime.disableCustomInterval) {
model.realtime.disableCustomInterval = value.realtime.disableCustomInterval;
}
if (value.realtime.disableCustomGroupInterval) {
model.realtime.disableCustomGroupInterval = value.realtime.disableCustomGroupInterval;
}
if (isDefined(value.realtime.interval)) {
model.realtime.interval = value.realtime.interval;
@ -364,6 +370,12 @@ export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalO
if (isDefinedAndNotNull(value.history.hideQuickInterval)) {
model.history.hideQuickInterval = value.history.hideQuickInterval;
}
if (value.history.disableCustomInterval) {
model.history.disableCustomInterval = value.history.disableCustomInterval;
}
if (value.history.disableCustomGroupInterval) {
model.history.disableCustomGroupInterval = value.history.disableCustomGroupInterval;
}
if (isDefined(value.history.interval)) {
model.history.interval = value.history.interval;
@ -429,7 +441,7 @@ export const toHistoryTimewindow = (timewindow: Timewindow, startTimeMs: number,
aggType = AggregationType.AVG;
limit = timeService.getMaxDatapointsLimit();
}
return {
const historyTimewindow: Timewindow = {
hideAggregation: timewindow.hideAggregation || false,
hideAggInterval: timewindow.hideAggInterval || false,
hideTimezone: timewindow.hideTimezone || false,
@ -443,7 +455,7 @@ export const toHistoryTimewindow = (timewindow: Timewindow, startTimeMs: number,
interval: timeService.boundIntervalToTimewindow(endTimeMs - startTimeMs, interval, AggregationType.AVG),
hideInterval: timewindow.history?.hideInterval || false,
hideLastInterval: timewindow.history?.hideLastInterval || false,
hideQuickInterval: timewindow.history?.hideQuickInterval || false,
hideQuickInterval: timewindow.history?.hideQuickInterval || false
},
aggregation: {
type: aggType,
@ -451,6 +463,13 @@ export const toHistoryTimewindow = (timewindow: Timewindow, startTimeMs: number,
},
timezone: timewindow.timezone
};
if (timewindow.history?.disableCustomInterval) {
historyTimewindow.history.disableCustomInterval = timewindow.history.disableCustomInterval;
}
if (timewindow.history?.disableCustomGroupInterval) {
historyTimewindow.history.disableCustomGroupInterval = timewindow.history.disableCustomGroupInterval;
}
return historyTimewindow;
};
export const timewindowTypeChanged = (newTimewindow: Timewindow, oldTimewindow: Timewindow): boolean => {