diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-key-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-key-row.component.ts
index d790b1d477..2fee7a3a27 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-key-row.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-key-row.component.ts
@@ -40,8 +40,6 @@ import {
} from '@shared/models/widget.models';
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
import { AggregationType } from '@shared/models/time/time.models';
-import { TranslateService } from '@ngx-translate/core';
-import { TruncatePipe } from '@shared/pipe/truncate.pipe';
import {
DataKeyConfigDialogComponent,
DataKeyConfigDialogData
@@ -55,6 +53,7 @@ import {
import { WidgetConfigCallbacks } from '@home/components/widget/config/widget-config.component.models';
import { FormProperty } from '@shared/models/dynamic-form.models';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
+import { getSourceTbUnitSymbol, TbUnit } from '@shared/models/unit.models';
@Component({
selector: 'tb-aggregated-data-key-row',
@@ -119,17 +118,11 @@ export class AggregatedDataKeyRowComponent implements ControlValueAccessor, OnIn
return this.widgetConfigComponent.modelValue?.latestDataKeySettingsDirective;
}
- get isEntityDatasource(): boolean {
- return [DatasourceType.device, DatasourceType.entity].includes(this.datasourceType);
- }
-
private propagateChange = (_val: any) => {};
constructor(private fb: UntypedFormBuilder,
private dialog: MatDialog,
private cd: ChangeDetectorRef,
- public translate: TranslateService,
- public truncate: TruncatePipe,
private widgetConfigComponent: WidgetConfigComponent,
private destroyRef: DestroyRef) {
}
@@ -222,7 +215,8 @@ export class AggregatedDataKeyRowComponent implements ControlValueAccessor, OnIn
callbacks: this.callbacks,
hideDataKeyName: true,
hideDataKeyLabel: true,
- hideDataKeyColor: true
+ hideDataKeyColor: true,
+ supportsUnitConversion: true
}
}).afterClosed().subscribe((updatedDataKey) => {
if (updatedDataKey) {
@@ -253,8 +247,8 @@ export class AggregatedDataKeyRowComponent implements ControlValueAccessor, OnIn
}
private _valuePreviewFn(): string {
- const units: string = this.keyRowFormGroup.get('units').value;
+ const units: TbUnit = this.keyRowFormGroup.get('units').value;
const decimals: number = this.keyRowFormGroup.get('decimals').value;
- return formatValue(22, decimals, units, true);
+ return formatValue(22, decimals, getSourceTbUnitSymbol(units), true);
}
}
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-keys-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-keys-panel.component.ts
index f8e22d54dc..b67941e368 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-keys-panel.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-data-keys-panel.component.ts
@@ -15,7 +15,6 @@
///
import {
- ChangeDetectorRef,
Component,
DestroyRef,
forwardRef,
@@ -33,11 +32,9 @@ import {
UntypedFormBuilder,
UntypedFormGroup
} from '@angular/forms';
-import { MatDialog } from '@angular/material/dialog';
import { WidgetConfigComponent } from '@home/components/widget/widget-config.component';
-import { DataKey, DatasourceType, widgetType } from '@shared/models/widget.models';
+import { DataKey, DatasourceType } from '@shared/models/widget.models';
import { DataKeyType } from '@shared/models/telemetry/telemetry.models';
-import { UtilsService } from '@core/services/utils.service';
import { DataKeysCallbacks } from '@home/components/widget/lib/settings/common/key/data-keys.component.models';
import { aggregatedValueCardDefaultKeySettings } from '@home/components/widget/lib/cards/aggregated-value-card.models';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -70,25 +67,13 @@ export class AggregatedDataKeysPanelComponent implements ControlValueAccessor, O
keysListFormGroup: UntypedFormGroup;
- get widgetType(): widgetType {
- return this.widgetConfigComponent.widgetType;
- }
-
get callbacks(): DataKeysCallbacks {
return this.widgetConfigComponent.widgetConfigCallbacks;
}
- get noKeys(): boolean {
- const keys: DataKey[] = this.keysListFormGroup.get('keys').value;
- return keys.length === 0;
- }
-
private propagateChange = (_val: any) => {};
constructor(private fb: UntypedFormBuilder,
- private dialog: MatDialog,
- private cd: ChangeDetectorRef,
- private utils: UtilsService,
private widgetConfigComponent: WidgetConfigComponent,
private destroyRef: DestroyRef) {
}
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-value-card-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-value-card-basic-config.component.html
index 4bc8059906..738dad0210 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-value-card-basic-config.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/aggregated-value-card-basic-config.component.html
@@ -111,7 +111,7 @@
{{ 'widgets.aggregated-value-card.chart' | translate }}
-
+
widget-config.decimals-suffix
diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/label-value-card-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/label-value-card-basic-config.component.html
index 809b12ee83..f205a2b00c 100644
--- a/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/label-value-card-basic-config.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/cards/label-value-card-basic-config.component.html
@@ -72,7 +72,7 @@