Browse Source

Timewindow: take into account allowed options on timewindow type change

pull/12151/head
Chantsova Ekaterina 2 years ago
parent
commit
a77e5d93ee
  1. 48
      ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts

48
ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts

@ -349,23 +349,43 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On
if (selectedTab === TimewindowType.REALTIME) { if (selectedTab === TimewindowType.REALTIME) {
if (timewindowFormValue.history.historyType !== HistoryWindowType.FIXED if (timewindowFormValue.history.historyType !== HistoryWindowType.FIXED
&& !(this.quickIntervalOnly && timewindowFormValue.history.historyType === HistoryWindowType.LAST_INTERVAL)) { && !(this.quickIntervalOnly && timewindowFormValue.history.historyType === HistoryWindowType.LAST_INTERVAL)) {
const allowedLastIntervals = timewindowFormValue.realtime.allowedLastIntervals;
this.timewindowForm.get('realtime').patchValue({ const allowedQuickIntervals = timewindowFormValue.realtime.allowedQuickIntervals;
realtimeType: Object.keys(RealtimeWindowType).includes(HistoryWindowType[timewindowFormValue.history.historyType]) ? // this.timewindowForm.get('realtime').patchValue({
RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]] : // realtimeType: Object.keys(RealtimeWindowType).includes(HistoryWindowType[timewindowFormValue.history.historyType]) ?
timewindowFormValue.realtime.realtimeType, // RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]] :
timewindowMs: timewindowFormValue.history.timewindowMs, // timewindowFormValue.realtime.realtimeType,
quickInterval: timewindowFormValue.history.quickInterval.startsWith('CURRENT') ? // timewindowMs: timewindowFormValue.history.timewindowMs,
timewindowFormValue.history.quickInterval : timewindowFormValue.realtime.quickInterval // quickInterval: timewindowFormValue.history.quickInterval.startsWith('CURRENT') ?
}); // timewindowFormValue.history.quickInterval : timewindowFormValue.realtime.quickInterval
// });
if (Object.keys(RealtimeWindowType).includes(HistoryWindowType[timewindowFormValue.history.historyType])) {
this.timewindowForm.get('realtime.realtimeType').patchValue(RealtimeWindowType[HistoryWindowType[timewindowFormValue.history.historyType]]);
}
if (!allowedLastIntervals?.length || allowedLastIntervals.includes(timewindowFormValue.history.timewindowMs)) {
this.timewindowForm.get('realtime.timewindowMs').patchValue(timewindowFormValue.history.timewindowMs);
}
if (allowedQuickIntervals?.includes(timewindowFormValue.history.quickInterval) ||
(!allowedQuickIntervals?.length && timewindowFormValue.history.quickInterval.startsWith('CURRENT'))) {
this.timewindowForm.get('realtime.quickInterval').patchValue(timewindowFormValue.history.quickInterval);
}
setTimeout(() => this.timewindowForm.get('realtime.interval').patchValue(timewindowFormValue.history.interval)); setTimeout(() => this.timewindowForm.get('realtime.interval').patchValue(timewindowFormValue.history.interval));
} }
} else { } else {
this.timewindowForm.get('history').patchValue({ const allowedLastIntervals = timewindowFormValue.history.allowedLastIntervals;
historyType: HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]], const allowedQuickIntervals = timewindowFormValue.history.allowedQuickIntervals;
timewindowMs: timewindowFormValue.realtime.timewindowMs, // this.timewindowForm.get('history').patchValue({
quickInterval: timewindowFormValue.realtime.quickInterval // historyType: HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]],
}); // timewindowMs: timewindowFormValue.realtime.timewindowMs,
// quickInterval: timewindowFormValue.realtime.quickInterval
// });
this.timewindowForm.get('history.historyType').patchValue(HistoryWindowType[RealtimeWindowType[timewindowFormValue.realtime.realtimeType]]);
if (!allowedLastIntervals?.length || allowedLastIntervals?.includes(timewindowFormValue.realtime.timewindowMs)) {
this.timewindowForm.get('history.timewindowMs').patchValue(timewindowFormValue.realtime.timewindowMs);
}
if (!allowedQuickIntervals?.length || allowedQuickIntervals?.includes(timewindowFormValue.realtime.quickInterval)) {
this.timewindowForm.get('history.quickInterval').patchValue(timewindowFormValue.realtime.quickInterval);
}
setTimeout(() => this.timewindowForm.get('history.interval').patchValue(timewindowFormValue.realtime.interval)); setTimeout(() => this.timewindowForm.get('history.interval').patchValue(timewindowFormValue.realtime.interval));
} }
this.timewindowForm.patchValue({ this.timewindowForm.patchValue({

Loading…
Cancel
Save