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() {
|
update() {
|
||||||
const timewindowFormValue = this.timewindowForm.getRawValue();
|
const timewindowFormValue = this.timewindowForm.getRawValue();
|
||||||
this.timewindow = mergeDeep(this.timewindow, timewindowFormValue);
|
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) {
|
if (!this.aggregation) {
|
||||||
delete this.timewindow.aggregation;
|
delete this.timewindow.aggregation;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -331,10 +331,10 @@ export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalO
|
|||||||
if (isDefinedAndNotNull(value.realtime.hideQuickInterval)) {
|
if (isDefinedAndNotNull(value.realtime.hideQuickInterval)) {
|
||||||
model.realtime.hideQuickInterval = value.realtime.hideQuickInterval;
|
model.realtime.hideQuickInterval = value.realtime.hideQuickInterval;
|
||||||
}
|
}
|
||||||
if (isDefinedAndNotNull(value.realtime.disableCustomInterval)) {
|
if (value.realtime.disableCustomInterval) {
|
||||||
model.realtime.disableCustomInterval = value.realtime.disableCustomInterval;
|
model.realtime.disableCustomInterval = value.realtime.disableCustomInterval;
|
||||||
}
|
}
|
||||||
if (isDefinedAndNotNull(value.realtime.disableCustomGroupInterval)) {
|
if (value.realtime.disableCustomGroupInterval) {
|
||||||
model.realtime.disableCustomGroupInterval = value.realtime.disableCustomGroupInterval;
|
model.realtime.disableCustomGroupInterval = value.realtime.disableCustomGroupInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,10 +370,10 @@ export const initModelFromDefaultTimewindow = (value: Timewindow, quickIntervalO
|
|||||||
if (isDefinedAndNotNull(value.history.hideQuickInterval)) {
|
if (isDefinedAndNotNull(value.history.hideQuickInterval)) {
|
||||||
model.history.hideQuickInterval = value.history.hideQuickInterval;
|
model.history.hideQuickInterval = value.history.hideQuickInterval;
|
||||||
}
|
}
|
||||||
if (isDefinedAndNotNull(value.history.disableCustomInterval)) {
|
if (value.history.disableCustomInterval) {
|
||||||
model.history.disableCustomInterval = value.history.disableCustomInterval;
|
model.history.disableCustomInterval = value.history.disableCustomInterval;
|
||||||
}
|
}
|
||||||
if (isDefinedAndNotNull(value.history.disableCustomGroupInterval)) {
|
if (value.history.disableCustomGroupInterval) {
|
||||||
model.history.disableCustomGroupInterval = value.history.disableCustomGroupInterval;
|
model.history.disableCustomGroupInterval = value.history.disableCustomGroupInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ export const toHistoryTimewindow = (timewindow: Timewindow, startTimeMs: number,
|
|||||||
aggType = AggregationType.AVG;
|
aggType = AggregationType.AVG;
|
||||||
limit = timeService.getMaxDatapointsLimit();
|
limit = timeService.getMaxDatapointsLimit();
|
||||||
}
|
}
|
||||||
return {
|
const historyTimewindow: Timewindow = {
|
||||||
hideAggregation: timewindow.hideAggregation || false,
|
hideAggregation: timewindow.hideAggregation || false,
|
||||||
hideAggInterval: timewindow.hideAggInterval || false,
|
hideAggInterval: timewindow.hideAggInterval || false,
|
||||||
hideTimezone: timewindow.hideTimezone || false,
|
hideTimezone: timewindow.hideTimezone || false,
|
||||||
@ -455,9 +455,7 @@ export const toHistoryTimewindow = (timewindow: Timewindow, startTimeMs: number,
|
|||||||
interval: timeService.boundIntervalToTimewindow(endTimeMs - startTimeMs, interval, AggregationType.AVG),
|
interval: timeService.boundIntervalToTimewindow(endTimeMs - startTimeMs, interval, AggregationType.AVG),
|
||||||
hideInterval: timewindow.history?.hideInterval || false,
|
hideInterval: timewindow.history?.hideInterval || false,
|
||||||
hideLastInterval: timewindow.history?.hideLastInterval || false,
|
hideLastInterval: timewindow.history?.hideLastInterval || false,
|
||||||
hideQuickInterval: timewindow.history?.hideQuickInterval || false,
|
hideQuickInterval: timewindow.history?.hideQuickInterval || false
|
||||||
disableCustomInterval: timewindow.history?.disableCustomInterval || false,
|
|
||||||
disableCustomGroupInterval: timewindow.history?.disableCustomGroupInterval || false,
|
|
||||||
},
|
},
|
||||||
aggregation: {
|
aggregation: {
|
||||||
type: aggType,
|
type: aggType,
|
||||||
@ -465,6 +463,13 @@ export const toHistoryTimewindow = (timewindow: Timewindow, startTimeMs: number,
|
|||||||
},
|
},
|
||||||
timezone: timewindow.timezone
|
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 => {
|
export const timewindowTypeChanged = (newTimewindow: Timewindow, oldTimewindow: Timewindow): boolean => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user