Timewindow: remove disable custom parameter from configuration if it disabled
This commit is contained in:
parent
ffdd7d566f
commit
73005eef6c
@ -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;
|
||||
}
|
||||
|
||||
@ -331,10 +331,10 @@ export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalO
|
||||
if (isDefinedAndNotNull(value.realtime.hideQuickInterval)) {
|
||||
model.realtime.hideQuickInterval = value.realtime.hideQuickInterval;
|
||||
}
|
||||
if (isDefinedAndNotNull(value.realtime.disableCustomInterval)) {
|
||||
if (value.realtime.disableCustomInterval) {
|
||||
model.realtime.disableCustomInterval = value.realtime.disableCustomInterval;
|
||||
}
|
||||
if (isDefinedAndNotNull(value.realtime.disableCustomGroupInterval)) {
|
||||
if (value.realtime.disableCustomGroupInterval) {
|
||||
model.realtime.disableCustomGroupInterval = value.realtime.disableCustomGroupInterval;
|
||||
}
|
||||
|
||||
@ -370,10 +370,10 @@ export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalO
|
||||
if (isDefinedAndNotNull(value.history.hideQuickInterval)) {
|
||||
model.history.hideQuickInterval = value.history.hideQuickInterval;
|
||||
}
|
||||
if (isDefinedAndNotNull(value.history.disableCustomInterval)) {
|
||||
if (value.history.disableCustomInterval) {
|
||||
model.history.disableCustomInterval = value.history.disableCustomInterval;
|
||||
}
|
||||
if (isDefinedAndNotNull(value.history.disableCustomGroupInterval)) {
|
||||
if (value.history.disableCustomGroupInterval) {
|
||||
model.history.disableCustomGroupInterval = value.history.disableCustomGroupInterval;
|
||||
}
|
||||
|
||||
@ -441,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,
|
||||
@ -455,9 +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,
|
||||
disableCustomInterval: timewindow.history?.disableCustomInterval || false,
|
||||
disableCustomGroupInterval: timewindow.history?.disableCustomGroupInterval || false,
|
||||
hideQuickInterval: timewindow.history?.hideQuickInterval || false
|
||||
},
|
||||
aggregation: {
|
||||
type: aggType,
|
||||
@ -465,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 => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user