diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/time-series-chart-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/time-series-chart-basic-config.component.html index ddf7216896..8c29f2d034 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/time-series-chart-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/chart/time-series-chart-basic-config.component.html @@ -104,6 +104,7 @@ + [yAxisIds]="yAxisIds" + [supportsUnitConversion]="widgetConfig.typeParameters.supportsUnitConversion">
widget-config.appearance
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts index fadd5c7679..82537384a1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts @@ -167,7 +167,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni private defaultPageSize; private defaultSortOrder = 'entityName'; - private contentsInfo: {[key: string]: CellContentInfo} = {}; + private contentsInfo: {[key: string]: WithOptional} = {}; private stylesInfo: {[key: string]: Observable} = {}; private columnWidth: {[key: string]: string} = {}; private columnDefaultVisibility: {[key: string]: boolean} = {}; @@ -759,7 +759,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni return content$; } - private defaultContent(key: EntityColumn, contentInfo: CellContentInfo, value: any): any { + private defaultContent(key: EntityColumn, contentInfo: WithOptional, value: any): any { if (isDefined(value)) { const entityField = entityFields[key.name]; if (entityField) { @@ -767,7 +767,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni return this.datePipe.transform(value, 'yyyy-MM-dd HH:mm:ss'); } } - return contentInfo.valueFormat.format(value); + return contentInfo.valueFormat?.format(value) ?? value; } else { return ''; } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.html index e433a7d739..a433f3af02 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.html @@ -63,6 +63,7 @@ + [yAxisIds]="yAxisIds" + [supportsUnitConversion]="widgetConfig.typeParameters.supportsUnitConversion">
widgets.time-series-chart.chart-style
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.html index c017d3bc0a..bc7185c476 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-row.component.html @@ -89,7 +89,8 @@
- +
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-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 bfa10c68d1..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/table-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts index ca57a9e26a..7e91a2f043 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts @@ -107,7 +107,7 @@ export interface CellContentFunctionInfo { export interface CellContentInfo { contentFunction: Observable; - valueFormat?: ValueFormatProcessor + valueFormat: ValueFormatProcessor } export type CellStyleFunction = (...args: any[]) => any; diff --git a/ui-ngx/src/app/shared/components/unit-settings-panel.component.ts b/ui-ngx/src/app/shared/components/unit-settings-panel.component.ts index f378ec59f0..9d32abd46e 100644 --- a/ui-ngx/src/app/shared/components/unit-settings-panel.component.ts +++ b/ui-ngx/src/app/shared/components/unit-settings-panel.component.ts @@ -139,7 +139,13 @@ export class UnitSettingsPanelComponent implements OnInit { } clearUnit() { - this.unitSettingsApplied.emit(null); + this.unitSettingForm.reset({ + convertUnit: false + }); + if (this.required) { + this.unitSettingForm.markAllAsTouched(); + } + this.unitSettingForm.markAsDirty(); } cancel() { diff --git a/ui-ngx/src/app/shared/models/widget-settings.models.ts b/ui-ngx/src/app/shared/models/widget-settings.models.ts index 193a18cf89..a9f3cd2ed8 100644 --- a/ui-ngx/src/app/shared/models/widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/widget-settings.models.ts @@ -907,8 +907,6 @@ export abstract class ValueFormatProcessor { export class SimpleValueFormatProcessor extends ValueFormatProcessor { - private readonly isDefinedUnit: boolean; - constructor(protected settings: ValueFormatSettings) { super(settings); this.unitSymbol = !settings.ignoreUnitSymbol && isNotEmptyStr(settings.units) ? (settings.units as string) : null; @@ -917,7 +915,7 @@ export class SimpleValueFormatProcessor extends ValueFormatProcessor { } format(value: any): string { - if (isDefinedAndNotNull(value) && isNumeric(value) && (this.isDefinedDecimals || this.isDefinedUnit || Number(value).toString() === value)) { + if (isDefinedAndNotNull(value) && isNumeric(value) && (this.isDefinedDecimals || this.unitSymbol || Number(value).toString() === value)) { return this.formatValue(Number(value)); } return value ?? ''; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 5e252701d7..9e985c53d6 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5938,7 +5938,7 @@ "energy-density": "Energy density", "force": "Force", "frequency": "Frequency", - "fuel-efficiency": "fuel efficiency", + "fuel-efficiency": "Fuel efficiency", "heat-capacity": "Heat capacity", "illuminance": "Illuminance", "inductance": "Inductance", @@ -6194,8 +6194,8 @@ "volt": "Volt", "kilovolt": "Kilovolt", "megavolt": "Megavolt", - "dbmV": "dBmV", - "dbm": "dBm", + "dbmV": "Decibel volt", + "dbm": "Decibel-milliwatts", "volt-meter": "Volt-Meter", "kilovolt-meter": "Kilovolt-Meter", "megavolt-meter": "Megavolt-Meter", @@ -6230,7 +6230,7 @@ "millimole": "Millimole", "kilomole": "Kilomole", "mole-per-cubic-meter": "Mole per Cubic Meter", - "rssi": "RSSI", + "rssi": "Received signal strength indicator", "ppm": "Parts Per Million", "ppb": "Parts Per Billion", "micrograms-per-cubic-meter": "Micrograms per Cubic Meter", @@ -6412,9 +6412,9 @@ "radian-per-second": "Radian per second", "radian-per-second-squared": "Radian per second squared", "revolutions-per-minute-per-second": "Angular acceleration", - "deg-per-second": "deg/s", + "deg-per-second": "Degrees per second", "rotation-per-minute": "Rotation per minute", - "degrees-brix": "Degrees Brix", + "degrees-brix": "Degrees brix", "katal": "Katal", "katal-per-cubic-metre": "Katal per Cubic Metre", "paris-inch": "Paris inch"