From 53c41707bfe47965be40d23e325bf9c5e542fac7 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 29 May 2025 12:14:34 +0300 Subject: [PATCH 1/3] UI: Fixed typo; change logics clear units in panel --- .../components/unit-settings-panel.component.ts | 8 +++++++- .../src/app/shared/models/widget-settings.models.ts | 4 +--- ui-ngx/src/assets/locale/locale.constant-en_US.json | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) 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 e3f67fe8f7..369706b578 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5924,7 +5924,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", @@ -6180,8 +6180,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", @@ -6216,7 +6216,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", @@ -6398,9 +6398,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" From e22da2e206005960384ef6943f6ce8571bdadcab Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 29 May 2025 12:15:58 +0300 Subject: [PATCH 2/3] UI: Disable UnitConversion in state chart widgets --- .../basic/chart/time-series-chart-basic-config.component.html | 4 +++- .../chart/time-series-chart-widget-settings.component.html | 4 +++- .../chart/time-series-chart-threshold-row.component.html | 3 ++- .../common/chart/time-series-chart-threshold-row.component.ts | 4 ++++ .../chart/time-series-chart-thresholds-panel.component.html | 1 + .../chart/time-series-chart-thresholds-panel.component.ts | 4 ++++ .../chart/time-series-chart-y-axes-panel.component.html | 1 + .../common/chart/time-series-chart-y-axes-panel.component.ts | 4 ++++ .../common/chart/time-series-chart-y-axis-row.component.html | 2 +- .../common/chart/time-series-chart-y-axis-row.component.ts | 4 ++++ 10 files changed, 27 insertions(+), 4 deletions(-) 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 61c9f89c7c..4e635f476e 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/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 9bbe3f6ec6..807755d3f0 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(); From 6f31165f6027ac9c876323ba63803ca8bfed7123 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 29 May 2025 13:25:34 +0300 Subject: [PATCH 3/3] UI: Fixed entities table widgets value formatter for legacy config --- .../widget/lib/entity/entities-table-widget.component.ts | 6 +++--- .../home/components/widget/lib/table-widget.models.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 93d9d09b6d..f95c8c26d7 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} = {}; @@ -760,7 +760,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) { @@ -768,7 +768,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/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;