diff --git a/ui-ngx/src/app/core/api/entity-data-subscription.ts b/ui-ngx/src/app/core/api/entity-data-subscription.ts
index 75c4e0b922..4dc0e7c4e1 100644
--- a/ui-ngx/src/app/core/api/entity-data-subscription.ts
+++ b/ui-ngx/src/app/core/api/entity-data-subscription.ts
@@ -1033,7 +1033,7 @@ export class EntityDataSubscription {
isLatestDataAgg,
subsTw,
this.utils,
- this.entityDataSubscriptionOptions.ignoreDataUpdateOnIntervalTick
+ this.entityDataSubscriptionOptions.ignoreDataUpdateOnIntervalTick || isLatestDataAgg
);
}
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
index 1659ee636d..3adb2d4fb6 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html
@@ -34,6 +34,8 @@
style="padding-right: 8px;">widget-config.timewindow
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
index 7d82a6ca02..2286510ba3 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts
@@ -20,7 +20,7 @@ import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import {
DataKey,
- Datasource, datasourcesHasAggregation,
+ Datasource, datasourcesHasAggregation, datasourcesHasOnlyComparisonAggregation,
DatasourceType,
datasourceTypeTranslationMap,
defaultLegendConfig,
@@ -743,6 +743,15 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont
}
}
+ public onlyHistoryTimewindow(): boolean {
+ if (this.widgetType === widgetType.latest) {
+ const datasources = this.dataSettings.get('datasources').value;
+ return datasourcesHasOnlyComparisonAggregation(datasources);
+ } else {
+ return false;
+ }
+ }
+
public onDatasourceDrop(event: CdkDragDrop) {
const datasourcesFormArray = this.datasourcesFormArray();
const datasourceForm = datasourcesFormArray.at(event.previousIndex);
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html
index 9f99ffbf29..ad8f65a48b 100644
--- a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html
@@ -47,6 +47,8 @@
{
+ this.notifyChanged();
+ });
+ } else {
+ this.updateDisplayValue();
+ }
}
notifyChanged() {
@@ -309,7 +343,7 @@ export class TimewindowComponent implements OnInit, OnDestroy, ControlValueAcces
this.millisecondsToTimeStringPipe.transform(this.innerValue.realtime.timewindowMs);
}
} else {
- this.innerValue.displayValue = !this.historyOnly ? (this.translate.instant('timewindow.history') + ' - ') : '';
+ this.innerValue.displayValue = (!this.historyOnly || this.alwaysDisplayTypePrefix) ? (this.translate.instant('timewindow.history') + ' - ') : '';
if (this.innerValue.history.historyType === HistoryWindowType.LAST_INTERVAL) {
this.innerValue.displayValue += this.translate.instant('timewindow.last-prefix') + ' ' +
this.millisecondsToTimeStringPipe.transform(this.innerValue.history.timewindowMs);
diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts
index c654c87784..0472949680 100644
--- a/ui-ngx/src/app/shared/models/widget.models.ts
+++ b/ui-ngx/src/app/shared/models/widget.models.ts
@@ -367,6 +367,23 @@ export function datasourcesHasAggregation(datasources?: Array): bool
return false;
}
+export function datasourcesHasOnlyComparisonAggregation(datasources?: Array): boolean {
+ if (!datasourcesHasAggregation(datasources)) {
+ return false;
+ }
+ if (datasources) {
+ const foundDatasource = datasources.find(datasource => {
+ const found = datasource.dataKeys && datasource.dataKeys.find(key => key.type === DataKeyType.timeseries &&
+ key.aggregationType && key.aggregationType !== AggregationType.NONE && !key.comparisonEnabled);
+ return !!found;
+ });
+ if (foundDatasource) {
+ return false;
+ }
+ }
+ return true;
+}
+
export interface FormattedData {
$datasource: Datasource;
entityName: string;