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..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
-
{{ '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
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 { 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) { 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 87c2650b82..e7e11284eb 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'; @@ -294,23 +295,23 @@ export class MapDataLayerDialogComponent extends DialogComponent
-
{{ '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
${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 => { diff --git a/ui-ngx/src/app/shared/models/widget/maps/map.models.ts b/ui-ngx/src/app/shared/models/widget/maps/map.models.ts index f4fae9ca12..bac8c8fb75 100644 --- a/ui-ngx/src/app/shared/models/widget/maps/map.models.ts +++ b/ui-ngx/src/app/shared/models/widget/maps/map.models.ts @@ -1182,6 +1182,21 @@ export const parseCenterPosition = (position: string | [number, number]): [numbe return [0, 0]; } +export const updateDataKeyToNewDsType = (dataKey: DataKey | null, newDsType: DatasourceType, timeSeries = false): boolean => { + 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) { diff --git a/ui-ngx/src/form.scss b/ui-ngx/src/form.scss index 8f3c7f0cd0..e516810895 100644 --- a/ui-ngx/src/form.scss +++ b/ui-ngx/src/form.scss @@ -360,9 +360,10 @@ } } .tb-small-label { + display: flex; + align-items: center; height: 40px; font-size: 14px; - line-height: 40px; letter-spacing: 0.2px; color: rgba(0, 0, 0, 0.38); } 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',