diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.ts
index c57b5b2557..1d7497f70a 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.ts
@@ -106,6 +106,10 @@ export class TimeSeriesChartThresholdRowComponent implements ControlValueAccesso
@coerceBoolean()
hideYAxis = false;
+ @Input()
+ @coerceBoolean()
+ supportsUnitConversion = false;
+
@Output()
thresholdRemoved = new EventEmitter();
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.html
index 50b224765e..b36192e728 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.html
@@ -31,6 +31,7 @@
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.ts
index 47b6f98cbb..62bcba3cad 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings-panel.component.ts
@@ -28,12 +28,14 @@ import { WidgetConfig } from '@shared/models/widget.models';
import { formatValue, isDefinedAndNotNull } from '@core/utils';
import { coerceBoolean } from '@shared/decorators/coercion';
import {
- chartLineTypes, chartLineTypeTranslations,
+ chartLineTypes,
+ chartLineTypeTranslations,
ChartShape,
chartShapes,
chartShapeTranslations
} from '@home/components/widget/lib/chart/chart.models';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
+import { getSourceTbUnitSymbol, isNotEmptyTbUnits, TbUnit } from '@shared/models/unit.models';
@Component({
selector: 'tb-time-series-chart-threshold-settings-panel',
@@ -163,11 +165,11 @@ export class TimeSeriesChartThresholdSettingsPanelComponent implements OnInit {
}
private _labelPreviewFn(): string {
- let units: string = this.thresholdSettingsFormGroup.get('units').value;
- units = units && units.length ? units : this.widgetConfig.units;
+ let units: TbUnit = this.thresholdSettingsFormGroup.get('units').value;
+ units = isNotEmptyTbUnits(units) ? units : this.widgetConfig.units;
let decimals: number = this.thresholdSettingsFormGroup.get('decimals').value;
decimals = isDefinedAndNotNull(decimals) ? decimals :
(isDefinedAndNotNull(this.widgetConfig.decimals) ? this.widgetConfig.decimals : 2);
- return formatValue(22, decimals, units, false);
+ return formatValue(22, decimals, getSourceTbUnitSymbol(units), false);
}
}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.html
index 8c5c1dd92f..efd87a4d76 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.html
@@ -33,6 +33,7 @@
[formControl]="thresholdControl"
[hideYAxis]="hideYAxis"
[yAxisIds]="yAxisIds"
+ [supportsUnitConversion]="supportsUnitConversion"
(thresholdRemoved)="removeThreshold($index)">
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.ts
index 4a9a01edf0..9d07ecda88 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-thresholds-panel.component.ts
@@ -84,6 +84,10 @@ export class TimeSeriesChartThresholdsPanelComponent implements ControlValueAcce
@coerceBoolean()
hideYAxis = false;
+ @Input()
+ @coerceBoolean()
+ supportsUnitConversion = true;
+
thresholdsFormGroup: UntypedFormGroup;
private propagateChange = (_val: any) => {};
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.html
index 533ee3fb05..c88dc9c4b9 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.html
@@ -39,6 +39,7 @@
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.ts
index 9c210fc28d..12ac24f9e3 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axes-panel.component.ts
@@ -75,6 +75,10 @@ export class TimeSeriesChartYAxesPanelComponent implements ControlValueAccessor,
@coerceBoolean()
advanced = false;
+ @Input()
+ @coerceBoolean()
+ supportsUnitConversion = false;
+
@Output()
axisRemoved = new EventEmitter();
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.html
index 1b31ad2b59..420e834106 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.html
@@ -41,7 +41,7 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts
index dec7148b30..ebc24ddd22 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts
@@ -69,6 +69,10 @@ export class TimeSeriesChartYAxisRowComponent implements ControlValueAccessor, O
@coerceBoolean()
advanced = false;
+ @Input()
+ @coerceBoolean()
+ supportsUnitConversion = false;
+
@Output()
axisRemoved = new EventEmitter();
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-panel.component.html
index af59457abe..5dbeb8b646 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-panel.component.html
@@ -386,6 +386,11 @@
+
+
+ {{ 'dynamic-form.property.support-unit-conversion' | translate }}
+
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts
index 2b11c62632..829402a53f 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config-dialog.component.ts
@@ -56,6 +56,7 @@ export interface DataKeyConfigDialogData {
hideDataKeyColor?: boolean;
hideDataKeyUnits?: boolean;
hideDataKeyDecimals?: boolean;
+ supportsUnitConversion?: boolean
}
@Component({
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html
index 0af5159846..73c1865cc2 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.html
@@ -49,6 +49,7 @@
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts
index c85a8f0ba6..c7b65bfc83 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-key-config.component.ts
@@ -153,6 +153,10 @@ export class DataKeyConfigComponent extends PageComponent implements OnInit, Con
@coerceBoolean()
hideDataKeyDecimals = false;
+ @Input()
+ @coerceBoolean()
+ supportsUnitConversion = false;
+
@ViewChild('keyInput') keyInput: ElementRef;
@ViewChild('funcBodyEdit', {static: false}) funcBodyEdit: JsFuncComponent;
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts
index a9be1fd352..a1c388845f 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts
@@ -169,6 +169,10 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, OnChange
@coerceBoolean()
simpleDataKeysLabel = false;
+ @Input()
+ @coerceBoolean()
+ supportsUnitConversion = false;
+
@Input()
aliasController: IAliasController;
@@ -610,7 +614,8 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, OnChange
hideDataKeyLabel: this.hideDataKeyLabel,
hideDataKeyColor: this.hideDataKeyColor,
hideDataKeyUnits: this.hideDataKeyUnits,
- hideDataKeyDecimals: this.hideDataKeyDecimals
+ hideDataKeyDecimals: this.hideDataKeyDecimals,
+ supportsUnitConversion: this.supportsUnitConversion
}
}).afterClosed().subscribe((updatedDataKey) => {
if (updatedDataKey) {
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/knob-control-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/knob-control-widget-settings.component.html
index 6d2dfe2187..5016361604 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/knob-control-widget-settings.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/knob-control-widget-settings.component.html
@@ -15,66 +15,66 @@
limitations under the License.
-->
-