diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/button/action-button-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/button/action-button-basic-config.component.html index 6940cffc1f..a3030dec79 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/button/action-button-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/button/action-button-basic-config.component.html @@ -27,7 +27,7 @@
widgets.action-button.behavior
-
widgets.action-button.on-click
+
{{ 'widgets.action-button.on-click' | translate}}
-
widgets.button-state.activated-state
+
{{ 'widgets.button-state.activated-state' | translate }}
-
widgets.button-state.disabled-state
+
{{ 'widgets.button-state.disabled-state' | translate }}
widgets.command-button.behavior
-
widgets.command-button.on-click
+
{{ 'widgets.command-button.on-click' | translate }}
-
widgets.button-state.disabled-state
+
{{ 'widgets.button-state.disabled-state' | translate }}
widgets.power-button.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.power-button.power-on
+
{{ 'widgets.power-button.power-on' | translate }}
-
widgets.power-button.power-off
+
{{ 'widgets.power-button.power-off' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.toggle-button.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.toggle-button.check
+
{{ 'widgets.toggle-button.check' | translate }}
-
widgets.toggle-button.uncheck
+
{{ 'widgets.toggle-button.uncheck' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.status-widget.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.single-switch.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.rpc-state.turn-on
+
{{ 'widgets.rpc-state.turn-on' | translate }}
-
widgets.rpc-state.turn-off
+
{{ 'widgets.rpc-state.turn-off' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.slider.behavior
-
widgets.slider.initial-value
+
{{ 'widgets.slider.initial-value' | translate }}
-
widgets.slider.on-value-change
+
{{ 'widgets.slider.on-value-change' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
gateway.platform-side
- gateway.key + tb-hint-tooltip-icon="{{ 'gateway.JSONPath-hint' | translate }}"> + {{ 'gateway.key' | translate }}
@@ -97,8 +97,8 @@
- gateway.value + tb-hint-tooltip-icon="{{ 'gateway.JSONPath-hint' | translate }}"> + {{ 'gateway.value' | translate }}
-
- gateway.method-name +
+ {{ 'gateway.method-name' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.html index 48e280bc67..7ebfb700bf 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.html @@ -61,11 +61,11 @@ + [class.request-column]="mappingType === mappingTypeEnum.REQUESTS"> {{ column.title | translate }} - + {{ mapping[column.def] }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.ts index 7042e5ae38..3e4ce09031 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.ts @@ -58,6 +58,7 @@ import { isDefinedAndNotNull, isUndefinedOrNull } from '@core/utils'; import { coerceBoolean } from '@shared/decorators/coercion'; import { SharedModule } from '@shared/shared.module'; import { CommonModule } from '@angular/common'; +import { TooltipDirective } from '@shared/directives/public-api'; @Component({ selector: 'tb-mapping-table', @@ -77,7 +78,7 @@ import { CommonModule } from '@angular/common'; } ], standalone: true, - imports: [CommonModule, SharedModule] + imports: [CommonModule, SharedModule, TooltipDirective] }) export class MappingTableComponent implements ControlValueAccessor, Validator, AfterViewInit, OnInit, OnDestroy { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.html index 43b15de06c..dbabe3acf6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.html @@ -18,7 +18,7 @@
-
gateway.server-url
+
gateway.server-url
@@ -35,8 +35,8 @@
-
- gateway.timeout +
+
{{ 'gateway.timeout' | translate }}
@@ -55,7 +55,7 @@
-
gateway.security
+
gateway.security
@@ -65,8 +65,8 @@
-
- gateway.scan-period +
+
{{ 'gateway.scan-period' | translate }}
@@ -86,8 +86,8 @@
-
- gateway.sub-check-period +
+
{{ 'gateway.sub-check-period' | translate }}
@@ -110,7 +110,7 @@
- {{ 'gateway.enable-subscription' | translate }} +
{{ 'gateway.enable-subscription' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.scss index 64e886ffef..416f368279 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.scss @@ -17,12 +17,4 @@ width: 100%; height: 100%; display: block; - - .server-conf-field-title { - min-width: 250px; - width: 30%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.ts index 98a36182a6..66af025267 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/server-config/server-config.component.ts @@ -36,6 +36,7 @@ import { CommonModule } from '@angular/common'; import { SecurityConfigComponent } from '@home/components/widget/lib/gateway/connectors-configuration/public-api'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { TooltipDirective } from '@shared/directives/public-api'; @Component({ selector: 'tb-server-config', @@ -59,6 +60,7 @@ import { takeUntil } from 'rxjs/operators'; CommonModule, SharedModule, SecurityConfigComponent, + TooltipDirective, ] }) export class ServerConfigComponent implements ControlValueAccessor, Validator, OnDestroy { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.html index 37f7b1422e..b348b49252 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.html @@ -18,8 +18,8 @@
- gateway.max-number-of-workers + tb-hint-tooltip-icon="{{ 'gateway.max-number-of-workers-hint' | translate }}"> +
{{ 'gateway.max-number-of-workers' | translate }}
@@ -40,8 +40,8 @@
- gateway.max-messages-queue-for-worker + tb-hint-tooltip-icon="{{ 'gateway.max-messages-queue-for-worker-hint' | translate }}"> +
{{ 'gateway.max-messages-queue-for-worker' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.ts index 9a37bdb07c..c05b7c32b6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/workers-config-control/workers-config-control.component.ts @@ -33,6 +33,7 @@ import { CommonModule } from '@angular/common'; import { WorkersConfig } from '@home/components/widget/lib/gateway/gateway-widget.models'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { TooltipDirective } from '@shared/directives/tooltip/tooltip.directive'; @Component({ selector: 'tb-workers-config-control', @@ -42,6 +43,7 @@ import { takeUntil } from 'rxjs/operators'; imports: [ CommonModule, SharedModule, + TooltipDirective, ], providers: [ { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.html index 35ac90f671..17c002115c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.html @@ -19,7 +19,7 @@

{{ MappingTypeTranslationsMap.get(this.data?.mappingType) | translate}}

-
+
-
- gateway.mqtt-qos +
+ {{ 'gateway.mqtt-qos' | translate }}
@@ -140,8 +140,8 @@
- gateway.extension + tb-hint-tooltip-icon="{{ 'gateway.extension-hint' | translate }}"> + {{ 'gateway.extension' | translate }}
@@ -369,8 +369,8 @@
- gateway.device-name-filter + tb-hint-tooltip-icon="{{ 'gateway.device-name-filter-hint' | translate }}"> + {{ 'gateway.device-name-filter' | translate }}
@@ -388,8 +388,8 @@
-
- gateway.attribute-filter +
+ {{ 'gateway.attribute-filter' | translate }}
@@ -472,8 +472,8 @@
-
- gateway.device-name-filter +
+ {{ 'gateway.device-name-filter' | translate }}
@@ -491,8 +491,8 @@
-
- gateway.method-filter +
+ {{ 'gateway.method-filter' | translate }}
@@ -580,8 +580,8 @@
-
- gateway.response-topic-Qos +
+ {{ 'gateway.response-topic-Qos' | translate }}
@@ -618,8 +618,8 @@
-
- gateway.device-node +
+ {{ 'gateway.device-node' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.scss index 190422eeb0..4212e8f834 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.scss @@ -47,6 +47,7 @@ .mdc-evolution-chip-set__chips { justify-content: flex-end; align-items: center; + flex-wrap: nowrap; } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.ts index 3812fa161e..0e177df527 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/mapping-dialog.component.ts @@ -28,6 +28,7 @@ import { ConvertorTypeTranslationsMap, DataConversionTranslationsMap, DeviceInfoType, + HelpLinkByMappingTypeMap, MappingHintTranslationsMap, MappingInfo, MappingKeysAddKeyTranslationsMap, @@ -97,6 +98,8 @@ export class MappingDialogComponent extends DialogComponent(); @@ -187,10 +190,6 @@ export class MappingDialogComponent extends DialogComponent( ] ); +export const HelpLinkByMappingTypeMap = new Map( + [ + [MappingType.DATA, 'https://thingsboard.io/docs/iot-gateway/config/mqtt/#section-mapping'], + [MappingType.OPCUA, 'https://thingsboard.io/docs/iot-gateway/config/opc-ua/#section-mapping'], + [MappingType.REQUESTS, 'https://thingsboard.io/docs/iot-gateway/config/mqtt/#section-mapping'] + ] +); + export const QualityTypes = [0, 1 ,2]; export const QualityTypeTranslationsMap = new Map( diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/button/action-button-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/button/action-button-widget-settings.component.html index 265a9c2501..a8cdf55efc 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/button/action-button-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/button/action-button-widget-settings.component.html @@ -19,7 +19,7 @@
widgets.action-button.behavior
-
widgets.button-state.activated-state
+
{{ 'widgets.button-state.activated-state' | translate }}
-
widgets.button-state.disabled-state
+
{{ 'widgets.button-state.disabled-state' | translate }}
widgets.command-button.behavior
-
widgets.command-button.on-click
+
{{ 'widgets.command-button.on-click' | translate }}
-
widgets.button-state.disabled-state
+
{{ 'widgets.button-state.disabled-state' | translate }}
widgets.power-button.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.power-button.power-on
+
{{ 'widgets.power-button.power-on' | translate }}
-
widgets.power-button.power-off
+
{{ 'widgets.power-button.power-off' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.toggle-button.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.toggle-button.check
+
{{ 'widgets.toggle-button.check' | translate }}
-
widgets.toggle-button.uncheck
+
{{ 'widgets.toggle-button.uncheck' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
-
widgets.value-action.value
+
{{ 'widgets.value-action.value' | translate }}
-
widgets.status-widget.primary
+
{{ 'widgets.status-widget.primary' | translate }}
-
widgets.status-widget.secondary
+
{{ 'widgets.status-widget.secondary' | translate }}
@@ -88,14 +88,14 @@ [fxLayoutAlign.lt-md]="layout !== StatusWidgetLayout.icon ? 'space-between center': 'start center'" style="gap: 12px;">
-
widgets.status-widget.primary
+
{{ 'widgets.status-widget.primary' | translate }}
-
widgets.status-widget.secondary
+
{{ 'widgets.status-widget.secondary' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/single-switch-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/single-switch-widget-settings.component.html index 9208efd68a..d5b732b6bb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/single-switch-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/control/single-switch-widget-settings.component.html @@ -19,7 +19,7 @@
widgets.single-switch.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.rpc-state.turn-on
+
{{ 'widgets.rpc-state.turn-on' | translate }}
-
widgets.rpc-state.turn-off
+
{{ 'widgets.rpc-state.turn-off' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.slider.behavior
-
widgets.slider.initial-value
+
{{ 'widgets.slider.initial-value' | translate }}
-
widgets.slider.on-value-change
+
{{ 'widgets.slider.on-value-change' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widgets.status-widget.behavior
-
widgets.rpc-state.initial-state
+
{{ 'widgets.rpc-state.initial-state' | translate }}
-
widgets.rpc-state.disabled-state
+
{{ 'widgets.rpc-state.disabled-state' | translate }}
widget-config.data-settings
-
widget-config.units-by-default
+
{{ 'widget-config.units-by-default' | translate }}
-
widget-config.decimals-by-default
+
{{ 'widget-config.decimals-by-default' | translate }}
diff --git a/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.html b/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.html index 32b66fd2b7..f2413f0ad7 100644 --- a/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.html +++ b/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.html @@ -15,7 +15,7 @@ limitations under the License. --> - + (); + + constructor( + private elementRef: ElementRef, + private renderer: Renderer2, + private tooltip: MatTooltip + ) {} + + ngOnInit(): void { + this.observeMouseEvents(); + this.applyTruncationStyles(); + } + + ngAfterViewInit(): void { + if (!this.text) { + this.text = this.elementRef.nativeElement.innerText; + } + + this.tooltip.position = this.position; + } + + ngOnDestroy(): void { + if (this.tooltip._isTooltipVisible()) { + this.hideTooltip(); + } + this.destroy$.next(); + this.destroy$.complete(); + } + + private observeMouseEvents(): void { + fromEvent(this.elementRef.nativeElement, 'mouseenter') + .pipe( + filter(() => this.tooltipEnabled), + filter(() => this.isOverflown(this.elementRef.nativeElement)), + tap(() => this.showTooltip()), + takeUntil(this.destroy$), + ) + .subscribe(); + fromEvent(this.elementRef.nativeElement, 'mouseleave') + .pipe( + filter(() => this.tooltipEnabled), + filter(() => this.tooltip._isTooltipVisible()), + tap(() => this.hideTooltip()), + takeUntil(this.destroy$), + ) + .subscribe(); + } + + private applyTruncationStyles(): void { + this.renderer.setStyle(this.elementRef.nativeElement, 'white-space', 'nowrap'); + this.renderer.setStyle(this.elementRef.nativeElement, 'overflow', 'hidden'); + this.renderer.setStyle(this.elementRef.nativeElement, 'text-overflow', 'ellipsis'); + } + + private isOverflown(element: HTMLElement): boolean { + return element.clientWidth < element.scrollWidth; + } + + private showTooltip(): void { + this.tooltip.message = this.text; + + this.renderer.setAttribute(this.elementRef.nativeElement, 'matTooltip', this.text); + this.tooltip.show(); + } + + private hideTooltip(): void { + this.tooltip.hide(); + } +}