From 665871c1d09ec03a465aeeb4f2798d82c36574c5 Mon Sep 17 00:00:00 2001 From: Tarnavskiy Date: Fri, 28 Mar 2025 16:20:29 +0200 Subject: [PATCH 01/11] PROD-5908: Fixed bug with empty step-increment field. Fixed adaptation for small screen view --- .../alarm/alarms-table-widget-settings.component.html | 4 ++-- .../alarm/alarms-table-widget-settings.component.ts | 11 +++++++---- .../timeseries-table-widget-settings.component.html | 4 ++-- .../timeseries-table-widget-settings.component.ts | 11 +++++++---- .../persistent-table-widget-settings.component.html | 4 ++-- .../persistent-table-widget-settings.component.ts | 11 +++++++---- .../entities-table-widget-settings.component.html | 4 ++-- .../entities-table-widget-settings.component.ts | 11 +++++++---- ui-ngx/src/form.scss | 3 ++- 9 files changed, 38 insertions(+), 25 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html index ba613ddbfe..eec36b90fa 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html @@ -95,7 +95,7 @@ {{ 'widgets.table.display-pagination' | translate }}
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
@@ -113,7 +113,7 @@ warning - +
widgets.table.page-step-count
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
@@ -80,7 +80,7 @@ warning - +
widgets.table.page-step-count
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
@@ -67,7 +67,7 @@ warning - +
widgets.table.page-step-count
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
@@ -110,7 +110,7 @@ warning - +
widgets.table.page-step-count
Date: Fri, 28 Mar 2025 16:49:04 +0200 Subject: [PATCH 02/11] UI: Fix custom translation not working for Y-axis label in chart widget --- .../home/components/widget/lib/chart/time-series-chart.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts index 2b4b52ccfb..7bea76d325 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts @@ -793,7 +793,7 @@ export class TbTimeSeriesChart { } } else { if (!axis.option.name) { - axis.option.name = axis.settings.label; + axis.option.name = this.ctx.utilsService.customTranslation(axis.settings.label, axis.settings.label); result.changed = true; } const nameGap = size; From 4a811e978edd94525bb923584af3c7736d8b308e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 28 Mar 2025 18:35:06 +0200 Subject: [PATCH 03/11] UI: Fix map settings not updating when switching between different map type widgets --- .../common/map/map-settings.component.ts | 21 +++++++++++++++++-- .../map/map-widget-settings.component.ts | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts index f38f2a042c..5b949bae75 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, DestroyRef, forwardRef, Input, OnInit } from '@angular/core'; +import { Component, DestroyRef, forwardRef, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { ControlValueAccessor, NG_VALIDATORS, @@ -70,7 +70,7 @@ import { MatDialog } from '@angular/material/dialog'; } ] }) -export class MapSettingsComponent implements OnInit, ControlValueAccessor, Validator { +export class MapSettingsComponent implements OnInit, ControlValueAccessor, Validator, OnChanges { mapControlPositions = mapControlPositions; @@ -205,6 +205,23 @@ export class MapSettingsComponent implements OnInit, ControlValueAccessor, Valid } } + ngOnChanges(changes: SimpleChanges) { + if (changes.trip) { + const tripChange = changes.trip; + if (!tripChange.firstChange && tripChange.currentValue !== tripChange.previousValue) { + if (this.trip) { + this.dataLayerMode = 'trips' + this.mapSettingsFormGroup.addControl('trips', this.fb.control(this.modelValue.trips), {emitEvent: false}); + this.mapSettingsFormGroup.addControl('tripTimeline', this.fb.control(this.modelValue.tripTimeline), {emitEvent: false}); + } else { + this.dataLayerMode = 'markers'; + this.mapSettingsFormGroup.removeControl('trips', {emitEvent: false}); + this.mapSettingsFormGroup.removeControl('tripTimeline', {emitEvent: false}); + } + } + } + } + writeValue(value: MapSetting): void { this.modelValue = value; this.mapSettingsFormGroup.patchValue( diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts index 3dc10f34cf..f301219045 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts @@ -47,6 +47,8 @@ export class MapWidgetSettingsComponent extends WidgetSettingsComponent { const params = widgetConfig.typeParameters as any; if (isDefinedAndNotNull(params.trip)) { this.trip = params.trip === true; + } else { + this.trip = false; } } From 252e6da744543fbd8f9f81027c2fa88d67702265 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 31 Mar 2025 11:32:23 +0300 Subject: [PATCH 04/11] UI: Fixed scrolling markdown source code module --- ui-ngx/src/app/shared/models/js-function.models.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/models/js-function.models.ts b/ui-ngx/src/app/shared/models/js-function.models.ts index 94c04efc8a..40b9175e10 100644 --- a/ui-ngx/src/app/shared/models/js-function.models.ts +++ b/ui-ngx/src/app/shared/models/js-function.models.ts @@ -141,7 +141,7 @@ export const loadModuleMarkdownSourceCode = (http: HttpClient, translate: Transl let sourceCode = `
${resource.title}
${translate.instant('js-func.source-code')}
\n\n`; return loadFunctionModuleSource(http, resource.link).pipe( map((source) => { - sourceCode += '```javascript\n{:code-style="margin-left: -16px; margin-right: -16px;"}\n' + source + '\n```'; + sourceCode += '```javascript\n{:code-style="margin-left: -16px; margin-right: -16px; max-height: 65vh;"}\n' + source + '\n```'; return sourceCode; }), catchError(err => { From 4746ef53670003de884182cee3ac4e731098c158 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 31 Mar 2025 12:21:57 +0300 Subject: [PATCH 05/11] UI: Fix chart settings not updating when switching between different chart type widgets in advanced mode --- .../time-series-chart-widget-settings.component.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts index dc56c2a328..68d849fd0c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts @@ -105,6 +105,17 @@ export class TimeSeriesChartWidgetSettingsComponent extends WidgetSettingsCompon const params = widgetConfig.typeParameters as any; if (isDefinedAndNotNull(params.chartType)) { this.chartType = params.chartType; + } else { + this.chartType = TimeSeriesChartType.default; + } + if (this.timeSeriesChartWidgetSettingsForm) { + const isStateChartType = this.chartType === TimeSeriesChartType.state; + const hasStatesControl = this.timeSeriesChartWidgetSettingsForm.contains('states'); + if (isStateChartType && !hasStatesControl) { + this.timeSeriesChartWidgetSettingsForm.addControl('states', this.fb.control(widgetConfig.config.settings.states), { emitEvent: false }); + } else if (!isStateChartType && hasStatesControl) { + this.timeSeriesChartWidgetSettingsForm.removeControl('states', { emitEvent: false }); + } } } From bfb7532488e49b8f9f746807ef85f8127e0a6353 Mon Sep 17 00:00:00 2001 From: Tarnavskiy Date: Mon, 31 Mar 2025 13:33:27 +0300 Subject: [PATCH 06/11] Changed styling to tailwind class --- .../settings/alarm/alarms-table-widget-settings.component.html | 2 +- .../cards/timeseries-table-widget-settings.component.html | 2 +- .../control/persistent-table-widget-settings.component.html | 2 +- .../entity/entities-table-widget-settings.component.html | 2 +- ui-ngx/tailwind.config.js | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html index eec36b90fa..af2c92b733 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html @@ -95,7 +95,7 @@ {{ 'widgets.table.display-pagination' | translate }}
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html index 4f260c350a..52dbf0ba79 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html @@ -62,7 +62,7 @@ {{ 'widgets.table.display-pagination' | translate }}
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/persistent-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/persistent-table-widget-settings.component.html index 0b32a225d4..d370fde972 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/persistent-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/persistent-table-widget-settings.component.html @@ -49,7 +49,7 @@ {{ 'widgets.table.display-pagination' | translate }}
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-widget-settings.component.html index 02f4be6b3d..d369c4a165 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-widget-settings.component.html @@ -92,7 +92,7 @@ {{ 'widgets.table.display-pagination' | translate }}
-
{{ 'widgets.table.page-step-settings' | translate }}
+
{{ 'widgets.table.page-step-settings' | translate }}
widgets.table.page-step-increment
diff --git a/ui-ngx/tailwind.config.js b/ui-ngx/tailwind.config.js index e84ba47abc..d675da4cda 100644 --- a/ui-ngx/tailwind.config.js +++ b/ui-ngx/tailwind.config.js @@ -102,6 +102,7 @@ module.exports = { minWidth: { '7.5': '1.875rem', '25': '6.25rem', + '30': '7.5rem', '37.5': '9.375rem', '62.5': '15.625rem', '72.5': '18.125rem', From 1c11b30eacb43589eb258a3941a6f588d6b40765 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 28 Mar 2025 15:11:45 +0200 Subject: [PATCH 07/11] UI: Fix incorrect datasource type switching behavior in map settings when 'keys' field is not set --- .../map/map-data-layer-dialog.component.ts | 28 +++++-------------- .../map/map-data-layer-row.component.ts | 26 ++++------------- .../map/map-data-source-row.component.ts | 19 ++----------- .../shared/models/widget/maps/map.models.ts | 15 ++++++++++ 4 files changed, 30 insertions(+), 58 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts index dc0123406a..ae752ebca7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts @@ -31,7 +31,8 @@ import { pathDecoratorSymbolTranslationMap, PolygonsDataLayerSettings, ShapeDataLayerSettings, - TripsDataLayerSettings + TripsDataLayerSettings, + updateDataKeyToNewDsType } from '@shared/models/widget/maps/map.models'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -293,23 +294,23 @@ export class MapDataLayerDialogComponent extends DialogComponent { + if (newDsType === DatasourceType.function) { + if (dataKey && dataKey.type !== DataKeyType.function) { + dataKey.type = DataKeyType.function; + return true; + } + } else { + if (dataKey?.type === DataKeyType.function) { + dataKey.type = timeSeries ? DataKeyType.timeseries : DataKeyType.attribute; + return true; + } + } + return false; +} + export const mergeMapDatasources = (target: TbMapDatasource[], source: TbMapDatasource[]): TbMapDatasource[] => { const appendDatasources: TbMapDatasource[] = []; for (const sourceDs of source) { From d28f372d932c72d5adc33ce6d8c3e58da26f0e3e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 31 Mar 2025 15:28:55 +0300 Subject: [PATCH 08/11] UI: Refactoring widget action use signal input additionalWidgetActionTypes --- .../action/widget-action.component.html | 2 +- .../common/action/widget-action.component.ts | 26 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html index a2a0e8c8fa..5c735010f1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html @@ -37,7 +37,7 @@
widget-config.action
- + {{ widgetActionTypeTranslations.get(widgetActionType[actionType]) | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts index bd0fe36910..698645bacf 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts @@ -26,7 +26,7 @@ import { ValidatorFn, Validators } from '@angular/forms'; -import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, computed, ElementRef, forwardRef, input, Input, OnInit, ViewChild } from '@angular/core'; import { MapItemType, mapItemTypeTranslationMap, @@ -102,19 +102,16 @@ export class WidgetActionComponent implements ControlValueAccessor, OnInit, Vali @Input() actionNames: string[]; - @Input() - set additionalWidgetActionTypes(value: WidgetActionType[]) { - if (this.widgetActionFormGroup && !widgetActionTypes.includes(this.widgetActionFormGroup.get('type').value)) { - this.widgetActionFormGroup.get('type').setValue(WidgetActionType.doNothing); - } - if (value?.length) { - this.widgetActionTypes = widgetActionTypes.concat(value); - } else { - this.widgetActionTypes = widgetActionTypes; - } - } + additionalWidgetActionTypes = input(null); + + actionTypes = computed(() => { + const predefinedActionTypes = widgetActionTypes; + if (this.additionalWidgetActionTypes()?.length) { + return predefinedActionTypes.concat(this.additionalWidgetActionTypes()); + } + return predefinedActionTypes; + }); - widgetActionTypes = widgetActionTypes; widgetActionTypeTranslations = widgetActionTypeTranslationMap; widgetActionType = WidgetActionType; @@ -191,9 +188,6 @@ export class WidgetActionComponent implements ControlValueAccessor, OnInit, Vali ).subscribe(() => { this.widgetActionUpdated(); }); - if (this.additionalWidgetActionTypes) { - this.widgetActionTypes = this.widgetActionTypes.concat(this.additionalWidgetActionTypes); - } } writeValue(widgetAction?: WidgetAction): void { From c1d382a39b8fd3213b7e0083b81527f6825770ba Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 31 Mar 2025 16:52:22 +0300 Subject: [PATCH 09/11] UI: Fixed default action header button color --- .../widget/action/widget-action-dialog.component.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts index 7a74624774..5e071103b8 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts @@ -192,6 +192,11 @@ export class WidgetActionDialogComponent extends DialogComponent Date: Mon, 31 Mar 2025 17:35:52 +0300 Subject: [PATCH 10/11] UI: Fixed AdditionalMapDataSourceRowComponent duplicate code --- ...dditional-map-data-source-row.component.ts | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts index 0957d991f5..60adb60cb7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts @@ -33,7 +33,7 @@ import { Validators } from '@angular/forms'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { AdditionalMapDataSourceSettings } from '@shared/models/widget/maps/map.models'; +import { AdditionalMapDataSourceSettings, updateDataKeyToNewDsType } from '@shared/models/widget/maps/map.models'; import { DataKey, DatasourceType, datasourceTypeTranslationMap, widgetType } from '@shared/models/widget.models'; import { EntityType } from '@shared/models/entity-type.models'; import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; @@ -156,7 +156,7 @@ export class AdditionalMapDataSourceRowComponent implements ControlValueAccessor const dataKeys: DataKey[] = this.dataSourceFormGroup.get('dataKeys').value; if (dataKeys?.length) { for (const key of dataKeys) { - updateModel = this.updateDataKeyToNewDsType(key, newDsType) || updateModel; + updateModel = updateDataKeyToNewDsType(key, newDsType) || updateModel; } if (updateModel) { this.dataSourceFormGroup.get('dataKeys').patchValue(dataKeys, {emitEvent: false}); @@ -168,21 +168,6 @@ export class AdditionalMapDataSourceRowComponent implements ControlValueAccessor } } - private updateDataKeyToNewDsType(dataKey: DataKey, newDsType: DatasourceType): boolean { - if (newDsType === DatasourceType.function) { - if (dataKey.type !== DataKeyType.function) { - dataKey.type = DataKeyType.function; - return true; - } - } else { - if (dataKey.type === DataKeyType.function) { - dataKey.type = DataKeyType.attribute; - return true; - } - } - return false; - } - private updateValidators() { const dsType: DatasourceType = this.dataSourceFormGroup.get('dsType').value; if (dsType === DatasourceType.function) { From fe0e20f785c6d3a72df33f79fbed474d3dfaed3f Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 31 Mar 2025 18:18:10 +0300 Subject: [PATCH 11/11] UI: Fixed updated header button color --- .../action/widget-action-dialog.component.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts index 5e071103b8..ea49a8b442 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts @@ -135,8 +135,8 @@ export class WidgetActionDialogComponent extends DialogComponent