|
|
@ -27,12 +27,14 @@ import { |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { |
|
|
import { |
|
|
AggregationType, |
|
|
AggregationType, |
|
|
|
|
|
clearTimewindowConfig, |
|
|
currentHistoryTimewindow, |
|
|
currentHistoryTimewindow, |
|
|
currentRealtimeTimewindow, |
|
|
currentRealtimeTimewindow, |
|
|
historyAllowedAggIntervals, |
|
|
historyAllowedAggIntervals, |
|
|
HistoryWindowType, |
|
|
HistoryWindowType, |
|
|
historyWindowTypeTranslations, |
|
|
historyWindowTypeTranslations, |
|
|
Interval, |
|
|
Interval, |
|
|
|
|
|
MINUTE, |
|
|
QuickTimeInterval, |
|
|
QuickTimeInterval, |
|
|
realtimeAllowedAggIntervals, |
|
|
realtimeAllowedAggIntervals, |
|
|
RealtimeWindowType, |
|
|
RealtimeWindowType, |
|
|
@ -167,14 +169,14 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ((this.isEdit || !this.timewindow.realtime.hideLastInterval) && !this.quickIntervalOnly) { |
|
|
if ((this.isEdit || !this.timewindow.realtime?.hideLastInterval) && !this.quickIntervalOnly) { |
|
|
this.realtimeTimewindowOptions.push({ |
|
|
this.realtimeTimewindowOptions.push({ |
|
|
name: this.translate.instant(realtimeWindowTypeTranslations.get(RealtimeWindowType.LAST_INTERVAL)), |
|
|
name: this.translate.instant(realtimeWindowTypeTranslations.get(RealtimeWindowType.LAST_INTERVAL)), |
|
|
value: this.realtimeTypes.LAST_INTERVAL |
|
|
value: this.realtimeTypes.LAST_INTERVAL |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.isEdit || !this.timewindow.realtime.hideQuickInterval || this.quickIntervalOnly) { |
|
|
if (this.isEdit || !this.timewindow.realtime?.hideQuickInterval || this.quickIntervalOnly) { |
|
|
this.realtimeTimewindowOptions.push({ |
|
|
this.realtimeTimewindowOptions.push({ |
|
|
name: this.translate.instant(realtimeWindowTypeTranslations.get(RealtimeWindowType.INTERVAL)), |
|
|
name: this.translate.instant(realtimeWindowTypeTranslations.get(RealtimeWindowType.INTERVAL)), |
|
|
value: this.realtimeTypes.INTERVAL |
|
|
value: this.realtimeTypes.INTERVAL |
|
|
@ -188,21 +190,21 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.isEdit || !this.timewindow.history.hideLastInterval) { |
|
|
if (this.isEdit || !this.timewindow.history?.hideLastInterval) { |
|
|
this.historyTimewindowOptions.push({ |
|
|
this.historyTimewindowOptions.push({ |
|
|
name: this.translate.instant(historyWindowTypeTranslations.get(HistoryWindowType.LAST_INTERVAL)), |
|
|
name: this.translate.instant(historyWindowTypeTranslations.get(HistoryWindowType.LAST_INTERVAL)), |
|
|
value: this.historyTypes.LAST_INTERVAL |
|
|
value: this.historyTypes.LAST_INTERVAL |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.isEdit || !this.timewindow.history.hideFixedInterval) { |
|
|
if (this.isEdit || !this.timewindow.history?.hideFixedInterval) { |
|
|
this.historyTimewindowOptions.push({ |
|
|
this.historyTimewindowOptions.push({ |
|
|
name: this.translate.instant(historyWindowTypeTranslations.get(HistoryWindowType.FIXED)), |
|
|
name: this.translate.instant(historyWindowTypeTranslations.get(HistoryWindowType.FIXED)), |
|
|
value: this.historyTypes.FIXED |
|
|
value: this.historyTypes.FIXED |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.isEdit || !this.timewindow.history.hideQuickInterval) { |
|
|
if (this.isEdit || !this.timewindow.history?.hideQuickInterval) { |
|
|
this.historyTimewindowOptions.push({ |
|
|
this.historyTimewindowOptions.push({ |
|
|
name: this.translate.instant(historyWindowTypeTranslations.get(HistoryWindowType.INTERVAL)), |
|
|
name: this.translate.instant(historyWindowTypeTranslations.get(HistoryWindowType.INTERVAL)), |
|
|
value: this.historyTypes.INTERVAL |
|
|
value: this.historyTypes.INTERVAL |
|
|
@ -211,10 +213,10 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
|
|
|
|
|
|
this.realtimeTypeSelectionAvailable = this.realtimeTimewindowOptions.length > 1; |
|
|
this.realtimeTypeSelectionAvailable = this.realtimeTimewindowOptions.length > 1; |
|
|
this.historyTypeSelectionAvailable = this.historyTimewindowOptions.length > 1; |
|
|
this.historyTypeSelectionAvailable = this.historyTimewindowOptions.length > 1; |
|
|
this.realtimeIntervalSelectionAvailable = this.isEdit || !(this.timewindow.realtime.hideInterval || |
|
|
this.realtimeIntervalSelectionAvailable = this.isEdit || !(this.timewindow.realtime?.hideInterval || |
|
|
(this.timewindow.realtime.hideLastInterval && this.timewindow.realtime.hideQuickInterval)); |
|
|
(this.timewindow.realtime?.hideLastInterval && this.timewindow.realtime?.hideQuickInterval)); |
|
|
this.historyIntervalSelectionAvailable = this.isEdit || !(this.timewindow.history.hideInterval || |
|
|
this.historyIntervalSelectionAvailable = this.isEdit || !(this.timewindow.history?.hideInterval || |
|
|
(this.timewindow.history.hideLastInterval && this.timewindow.history.hideQuickInterval && this.timewindow.history.hideFixedInterval)); |
|
|
(this.timewindow.history?.hideLastInterval && this.timewindow.history?.hideQuickInterval && this.timewindow.history?.hideFixedInterval)); |
|
|
|
|
|
|
|
|
this.aggregationOptionsAvailable = this.aggregation && (this.isEdit || |
|
|
this.aggregationOptionsAvailable = this.aggregation && (this.isEdit || |
|
|
!(this.timewindow.hideAggregation && this.timewindow.hideAggInterval)); |
|
|
!(this.timewindow.hideAggregation && this.timewindow.hideAggInterval)); |
|
|
@ -230,28 +232,28 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
const aggregation = this.timewindow.aggregation; |
|
|
const aggregation = this.timewindow.aggregation; |
|
|
|
|
|
|
|
|
if (!this.isEdit) { |
|
|
if (!this.isEdit) { |
|
|
if (realtime.hideLastInterval && !realtime.hideQuickInterval) { |
|
|
if (realtime?.hideLastInterval && !realtime?.hideQuickInterval) { |
|
|
realtime.realtimeType = RealtimeWindowType.INTERVAL; |
|
|
realtime.realtimeType = RealtimeWindowType.INTERVAL; |
|
|
} |
|
|
} |
|
|
if (realtime.hideQuickInterval && !realtime.hideLastInterval) { |
|
|
if (realtime?.hideQuickInterval && !realtime?.hideLastInterval) { |
|
|
realtime.realtimeType = RealtimeWindowType.LAST_INTERVAL; |
|
|
realtime.realtimeType = RealtimeWindowType.LAST_INTERVAL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (history.hideLastInterval) { |
|
|
if (history?.hideLastInterval) { |
|
|
if (!history.hideFixedInterval) { |
|
|
if (!history.hideFixedInterval) { |
|
|
history.historyType = HistoryWindowType.FIXED; |
|
|
history.historyType = HistoryWindowType.FIXED; |
|
|
} else if (!history.hideQuickInterval) { |
|
|
} else if (!history.hideQuickInterval) { |
|
|
history.historyType = HistoryWindowType.INTERVAL; |
|
|
history.historyType = HistoryWindowType.INTERVAL; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (history.hideFixedInterval) { |
|
|
if (history?.hideFixedInterval) { |
|
|
if (!history.hideLastInterval) { |
|
|
if (!history.hideLastInterval) { |
|
|
history.historyType = HistoryWindowType.LAST_INTERVAL; |
|
|
history.historyType = HistoryWindowType.LAST_INTERVAL; |
|
|
} else if (!history.hideQuickInterval) { |
|
|
} else if (!history.hideQuickInterval) { |
|
|
history.historyType = HistoryWindowType.INTERVAL; |
|
|
history.historyType = HistoryWindowType.INTERVAL; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (history.hideQuickInterval) { |
|
|
if (history?.hideQuickInterval) { |
|
|
if (!history.hideLastInterval) { |
|
|
if (!history.hideLastInterval) { |
|
|
history.historyType = HistoryWindowType.LAST_INTERVAL; |
|
|
history.historyType = HistoryWindowType.LAST_INTERVAL; |
|
|
} else if (!history.hideFixedInterval) { |
|
|
} else if (!history.hideFixedInterval) { |
|
|
@ -265,29 +267,29 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
realtime: this.fb.group({ |
|
|
realtime: this.fb.group({ |
|
|
realtimeType: [{ |
|
|
realtimeType: [{ |
|
|
value: isDefined(realtime?.realtimeType) ? realtime.realtimeType : RealtimeWindowType.LAST_INTERVAL, |
|
|
value: isDefined(realtime?.realtimeType) ? realtime.realtimeType : RealtimeWindowType.LAST_INTERVAL, |
|
|
disabled: realtime.hideInterval |
|
|
disabled: realtime?.hideInterval |
|
|
}], |
|
|
}], |
|
|
timewindowMs: [{ |
|
|
timewindowMs: [{ |
|
|
value: isDefined(realtime?.timewindowMs) ? realtime.timewindowMs : null, |
|
|
value: isDefined(realtime?.timewindowMs) ? realtime.timewindowMs : MINUTE, |
|
|
disabled: realtime.hideInterval || realtime.hideLastInterval |
|
|
disabled: realtime?.hideInterval || realtime?.hideLastInterval |
|
|
}], |
|
|
}], |
|
|
interval: [{ |
|
|
interval: [{ |
|
|
value:isDefined(realtime?.interval) ? realtime.interval : null, |
|
|
value:isDefined(realtime?.interval) ? realtime.interval : null, |
|
|
disabled: hideAggInterval |
|
|
disabled: hideAggInterval |
|
|
}], |
|
|
}], |
|
|
quickInterval: [{ |
|
|
quickInterval: [{ |
|
|
value: isDefined(realtime?.quickInterval) ? realtime.quickInterval : null, |
|
|
value: isDefined(realtime?.quickInterval) ? realtime.quickInterval : QuickTimeInterval.CURRENT_DAY, |
|
|
disabled: realtime.hideInterval || realtime.hideQuickInterval |
|
|
disabled: realtime?.hideInterval || realtime?.hideQuickInterval |
|
|
}] |
|
|
}] |
|
|
}), |
|
|
}), |
|
|
history: this.fb.group({ |
|
|
history: this.fb.group({ |
|
|
historyType: [{ |
|
|
historyType: [{ |
|
|
value: isDefined(history?.historyType) ? history.historyType : HistoryWindowType.LAST_INTERVAL, |
|
|
value: isDefined(history?.historyType) ? history.historyType : HistoryWindowType.LAST_INTERVAL, |
|
|
disabled: history.hideInterval |
|
|
disabled: history?.hideInterval |
|
|
}], |
|
|
}], |
|
|
timewindowMs: [{ |
|
|
timewindowMs: [{ |
|
|
value: isDefined(history?.timewindowMs) ? history.timewindowMs : null, |
|
|
value: isDefined(history?.timewindowMs) ? history.timewindowMs : MINUTE, |
|
|
disabled: history.hideInterval || history.hideLastInterval |
|
|
disabled: history?.hideInterval || history?.hideLastInterval |
|
|
}], |
|
|
}], |
|
|
interval: [{ |
|
|
interval: [{ |
|
|
value:isDefined(history?.interval) ? history.interval : null, |
|
|
value:isDefined(history?.interval) ? history.interval : null, |
|
|
@ -296,11 +298,11 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
fixedTimewindow: [{ |
|
|
fixedTimewindow: [{ |
|
|
value: isDefined(history?.fixedTimewindow) && this.timewindow.selectedTab === TimewindowType.HISTORY |
|
|
value: isDefined(history?.fixedTimewindow) && this.timewindow.selectedTab === TimewindowType.HISTORY |
|
|
&& history.historyType === HistoryWindowType.FIXED ? history.fixedTimewindow : null, |
|
|
&& history.historyType === HistoryWindowType.FIXED ? history.fixedTimewindow : null, |
|
|
disabled: history.hideInterval || history.hideFixedInterval |
|
|
disabled: history?.hideInterval || history?.hideFixedInterval |
|
|
}], |
|
|
}], |
|
|
quickInterval: [{ |
|
|
quickInterval: [{ |
|
|
value: isDefined(history?.quickInterval) ? history.quickInterval : null, |
|
|
value: isDefined(history?.quickInterval) ? history.quickInterval : QuickTimeInterval.CURRENT_DAY, |
|
|
disabled: history.hideInterval || history.hideQuickInterval |
|
|
disabled: history?.hideInterval || history?.hideQuickInterval |
|
|
}] |
|
|
}] |
|
|
}), |
|
|
}), |
|
|
aggregation: this.fb.group({ |
|
|
aggregation: this.fb.group({ |
|
|
@ -380,6 +382,7 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
takeUntil(this.destroy$) |
|
|
takeUntil(this.destroy$) |
|
|
).subscribe(() => { |
|
|
).subscribe(() => { |
|
|
this.prepareTimewindowConfig(); |
|
|
this.prepareTimewindowConfig(); |
|
|
|
|
|
this.clearTimewindowConfig(); |
|
|
this.changeTimewindow.emit(this.timewindow); |
|
|
this.changeTimewindow.emit(this.timewindow); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -407,6 +410,7 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
|
|
|
|
|
|
update() { |
|
|
update() { |
|
|
this.prepareTimewindowConfig(); |
|
|
this.prepareTimewindowConfig(); |
|
|
|
|
|
this.clearTimewindowConfig(); |
|
|
this.result = this.timewindow; |
|
|
this.result = this.timewindow; |
|
|
this.overlayRef?.dispose(); |
|
|
this.overlayRef?.dispose(); |
|
|
} |
|
|
} |
|
|
@ -414,21 +418,25 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
private prepareTimewindowConfig() { |
|
|
private prepareTimewindowConfig() { |
|
|
const timewindowFormValue = this.timewindowForm.getRawValue(); |
|
|
const timewindowFormValue = this.timewindowForm.getRawValue(); |
|
|
this.timewindow.selectedTab = timewindowFormValue.selectedTab; |
|
|
this.timewindow.selectedTab = timewindowFormValue.selectedTab; |
|
|
this.timewindow.realtime = {...this.timewindow.realtime, ...{ |
|
|
if (this.timewindow.selectedTab === TimewindowType.REALTIME) { |
|
|
realtimeType: timewindowFormValue.realtime.realtimeType, |
|
|
this.timewindow.realtime = {...this.timewindow.realtime, ...{ |
|
|
timewindowMs: timewindowFormValue.realtime.timewindowMs, |
|
|
realtimeType: timewindowFormValue.realtime.realtimeType, |
|
|
quickInterval: timewindowFormValue.realtime.quickInterval, |
|
|
timewindowMs: timewindowFormValue.realtime.timewindowMs, |
|
|
interval: timewindowFormValue.realtime.interval |
|
|
quickInterval: timewindowFormValue.realtime.quickInterval, |
|
|
}}; |
|
|
}}; |
|
|
this.timewindow.history = {...this.timewindow.history, ...{ |
|
|
} else { |
|
|
historyType: timewindowFormValue.history.historyType, |
|
|
this.timewindow.history = {...this.timewindow.history, ...{ |
|
|
timewindowMs: timewindowFormValue.history.timewindowMs, |
|
|
historyType: timewindowFormValue.history.historyType, |
|
|
interval: timewindowFormValue.history.interval, |
|
|
timewindowMs: timewindowFormValue.history.timewindowMs, |
|
|
fixedTimewindow: timewindowFormValue.history.fixedTimewindow, |
|
|
fixedTimewindow: timewindowFormValue.history.fixedTimewindow, |
|
|
quickInterval: timewindowFormValue.history.quickInterval, |
|
|
quickInterval: timewindowFormValue.history.quickInterval, |
|
|
}}; |
|
|
}}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (this.aggregation) { |
|
|
if (this.aggregation) { |
|
|
|
|
|
this.timewindow.realtime.interval = timewindowFormValue.realtime.interval; |
|
|
|
|
|
this.timewindow.history.interval = timewindowFormValue.history.interval; |
|
|
|
|
|
|
|
|
this.timewindow.aggregation = { |
|
|
this.timewindow.aggregation = { |
|
|
type: timewindowFormValue.aggregation.type, |
|
|
type: timewindowFormValue.aggregation.type, |
|
|
limit: timewindowFormValue.aggregation.limit |
|
|
limit: timewindowFormValue.aggregation.limit |
|
|
@ -439,6 +447,10 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private clearTimewindowConfig() { |
|
|
|
|
|
clearTimewindowConfig(this.timewindow, this.quickIntervalOnly, this.historyOnly, this.aggregation, this.timezone); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private updateTimewindowForm() { |
|
|
private updateTimewindowForm() { |
|
|
this.timewindowForm.patchValue(this.timewindow, {emitEvent: false}); |
|
|
this.timewindowForm.patchValue(this.timewindow, {emitEvent: false}); |
|
|
this.updateValidators(this.timewindowForm.get('aggregation.type').value); |
|
|
this.updateValidators(this.timewindowForm.get('aggregation.type').value); |
|
|
@ -568,12 +580,12 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private updateTimewindowAdvancedParams() { |
|
|
private updateTimewindowAdvancedParams() { |
|
|
this.realtimeDisableCustomInterval = this.timewindow.realtime.disableCustomInterval; |
|
|
this.realtimeDisableCustomInterval = this.timewindow.realtime?.disableCustomInterval; |
|
|
this.realtimeDisableCustomGroupInterval = this.timewindow.realtime.disableCustomGroupInterval; |
|
|
this.realtimeDisableCustomGroupInterval = this.timewindow.realtime?.disableCustomGroupInterval; |
|
|
this.historyDisableCustomInterval = this.timewindow.history.disableCustomInterval; |
|
|
this.historyDisableCustomInterval = this.timewindow.history?.disableCustomInterval; |
|
|
this.historyDisableCustomGroupInterval = this.timewindow.history.disableCustomGroupInterval; |
|
|
this.historyDisableCustomGroupInterval = this.timewindow.history?.disableCustomGroupInterval; |
|
|
|
|
|
|
|
|
if (this.timewindow.realtime.advancedParams) { |
|
|
if (this.timewindow.realtime?.advancedParams) { |
|
|
this.realtimeAdvancedParams = this.timewindow.realtime.advancedParams; |
|
|
this.realtimeAdvancedParams = this.timewindow.realtime.advancedParams; |
|
|
this.realtimeAllowedLastIntervals = this.timewindow.realtime.advancedParams.allowedLastIntervals; |
|
|
this.realtimeAllowedLastIntervals = this.timewindow.realtime.advancedParams.allowedLastIntervals; |
|
|
this.realtimeAllowedQuickIntervals = this.timewindow.realtime.advancedParams.allowedQuickIntervals; |
|
|
this.realtimeAllowedQuickIntervals = this.timewindow.realtime.advancedParams.allowedQuickIntervals; |
|
|
@ -582,7 +594,7 @@ export class TimewindowPanelComponent extends PageComponent implements OnInit, O |
|
|
this.realtimeAllowedLastIntervals = null; |
|
|
this.realtimeAllowedLastIntervals = null; |
|
|
this.realtimeAllowedQuickIntervals = null; |
|
|
this.realtimeAllowedQuickIntervals = null; |
|
|
} |
|
|
} |
|
|
if (this.timewindow.history.advancedParams) { |
|
|
if (this.timewindow.history?.advancedParams) { |
|
|
this.historyAdvancedParams = this.timewindow.history.advancedParams; |
|
|
this.historyAdvancedParams = this.timewindow.history.advancedParams; |
|
|
this.historyAllowedLastIntervals = this.timewindow.history.advancedParams.allowedLastIntervals; |
|
|
this.historyAllowedLastIntervals = this.timewindow.history.advancedParams.allowedLastIntervals; |
|
|
this.historyAllowedQuickIntervals = this.timewindow.history.advancedParams.allowedQuickIntervals; |
|
|
this.historyAllowedQuickIntervals = this.timewindow.history.advancedParams.allowedQuickIntervals; |
|
|
|