From c9565719b719e6c5a12abf436173915997c86fd1 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 11 Jun 2024 15:52:05 +0300 Subject: [PATCH 01/45] [PROD-3481] [FIX] changed docker commands button and pop-up window title --- .../src/main/data/json/tenant/dashboards/gateways.json | 8 ++++---- ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index d98daa3632..42c4f199b5 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -181,12 +181,12 @@ "actions": { "actionCellButton": [ { - "name": "Docker commands", + "name": "Launch command", "icon": "terminal", "useShowWidgetActionFunction": null, "showWidgetActionFunction": "return true;", "type": "customPretty", - "customHtml": "
\n \n

Docker commands

\n \n
\n \n
\n \n
\n \n
\n
\n", + "customHtml": "
\n \n

{{ 'gateway.launch-command' | translate }}

\n \n
\n \n
\n \n
\n \n
\n
\n", "customCss": ".container {\n display: grid;\n grid-template-rows: min-content minmax(auto, 1fr) min-content;\n height: 100%;\n max-height: 100vh;\n width: 600px;\n max-width: 100%;\n}", "customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\n\nopenCommands();\n\nfunction openCommands() {\n customDialog.customDialog(htmlTemplate, CommandsDialogController, {panelClass: \"test\"}).subscribe();\n}\n\nfunction CommandsDialogController(instance) {\n let vm = instance;\n \n vm.entityId = entityId.id;\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n}\n", "customResources": [], @@ -1861,7 +1861,7 @@ "padding": "8px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "
\r\n \r\n
", + "markdownTextPattern": "
\r\n \r\n
", "applyDefaultMarkdownStyle": false, "markdownCss": ".action-buttons-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: center;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n}" }, @@ -1887,7 +1887,7 @@ "useShowWidgetActionFunction": null, "showWidgetActionFunction": "return true;", "type": "customPretty", - "customHtml": "
\n \n

Launch command

\n \n
\n \n
\n \n
\n \n
\n
\n", + "customHtml": "
\n \n

{{ 'gateway.launch-command' | translate }}

\n \n
\n \n
\n \n
\n \n
\n
\n", "customCss": ".container {\n display: grid;\n grid-template-rows: min-content minmax(auto, 1fr) min-content;\n height: 100%;\n max-height: 100vh;\n width: 600px;\n max-width: 100%;\n}", "customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\n\nopenCommands();\n\nfunction openCommands() {\n customDialog.customDialog(htmlTemplate, CommandsDialogController, {panelClass: \"test\"}).subscribe();\n}\n\nfunction CommandsDialogController(instance) {\n let vm = instance;\n \n vm.entityId = entityId.id;\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n}\n", "customResources": [], 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 0fa09da5e4..d0270a5c87 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -2835,6 +2835,7 @@ "enable-remote-logging": "Enable remote logging", "ellipsis-chips-text": "+ {{count}} more", "launch-gateway": "Launch gateway", + "launch-command": "Launch command", "launch-docker-compose": "Start the gateway using the following command in the terminal from folder with docker-compose.yml file", "logs-configuration": "Logs configuration", "create-new-gateway": "Create a new gateway", From 98f873f0b606f48acb0b2ba5ba61d6dbfa9e52e8 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 10:52:59 +0300 Subject: [PATCH 02/45] [PROD-3727] [FIX] made response topic expression required --- ...teway-service-rpc-connector.component.html | 2 +- ...gateway-service-rpc-connector.component.ts | 34 +++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html index 2d992187f6..6f495984f5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html @@ -35,7 +35,7 @@ {{ 'gateway.rpc.withResponse' | translate }} - {{ 'gateway.rpc.responseTopicExpression' | translate }} + {{ 'gateway.rpc.responseTopicExpression' | translate }}* diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index 2ea5964b84..cbb11fc059 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, forwardRef, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { ControlValueAccessor, FormArray, @@ -22,6 +22,8 @@ import { FormControl, FormGroup, NG_VALUE_ACCESSOR, + UntypedFormControl, + ValidatorFn, Validators } from '@angular/forms'; import { @@ -53,6 +55,8 @@ import { } from '@shared/components/dialog/json-object-edit-dialog.component'; import { jsonRequired } from '@shared/components/json-object-edit.component'; import { deepClone } from '@core/utils'; +import { takeUntil, tap } from "rxjs/operators"; +import { Subject } from "rxjs"; @Component({ selector: 'tb-gateway-service-rpc-connector', @@ -66,7 +70,7 @@ import { deepClone } from '@core/utils'; } ] }) -export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValueAccessor { +export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, ControlValueAccessor { @Input() connectorType: ConnectorType; @@ -105,6 +109,7 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue private propagateChange = (v: any) => { } + private destroy$ = new Subject(); constructor(private fb: FormBuilder, private dialog: MatDialog,) { @@ -138,6 +143,17 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue } }); this.isMQTTWithResponse = this.fb.control(false); + this.isMQTTWithResponse.valueChanges.pipe( + tap(() => { + this.commandForm.get('responseTopicExpression').updateValueAndValidity(); + }), + takeUntil(this.destroy$), + ).subscribe(); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); } connectorParamsFormGroupByType(type: ConnectorType): FormGroup { @@ -148,7 +164,7 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue formGroup = this.fb.group({ methodFilter: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], requestTopicExpression: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], - responseTopicExpression: [null, [Validators.pattern(noLeadTrailSpacesRegex)]], + responseTopicExpression: [null, [this.requiredOnWithResponse(), Validators.pattern(noLeadTrailSpacesRegex)]], responseTimeout: [null, [Validators.min(10), Validators.pattern(this.numbersOnlyPattern)]], valueExpression: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], }) @@ -424,4 +440,16 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue this.commandForm.patchValue(value, {onlySelf: false}); } } + + private requiredOnWithResponse(): ValidatorFn { + return (control: UntypedFormControl) => { + const withResponse: boolean = this.isMQTTWithResponse?.value; + + if (withResponse && !control.value) { + return { 'required': true }; + } + + return null; + }; + } } From 45472e64fde17fdb5eefeb595555f739996620e3 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 10:55:33 +0300 Subject: [PATCH 03/45] Revert "[PROD-3481] [FIX] changed docker commands button and pop-up window title" This reverts commit c9565719b719e6c5a12abf436173915997c86fd1. --- .../src/main/data/json/tenant/dashboards/gateways.json | 8 ++++---- ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index 42c4f199b5..d98daa3632 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -181,12 +181,12 @@ "actions": { "actionCellButton": [ { - "name": "Launch command", + "name": "Docker commands", "icon": "terminal", "useShowWidgetActionFunction": null, "showWidgetActionFunction": "return true;", "type": "customPretty", - "customHtml": "
\n \n

{{ 'gateway.launch-command' | translate }}

\n \n
\n \n
\n \n
\n \n
\n
\n", + "customHtml": "
\n \n

Docker commands

\n \n
\n \n
\n \n
\n \n
\n
\n", "customCss": ".container {\n display: grid;\n grid-template-rows: min-content minmax(auto, 1fr) min-content;\n height: 100%;\n max-height: 100vh;\n width: 600px;\n max-width: 100%;\n}", "customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\n\nopenCommands();\n\nfunction openCommands() {\n customDialog.customDialog(htmlTemplate, CommandsDialogController, {panelClass: \"test\"}).subscribe();\n}\n\nfunction CommandsDialogController(instance) {\n let vm = instance;\n \n vm.entityId = entityId.id;\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n}\n", "customResources": [], @@ -1861,7 +1861,7 @@ "padding": "8px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "
\r\n \r\n
", + "markdownTextPattern": "
\r\n \r\n
", "applyDefaultMarkdownStyle": false, "markdownCss": ".action-buttons-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: center;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n}" }, @@ -1887,7 +1887,7 @@ "useShowWidgetActionFunction": null, "showWidgetActionFunction": "return true;", "type": "customPretty", - "customHtml": "
\n \n

{{ 'gateway.launch-command' | translate }}

\n \n
\n \n
\n \n
\n \n
\n
\n", + "customHtml": "
\n \n

Launch command

\n \n
\n \n
\n \n
\n \n
\n
\n", "customCss": ".container {\n display: grid;\n grid-template-rows: min-content minmax(auto, 1fr) min-content;\n height: 100%;\n max-height: 100vh;\n width: 600px;\n max-width: 100%;\n}", "customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\n\nopenCommands();\n\nfunction openCommands() {\n customDialog.customDialog(htmlTemplate, CommandsDialogController, {panelClass: \"test\"}).subscribe();\n}\n\nfunction CommandsDialogController(instance) {\n let vm = instance;\n \n vm.entityId = entityId.id;\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n}\n", "customResources": [], 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 d0270a5c87..0fa09da5e4 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -2835,7 +2835,6 @@ "enable-remote-logging": "Enable remote logging", "ellipsis-chips-text": "+ {{count}} more", "launch-gateway": "Launch gateway", - "launch-command": "Launch command", "launch-docker-compose": "Start the gateway using the following command in the terminal from folder with docker-compose.yml file", "logs-configuration": "Logs configuration", "create-new-gateway": "Create a new gateway", From 4990db2dc02e6cba89407dd63811c380a490c06b Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 10:58:42 +0300 Subject: [PATCH 04/45] [PROD-3727] [FIX] refactoring --- .../gateway-service-rpc-connector.component.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index cbb11fc059..6598b332ca 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -143,12 +143,7 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, C } }); this.isMQTTWithResponse = this.fb.control(false); - this.isMQTTWithResponse.valueChanges.pipe( - tap(() => { - this.commandForm.get('responseTopicExpression').updateValueAndValidity(); - }), - takeUntil(this.destroy$), - ).subscribe(); + this.observeMQTTWithResponse(); } ngOnDestroy(): void { @@ -452,4 +447,13 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, C return null; }; } + + private observeMQTTWithResponse(): void { + this.isMQTTWithResponse.valueChanges.pipe( + tap(() => { + this.commandForm.get('responseTopicExpression').updateValueAndValidity(); + }), + takeUntil(this.destroy$), + ).subscribe(); + } } From 58f677cd4fa2501376a8d9ed3ca8f64c7f2f567a Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 11:55:52 +0300 Subject: [PATCH 05/45] [PROD-3727] [FIX] refactoring --- ...teway-service-rpc-connector.component.html | 2 +- ...gateway-service-rpc-connector.component.ts | 20 +++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html index 6f495984f5..2d992187f6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html @@ -35,7 +35,7 @@ {{ 'gateway.rpc.withResponse' | translate }} - {{ 'gateway.rpc.responseTopicExpression' | translate }}* + {{ 'gateway.rpc.responseTopicExpression' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index 6598b332ca..fe3c600b50 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -159,7 +159,7 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, C formGroup = this.fb.group({ methodFilter: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], requestTopicExpression: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], - responseTopicExpression: [null, [this.requiredOnWithResponse(), Validators.pattern(noLeadTrailSpacesRegex)]], + responseTopicExpression: [{ value: null, disabled: true }, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], responseTimeout: [null, [Validators.min(10), Validators.pattern(this.numbersOnlyPattern)]], valueExpression: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], }) @@ -436,22 +436,12 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, C } } - private requiredOnWithResponse(): ValidatorFn { - return (control: UntypedFormControl) => { - const withResponse: boolean = this.isMQTTWithResponse?.value; - - if (withResponse && !control.value) { - return { 'required': true }; - } - - return null; - }; - } - private observeMQTTWithResponse(): void { this.isMQTTWithResponse.valueChanges.pipe( - tap(() => { - this.commandForm.get('responseTopicExpression').updateValueAndValidity(); + tap((isActive: boolean) => { + const responseControl = this.commandForm.get('responseTopicExpression'); + isActive ? responseControl.enable() : responseControl.disable(); + responseControl.updateValueAndValidity(); }), takeUntil(this.destroy$), ).subscribe(); From 05e8db56824abb6c76d64a4e278f1177daa59ff8 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 16:00:33 +0300 Subject: [PATCH 06/45] Revert "[PROD-3407] [FIX] fixed gateway dashboard sorting by status" This reverts commit bb9e81db1e37a765872fd5f3b1c54cb3be260c0b. --- .../gateway/gateway-connectors.component.ts | 24 +++++-------------- .../src/app/shared/models/page/sort-order.ts | 3 --- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts index 0ee3a75ca6..4f1b6b72a9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts @@ -35,7 +35,7 @@ import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetr import { PageComponent } from '@shared/components/page.component'; import { PageLink } from '@shared/models/page/page-link'; import { AttributeDatasource } from '@home/models/datasource/attribute-datasource'; -import { Direction, SORT_ASC_PINNED_VALUE, SORT_DESC_PINNED_VALUE, SortOrder } from '@shared/models/page/sort-order'; +import { Direction, SortOrder } from '@shared/models/page/sort-order'; import { MatSort } from '@angular/material/sort'; import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service'; import { MatTableDataSource } from '@angular/material/table'; @@ -238,26 +238,14 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie this.dataSource.sort = this.sort; this.dataSource.sortingDataAccessor = (data: AttributeData, sortHeaderId: string) => { - switch (sortHeaderId) { - case 'syncStatus': - return this.isConnectorSynced(data) ? 1 : 0; - - case 'enabled': - return this.activeConnectors.includes(data.key) ? 1 : 0; - - case 'errors': - const errors = this.getErrorsCount(data); - if (typeof errors === 'string') { - return this.sort.direction.toUpperCase() === Direction.DESC ? SORT_DESC_PINNED_VALUE : SORT_ASC_PINNED_VALUE; - } - return errors; - - default: - return data[sortHeaderId] || data.value[sortHeaderId]; + if (sortHeaderId === 'syncStatus') { + return this.isConnectorSynced(data) ? 1 : 0; + } else if (sortHeaderId === 'enabled') { + return this.activeConnectors.includes(data.key) ? 1 : 0; } + return data[sortHeaderId] || data.value[sortHeaderId]; }; - if (this.device) { if (this.device.id === NULL_UUID) { return; diff --git a/ui-ngx/src/app/shared/models/page/sort-order.ts b/ui-ngx/src/app/shared/models/page/sort-order.ts index cece5e73e9..9174b0c970 100644 --- a/ui-ngx/src/app/shared/models/page/sort-order.ts +++ b/ui-ngx/src/app/shared/models/page/sort-order.ts @@ -25,9 +25,6 @@ export enum Direction { DESC = 'DESC' } -export const SORT_DESC_PINNED_VALUE = -1; -export const SORT_ASC_PINNED_VALUE = 9999; - export function sortOrderFromString(strSortOrder: string): SortOrder { let property: string; let direction = Direction.ASC; From 25ce2d0800cfd4ae01895da0c937c26a9b983784 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 16:05:55 +0300 Subject: [PATCH 07/45] [PROD-3727] [FIX] refactoring --- .../lib/gateway/gateway-service-rpc-connector.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index fe3c600b50..0d9a8be239 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -22,8 +22,6 @@ import { FormControl, FormGroup, NG_VALUE_ACCESSOR, - UntypedFormControl, - ValidatorFn, Validators } from '@angular/forms'; import { From 3f01672284107bf1e25fd93650d65413274ef6df Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 16:08:26 +0300 Subject: [PATCH 08/45] [PROD-3727] [FIX] refactoring --- .../lib/gateway/gateway-service-rpc-connector.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index 0d9a8be239..77802935fb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -439,7 +439,6 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, OnDestroy, C tap((isActive: boolean) => { const responseControl = this.commandForm.get('responseTopicExpression'); isActive ? responseControl.enable() : responseControl.disable(); - responseControl.updateValueAndValidity(); }), takeUntil(this.destroy$), ).subscribe(); From 73d0ba91da1bf060837224c1409514a9c198c7a0 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 16:12:37 +0300 Subject: [PATCH 09/45] Revert "Revert "[PROD-3407] [FIX] fixed gateway dashboard sorting by status"" This reverts commit 05e8db56824abb6c76d64a4e278f1177daa59ff8. --- .../gateway/gateway-connectors.component.ts | 24 ++++++++++++++----- .../src/app/shared/models/page/sort-order.ts | 3 +++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts index 4f1b6b72a9..0ee3a75ca6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts @@ -35,7 +35,7 @@ import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetr import { PageComponent } from '@shared/components/page.component'; import { PageLink } from '@shared/models/page/page-link'; import { AttributeDatasource } from '@home/models/datasource/attribute-datasource'; -import { Direction, SortOrder } from '@shared/models/page/sort-order'; +import { Direction, SORT_ASC_PINNED_VALUE, SORT_DESC_PINNED_VALUE, SortOrder } from '@shared/models/page/sort-order'; import { MatSort } from '@angular/material/sort'; import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service'; import { MatTableDataSource } from '@angular/material/table'; @@ -238,14 +238,26 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie this.dataSource.sort = this.sort; this.dataSource.sortingDataAccessor = (data: AttributeData, sortHeaderId: string) => { - if (sortHeaderId === 'syncStatus') { - return this.isConnectorSynced(data) ? 1 : 0; - } else if (sortHeaderId === 'enabled') { - return this.activeConnectors.includes(data.key) ? 1 : 0; + switch (sortHeaderId) { + case 'syncStatus': + return this.isConnectorSynced(data) ? 1 : 0; + + case 'enabled': + return this.activeConnectors.includes(data.key) ? 1 : 0; + + case 'errors': + const errors = this.getErrorsCount(data); + if (typeof errors === 'string') { + return this.sort.direction.toUpperCase() === Direction.DESC ? SORT_DESC_PINNED_VALUE : SORT_ASC_PINNED_VALUE; + } + return errors; + + default: + return data[sortHeaderId] || data.value[sortHeaderId]; } - return data[sortHeaderId] || data.value[sortHeaderId]; }; + if (this.device) { if (this.device.id === NULL_UUID) { return; diff --git a/ui-ngx/src/app/shared/models/page/sort-order.ts b/ui-ngx/src/app/shared/models/page/sort-order.ts index 9174b0c970..cece5e73e9 100644 --- a/ui-ngx/src/app/shared/models/page/sort-order.ts +++ b/ui-ngx/src/app/shared/models/page/sort-order.ts @@ -25,6 +25,9 @@ export enum Direction { DESC = 'DESC' } +export const SORT_DESC_PINNED_VALUE = -1; +export const SORT_ASC_PINNED_VALUE = 9999; + export function sortOrderFromString(strSortOrder: string): SortOrder { let property: string; let direction = Direction.ASC; From b94a504046079b64b53b83a80eff084a5e1e1d74 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 16:16:02 +0300 Subject: [PATCH 10/45] [PROD-3407] [FIX] refactoring --- .../widget/lib/gateway/gateway-connectors.component.ts | 5 ++--- ui-ngx/src/app/shared/models/page/sort-order.ts | 3 --- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts index 0ee3a75ca6..bf94e6021d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts @@ -35,7 +35,7 @@ import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetr import { PageComponent } from '@shared/components/page.component'; import { PageLink } from '@shared/models/page/page-link'; import { AttributeDatasource } from '@home/models/datasource/attribute-datasource'; -import { Direction, SORT_ASC_PINNED_VALUE, SORT_DESC_PINNED_VALUE, SortOrder } from '@shared/models/page/sort-order'; +import { Direction, SortOrder } from '@shared/models/page/sort-order'; import { MatSort } from '@angular/material/sort'; import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service'; import { MatTableDataSource } from '@angular/material/table'; @@ -248,7 +248,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie case 'errors': const errors = this.getErrorsCount(data); if (typeof errors === 'string') { - return this.sort.direction.toUpperCase() === Direction.DESC ? SORT_DESC_PINNED_VALUE : SORT_ASC_PINNED_VALUE; + return this.sort.direction.toUpperCase() === Direction.DESC ? -1 : Infinity; } return errors; @@ -257,7 +257,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie } }; - if (this.device) { if (this.device.id === NULL_UUID) { return; diff --git a/ui-ngx/src/app/shared/models/page/sort-order.ts b/ui-ngx/src/app/shared/models/page/sort-order.ts index cece5e73e9..9174b0c970 100644 --- a/ui-ngx/src/app/shared/models/page/sort-order.ts +++ b/ui-ngx/src/app/shared/models/page/sort-order.ts @@ -25,9 +25,6 @@ export enum Direction { DESC = 'DESC' } -export const SORT_DESC_PINNED_VALUE = -1; -export const SORT_ASC_PINNED_VALUE = 9999; - export function sortOrderFromString(strSortOrder: string): SortOrder { let property: string; let direction = Direction.ASC; From 0b73b8c35e92de29377b780100dd88296f2bac14 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 17:04:14 +0300 Subject: [PATCH 11/45] [PROD-3440] [FIX] changed status column title to 'level' in logs --- .../components/widget/lib/gateway/gateway-logs.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html index d36a4c0a51..ba6c627edf 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html @@ -31,7 +31,7 @@ - {{ 'widgets.gateway.status' | translate }} + {{ 'widgets.liquid-level-card.level' | translate }} {{ attribute.status }} From e77e225bda4790ba520e43ac3b1f4448946c55bb Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 17:25:15 +0300 Subject: [PATCH 12/45] [PROD-3440] [FIX] refactoring --- .../components/widget/lib/gateway/gateway-logs.component.html | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 2 +- ui-ngx/src/assets/locale/locale.constant-lt_LT.json | 1 - ui-ngx/src/assets/locale/locale.constant-pl_PL.json | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html index ba6c627edf..c77de6eb82 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html @@ -31,7 +31,7 @@ - {{ 'widgets.liquid-level-card.level' | translate }} + {{ 'widgets.gateway.level' | translate }} {{ attribute.status }} 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 0fa09da5e4..0e4a31bbc4 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -6078,8 +6078,8 @@ "event-key-contains": "Event key contains...", "show-connector": "Show for the connector", "connector-state-param-key": "Connector state parameter key", - "status": "Status", "message": "Message", + "level": "Level", "created-time": "Created time" }, "gauge": { diff --git a/ui-ngx/src/assets/locale/locale.constant-lt_LT.json b/ui-ngx/src/assets/locale/locale.constant-lt_LT.json index 5ca808146c..a993ff1146 100644 --- a/ui-ngx/src/assets/locale/locale.constant-lt_LT.json +++ b/ui-ngx/src/assets/locale/locale.constant-lt_LT.json @@ -6785,7 +6785,6 @@ "event-key-contains": "Event key contains...", "show-connector": "Show for the connector", "connector-state-param-key": "Connector state parameter key", - "status": "Status", "message": "Message", "created-time": "Created time" }, diff --git a/ui-ngx/src/assets/locale/locale.constant-pl_PL.json b/ui-ngx/src/assets/locale/locale.constant-pl_PL.json index b30d4afc38..fef242268d 100644 --- a/ui-ngx/src/assets/locale/locale.constant-pl_PL.json +++ b/ui-ngx/src/assets/locale/locale.constant-pl_PL.json @@ -6808,7 +6808,6 @@ "event-key-contains": "Klucz zdarzenia zawiera...", "show-connector": "Show for the connector", "connector-state-param-key": "Connector state parameter key", - "status": "Status", "message": "Message", "created-time": "Created time" }, From e05df28ee309340fa92bd05056c680c004fc16b2 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 12 Jun 2024 18:04:19 +0300 Subject: [PATCH 13/45] [PROD-3752] [FIX] Removed dot from the message when connector created/updated successfully --- ui-ngx/src/assets/locale/locale.constant-en_US.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0fa09da5e4..ede6a9916e 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -2804,8 +2804,8 @@ "copy-username": "Copy username", "copy-password": "Copy password", "copy-client-id": "Copy client ID", - "connector-created": "Connector created.", - "connector-updated": "Connector updated.", + "connector-created": "Connector created", + "connector-updated": "Connector updated", "rpc-command-save-template": "Save Template", "rpc-command-send": "Send", "rpc-command-result": "Response", From 41187693663b0ebb369ede6190562b8dd49ed09c Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 11:49:01 +0300 Subject: [PATCH 14/45] [PROD-3709] [FIX] Added adaptive height for datamaping dialog --- .../lib/gateway/dialog/mapping-dialog.component.scss | 8 ++++++++ 1 file changed, 8 insertions(+) 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 db98bc07cb..2237716a7c 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 @@ -35,6 +35,14 @@ .mat-mdc-dialog-content { max-height: 670px; height: 670px; + + @media screen and (max-height: 800px) { + $mat-toolbar-height: 64px; + $mat-mdc-dialog-actions: 53px; + $dialog-offset: 24px; + $content-height: calc(100vh - #{$mat-toolbar-height} - #{$mat-mdc-dialog-actions} - #{$dialog-offset}); + max-height: $content-height; + } } .ellipsis-chips-container { From b0d897c68db081670484a3d6df4baac9e9541563 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 12:05:53 +0300 Subject: [PATCH 15/45] [PROD-3709] [FIX] refactoring --- .../lib/gateway/dialog/mapping-dialog.component.scss | 9 --------- 1 file changed, 9 deletions(-) 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 2237716a7c..d002a0fc87 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 @@ -33,16 +33,7 @@ } .mat-mdc-dialog-content { - max-height: 670px; height: 670px; - - @media screen and (max-height: 800px) { - $mat-toolbar-height: 64px; - $mat-mdc-dialog-actions: 53px; - $dialog-offset: 24px; - $content-height: calc(100vh - #{$mat-toolbar-height} - #{$mat-mdc-dialog-actions} - #{$dialog-offset}); - max-height: $content-height; - } } .ellipsis-chips-container { From 9f0c998bb37db3fb4f008fa411aff4fd6f7e62f7 Mon Sep 17 00:00:00 2001 From: rusikv Date: Thu, 13 Jun 2024 12:26:25 +0300 Subject: [PATCH 16/45] UI: disabled autocomplete and added missing duplicate name error icon for connector name fields in gateway dashboard --- .../gateway/dialog/add-connector-dialog.component.html | 2 +- .../widget/lib/gateway/gateway-connectors.component.html | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html index ec1fa9a87f..3dfc831113 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html @@ -44,7 +44,7 @@
gateway.name
- + gateway.name
- + warning From 7420d66bb732c237f76f76fad6d5554fb71273fb Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 12:48:02 +0300 Subject: [PATCH 17/45] [PROD-3687] [FIX] added asterisk symbol to fields 'name' and 'profile name' in MQTT Connector Device Configuration --- .../connectors-configuration/device-info-table.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.html index 2a3108b8b4..c3fe478ef2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/device-info-table.component.html @@ -28,7 +28,7 @@
-
gateway.device-info.name
+
gateway.device-info.name
@@ -61,7 +61,7 @@
-
gateway.device-info.profile-name
+
gateway.device-info.profile-name
From f97d08c59a7834f96512c181f09b551875c89409 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 14:46:30 +0300 Subject: [PATCH 18/45] [PROD-3650] [FIX] Changed method field in SNMP Connector --- ...-service-rpc-connector-templates.component.html | 5 ++++- ...ay-service-rpc-connector-templates.component.ts | 4 +++- .../widget/lib/gateway/gateway-widget.models.ts | 14 +++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html index c0f6997a36..9a8a0b4152 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html @@ -47,7 +47,10 @@
- {{config.value}}
+ +
+ {{ config.value }} + {{ 'gateway.rpc.' + SNMPMethodsTitles[config.value] | translate }} 0; public readonly isObject = (value: any) => isLiteralObject(value); + public readonly SNMPMethodsTitles = SNMPMethodsTitles; constructor(private attributeService: AttributeService) { } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts index 0e143cff36..af349aa99e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts @@ -261,6 +261,18 @@ export enum SNMPMethods { WALKS = "walk" } +export enum SNMPMethodsTitles { + set = 'set', + multiset = "multiset", + get = "get", + bulkwalk = "bulk-walk", + table = "table", + multiget = "multi-get", + getnext = "get-next", + bulkget = "bulk-get", + walk = "walk" +} + export const SNMPMethodsTranslations = new Map([ [SNMPMethods.SET, 'gateway.rpc.set'], [SNMPMethods.MULTISET, 'gateway.rpc.multiset'], @@ -269,7 +281,7 @@ export const SNMPMethodsTranslations = new Map([ [SNMPMethods.TABLE, 'gateway.rpc.table'], [SNMPMethods.MULTIGET, 'gateway.rpc.multi-get'], [SNMPMethods.GETNEXT, 'gateway.rpc.get-next'], - [SNMPMethods.BULKGET, 'gateway.rpc.bul-kget'], + [SNMPMethods.BULKGET, 'gateway.rpc.bulk-get'], [SNMPMethods.WALKS, 'gateway.rpc.walk'] ]) From 797902ced9e4287937cee9e5023a4e4c91bcbde2 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 15:33:13 +0300 Subject: [PATCH 19/45] [PROD-3650] [FIX] refactoring --- ...ay-service-rpc-connector-templates.component.html | 2 +- ...eway-service-rpc-connector-templates.component.ts | 4 ++-- .../widget/lib/gateway/gateway-widget.models.ts | 12 ------------ 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html index 9a8a0b4152..d161f402dd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html @@ -50,7 +50,7 @@
{{ config.value }} - {{ 'gateway.rpc.' + SNMPMethodsTitles[config.value] | translate }} + {{ SNMPMethodsTranslations.get(config.value) | translate }} 0; public readonly isObject = (value: any) => isLiteralObject(value); - public readonly SNMPMethodsTitles = SNMPMethodsTitles; + public readonly SNMPMethodsTranslations = SNMPMethodsTranslations; constructor(private attributeService: AttributeService) { } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts index af349aa99e..3c02deb49b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts @@ -261,18 +261,6 @@ export enum SNMPMethods { WALKS = "walk" } -export enum SNMPMethodsTitles { - set = 'set', - multiset = "multiset", - get = "get", - bulkwalk = "bulk-walk", - table = "table", - multiget = "multi-get", - getnext = "get-next", - bulkget = "bulk-get", - walk = "walk" -} - export const SNMPMethodsTranslations = new Map([ [SNMPMethods.SET, 'gateway.rpc.set'], [SNMPMethods.MULTISET, 'gateway.rpc.multiset'], From 8e11d04a86fb6c87a825e1c54b8a92e8759d59ed Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 16:24:49 +0300 Subject: [PATCH 20/45] [PROD-3645] [FIX] Added max width to the display of the template name --- ...y-service-rpc-connector-templates.component.html | 2 +- ...y-service-rpc-connector-templates.component.scss | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html index c0f6997a36..b2e0e3f1c2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html @@ -18,7 +18,7 @@
{{ 'gateway.rpc.templates-title' | translate }}
- + {{template.name}} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.scss index 7e5c4af1f1..02c2348bca 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.scss @@ -89,6 +89,19 @@ } } + .template-name { + max-width: 170px; + overflow: scroll; + } + + ::ng-deep .mat-expansion-panel-header-title { + flex: 1; + margin: 0; + } + + ::ng-deep .mat-expansion-panel-header-description { + flex: 0; + } } From 2d47c1350322bc2f083c3cccfbd13fc024579b24 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Jun 2024 17:12:18 +0300 Subject: [PATCH 21/45] [PROD-3645] [FIX] changed to three dots with tooltip --- ...gateway-service-rpc-connector-templates.component.html | 2 +- ...gateway-service-rpc-connector-templates.component.scss | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html index b2e0e3f1c2..174d044a7b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector-templates.component.html @@ -19,7 +19,7 @@ - {{template.name}} + {{template.name}}
+
+
gateway.connectors-table-class
+
+ + + +
+
+
+
gateway.connectors-table-key
+
+ + + +
+
gateway.remote-logging-level
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts index 98261a8e57..eb55765887 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts @@ -66,6 +66,8 @@ export class AddConnectorDialogComponent extends DialogComponent
+
+
gateway.connectors-table-class
+
+ + + +
+
+
+
gateway.connectors-table-key
+
+ + + +
+
gateway.logs-configuration
From 150f57dc381bbffe9a8d823f25fe73650bee5844 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 14 Jun 2024 16:54:00 +0300 Subject: [PATCH 26/45] Removed toggle 'fill configuration with default values' for GRCP and Custom Connectors --- .../add-connector-dialog.component.html | 3 ++- .../dialog/add-connector-dialog.component.ts | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html index ec1fa9a87f..2d2193667b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.html @@ -68,7 +68,8 @@
-
+
{{ 'gateway.fill-connector-defaults' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts index 98261a8e57..34250afc60 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/dialog/add-connector-dialog.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, Inject, OnDestroy } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -33,6 +33,7 @@ import { } from '@home/components/widget/lib/gateway/gateway-widget.models'; import { Subject } from 'rxjs'; import { ResourcesService } from '@core/services/resources.service'; +import { takeUntil, tap } from "rxjs/operators"; @Component({ selector: 'tb-add-connector-dialog', @@ -40,7 +41,7 @@ import { ResourcesService } from '@core/services/resources.service'; styleUrls: ['./add-connector-dialog.component.scss'], providers: [], }) -export class AddConnectorDialogComponent extends DialogComponent> implements OnDestroy { +export class AddConnectorDialogComponent extends DialogComponent> implements OnInit, OnDestroy { connectorForm: UntypedFormGroup; @@ -69,6 +70,10 @@ export class AddConnectorDialogComponent extends DialogComponent { + const useDefaultControl = this.connectorForm.get('useDefaults'); + if (type === ConnectorType.GRPC || type === ConnectorType.CUSTOM) { + useDefaultControl.setValue(false); + } else if (!useDefaultControl.value) { + useDefaultControl.setValue(true); + } + }), + takeUntil(this.destroy$), + ).subscribe() + } } From 4c0ee73a70ac02c1bbe51521e0ad7364fdec8a3c Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 14 Jun 2024 18:40:56 +0300 Subject: [PATCH 27/45] Fixed Command launcher pop up and dashboard open after creation --- application/src/main/data/json/tenant/dashboards/gateways.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index 42c4f199b5..46b4cff8b0 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -248,7 +248,7 @@ "type": "customPretty", "customHtml": "
\r\n \r\n

Add gateway

\r\n \r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n Name\r\n \r\n \r\n Gateway name is required.\r\n \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n", "customCss": ".add-entity-form {\r\n min-width: 400px !important;\r\n}\r\n\r\n.add-entity-form .boolean-value-input {\r\n padding-left: 5px;\r\n}\r\n\r\n.add-entity-form .boolean-value-input .checkbox-label {\r\n margin-bottom: 8px;\r\n color: rgba(0,0,0,0.54);\r\n font-size: 12px;\r\n}\r\n\r\n.relations-list .header {\r\n padding-right: 5px;\r\n padding-bottom: 5px;\r\n padding-left: 5px;\r\n}\r\n\r\n.relations-list .header .cell {\r\n padding-right: 5px;\r\n padding-left: 5px;\r\n font-size: 12px;\r\n font-weight: 700;\r\n color: rgba(0, 0, 0, .54);\r\n white-space: nowrap;\r\n}\r\n\r\n.relations-list .mat-form-field-infix {\r\n width: auto !important;\r\n}\r\n\r\n.relations-list .body {\r\n padding-right: 5px;\r\n padding-bottom: 15px;\r\n padding-left: 5px;\r\n}\r\n\r\n.relations-list .body .row {\r\n padding-top: 5px;\r\n}\r\n\r\n.relations-list .body .cell {\r\n padding-right: 5px;\r\n padding-left: 5px;\r\n}\r\n\r\n.relations-list .body .md-button {\r\n margin: 0;\r\n}\r\n\r\n", - "customFunction": "let $injector = widgetContext.$scope.$injector;\r\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\r\nlet assetService = $injector.get(widgetContext.servicesMap.get('assetService'));\r\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\r\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\r\nlet entityRelationService = $injector.get(widgetContext.servicesMap.get('entityRelationService'));\r\nlet userSettingsService = $injector.get(widgetContext.servicesMap.get('userSettingsService'));\r\n\r\nopenAddEntityDialog();\r\n\r\nfunction openAddEntityDialog() {\r\n customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe();\r\n}\r\n\r\nfunction AddEntityDialogController(instance) {\r\n let vm = instance;\r\n let userSettings;\r\n userSettingsService.loadUserSettings().subscribe(settings=> {\r\n userSettings = settings;\r\n if (!userSettings.createdGatewaysCount) userSettings.createdGatewaysCount = 0;\r\n });\r\n \r\n\r\n vm.addEntityFormGroup = vm.fb.group({\r\n entityName: ['', [vm.validators.required]],\r\n entityType: ['DEVICE'],\r\n entityLabel: [''],\r\n type: ['', [vm.validators.required]],\r\n });\r\n\r\n vm.cancel = function() {\r\n vm.dialogRef.close(null);\r\n };\r\n\r\n\r\n vm.save = function($event) {\r\n vm.addEntityFormGroup.markAsPristine();\r\n saveEntityObservable().subscribe(\r\n function (device) {\r\n widgetContext.updateAliases();\r\n userSettingsService.putUserSettings({ createdGatewaysCount: ++userSettings.createdGatewaysCount }).subscribe(_=>{\r\n });\r\n vm.dialogRef.close(null);\r\n openCommandDialog(device, $event);\r\n }\r\n );\r\n };\r\n \r\n function openCommandDialog(device, $event) {\r\n vm.device = device;\r\n let openCommandAction = widgetContext.actionsApi.getActionDescriptors(\"actionCellButton\").find(action => action.name == \"Docker commands\");\r\n widgetContext.actionsApi.handleWidgetAction($event, openCommandAction, device.id, device.name, {newDevice: true});\r\n goToConfigState();\r\n }\r\n\r\n \r\n function goToConfigState() {\r\n const stateParams = {};\r\n stateParams.entityId = vm.device.id;\r\n stateParams.entityName = vm.device.name;\r\n const newStateParams = {\r\n targetEntityParamName: 'default',\r\n new_gateway: {\r\n entityId: vm.device.id,\r\n entityName: vm.device.name\r\n }\r\n }\r\n const params = {...stateParams, ...newStateParams};\r\n widgetContext.stateController.openState('gateway_details', params, false);\r\n }\r\n\r\n function saveEntityObservable() {\r\n const formValues = vm.addEntityFormGroup.value;\r\n let entity = {\r\n name: formValues.entityName,\r\n type: formValues.type,\r\n label: formValues.entityLabel,\r\n additionalInfo: {\r\n gateway: true\r\n }\r\n };\r\n return deviceService.saveDevice(entity);\r\n }\r\n}\r\n", + "customFunction": "let $injector = widgetContext.$scope.$injector;\r\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\r\nlet assetService = $injector.get(widgetContext.servicesMap.get('assetService'));\r\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\r\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\r\nlet entityRelationService = $injector.get(widgetContext.servicesMap.get('entityRelationService'));\r\nlet userSettingsService = $injector.get(widgetContext.servicesMap.get('userSettingsService'));\r\n\r\nopenAddEntityDialog();\r\n\r\nfunction openAddEntityDialog() {\r\n customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe();\r\n}\r\n\r\nfunction AddEntityDialogController(instance) {\r\n let vm = instance;\r\n let userSettings;\r\n userSettingsService.loadUserSettings().subscribe(settings=> {\r\n userSettings = settings;\r\n if (!userSettings.createdGatewaysCount) userSettings.createdGatewaysCount = 0;\r\n });\r\n \r\n\r\n vm.addEntityFormGroup = vm.fb.group({\r\n entityName: ['', [vm.validators.required]],\r\n entityType: ['DEVICE'],\r\n entityLabel: [''],\r\n type: ['', [vm.validators.required]],\r\n });\r\n\r\n vm.cancel = function() {\r\n vm.dialogRef.close(null);\r\n };\r\n\r\n\r\n vm.save = function($event) {\r\n vm.addEntityFormGroup.markAsPristine();\r\n saveEntityObservable().subscribe(\r\n function (device) {\r\n widgetContext.updateAliases();\r\n userSettingsService.putUserSettings({ createdGatewaysCount: ++userSettings.createdGatewaysCount }).subscribe(_=>{\r\n });\r\n vm.dialogRef.close(null);\r\n openCommandDialog(device, $event);\r\n }\r\n );\r\n };\r\n \r\n function openCommandDialog(device, $event) {\r\n vm.device = device;\r\n let openCommandAction = widgetContext.actionsApi.getActionDescriptors(\"actionCellButton\").find(action => action.name == \"Launch command\");\r\n widgetContext.actionsApi.handleWidgetAction($event, openCommandAction, device.id, device.name, {newDevice: true});\r\n goToConfigState();\r\n }\r\n\r\n \r\n function goToConfigState() {\r\n const stateParams = {};\r\n stateParams.entityId = vm.device.id;\r\n stateParams.entityName = vm.device.name;\r\n const newStateParams = {\r\n targetEntityParamName: 'default',\r\n new_gateway: {\r\n entityId: vm.device.id,\r\n entityName: vm.device.name\r\n }\r\n }\r\n const params = {...stateParams, ...newStateParams};\r\n widgetContext.stateController.openState('gateway_details', params, false);\r\n }\r\n\r\n function saveEntityObservable() {\r\n const formValues = vm.addEntityFormGroup.value;\r\n let entity = {\r\n name: formValues.entityName,\r\n type: formValues.type,\r\n label: formValues.entityLabel,\r\n additionalInfo: {\r\n gateway: true\r\n }\r\n };\r\n return deviceService.saveDevice(entity);\r\n }\r\n}\r\n", "customResources": [], "openInSeparateDialog": false, "openInPopover": false, From d39d866698908d1c919c30045aaefed5dd7fdc70 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Jun 2024 11:38:38 +0300 Subject: [PATCH 28/45] Optimized the 'Commands' table in the statistics tab for the 'General configuration' pop-up window --- .../widget/lib/gateway/gateway-configuration.component.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss index f7562c748e..9d72d1d759 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss @@ -55,7 +55,7 @@ } .statistics-container { - width: 50%; + width: 100%; .command-container { width: 100%; From bab37b3a11fa87a92e4efa9787e61c87a531f527 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Jun 2024 12:22:43 +0300 Subject: [PATCH 29/45] Fixed mistakes in tooltips - IoT Gateway dashboard - General Configuration --- ui-ngx/src/assets/locale/locale.constant-en_US.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 5106b622dd..0898020fe8 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -3237,17 +3237,17 @@ "password": "MQTT password for the gateway form platform server", "ca-cert": "Path to CA certificate file", "date-form": "Date format in log message", - "data-folder": "Path to folder, that will contains data (Relative or Absolute)", + "data-folder": "Path to the folder that will contain data (Relative or Absolute)", "log-format": "Log message format", "remote-log": "Enables remote logging and logs reading from the gateway", "backup-count": "If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted", "storage": "Provides configuration for saving incoming data before it is sent to the platform", - "max-file-count": "Maximum count of file that will be created", - "max-read-count": "Count of messages to get from storage and send to platform", + "max-file-count": "Maximum number of files that will be created", + "max-read-count": "Number of messages to retrieve from the storage and send to platform", "max-records": "Maximum count of records that will be stored in one file", "read-record-count": "Count of messages to get from storage and send to platform", - "max-records-count": "Maximum count of data in storage before send to platform", - "ttl-check-hour": "How often will Gateway check data for obsolescence", + "max-records-count": "Maximum number of data entries in storage before sending to platform", + "ttl-check-hour": "How often will the Gateway check data for obsolescence", "ttl-messages-day": "Maximum days that storage will save data", "commands": "Commands for collecting additional statistic", "attribute": "Statistic telemetry key", From 5185a68a68bc811c3df35d02246c915c9b96f766 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Jun 2024 12:37:00 +0300 Subject: [PATCH 30/45] refactoring --- ui-ngx/src/assets/locale/locale.constant-en_US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0898020fe8..28321f7fce 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -3245,7 +3245,7 @@ "max-file-count": "Maximum number of files that will be created", "max-read-count": "Number of messages to retrieve from the storage and send to platform", "max-records": "Maximum count of records that will be stored in one file", - "read-record-count": "Count of messages to get from storage and send to platform", + "read-record-count": "Number of messages to retrieve from the storage and send to platform", "max-records-count": "Maximum number of data entries in storage before sending to platform", "ttl-check-hour": "How often will the Gateway check data for obsolescence", "ttl-messages-day": "Maximum days that storage will save data", From 5b9cb59eb162d10872d58f80c4c8bbaa232aa217 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Jun 2024 12:50:06 +0300 Subject: [PATCH 31/45] refactoring --- ui-ngx/src/assets/locale/locale.constant-en_US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 28321f7fce..4708cab860 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -3248,7 +3248,7 @@ "read-record-count": "Number of messages to retrieve from the storage and send to platform", "max-records-count": "Maximum number of data entries in storage before sending to platform", "ttl-check-hour": "How often will the Gateway check data for obsolescence", - "ttl-messages-day": "Maximum days that storage will save data", + "ttl-messages-day": "Maximum number of days that the storage will retain data", "commands": "Commands for collecting additional statistic", "attribute": "Statistic telemetry key", "timeout": "Timeout for command executing", From 522c926ca51f2d5b3f758e80313915c4aaa877fb Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Jun 2024 17:31:29 +0300 Subject: [PATCH 32/45] Fixed jumping rows when updating data in Gateway Logs table --- .../widget/lib/gateway/gateway-logs.component.html | 2 +- .../components/widget/lib/gateway/gateway-logs.component.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html index d36a4c0a51..0382d0ebbd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.html @@ -21,7 +21,7 @@ [active]="activeLink.name === link.name"> {{ link.name }} - diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.ts index 0607268edc..d029279c2b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-logs.component.ts @@ -164,6 +164,10 @@ export class GatewayLogsComponent implements AfterViewInit { } } + trackByLogTs(_: number, log: GatewayLogData): number { + return log.ts; + } + private changeSubscription() { if (this.ctx.datasources && this.ctx.datasources[0].entity && this.ctx.defaultSubscription.options.datasources) { this.ctx.defaultSubscription.options.datasources[0].dataKeys = [{ @@ -178,5 +182,4 @@ export class GatewayLogsComponent implements AfterViewInit { }; } } - } From e0aa8f8f958e2404dc9a5b2091db07721078634f Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 18 Jun 2024 17:24:45 +0300 Subject: [PATCH 33/45] Added optimization for the fields in Gateway Configuration --- .../gateway-configuration.component.html | 1250 +++++++++-------- 1 file changed, 631 insertions(+), 619 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html index 8aeaeef2ed..d622afa789 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html @@ -20,737 +20,749 @@ -
-
-
- - {{ 'gateway.remote-configuration' | translate }} - -
-
- - {{ 'gateway.remote-shell' | translate }} - -
-
- - gateway.thingsboard-host - - info_outlined - - - {{ 'gateway.thingsboard-host-required' | translate }} - - - - gateway.thingsboard-port - - - {{ 'gateway.thingsboard-port-required' | translate }} - - - {{ 'gateway.thingsboard-port-min' | translate }} - - - {{ 'gateway.thingsboard-port-max' | translate }} - - - {{ 'gateway.thingsboard-port-pattern' | translate }} - - info_outlined - - + +
+
+
+ + {{ 'gateway.remote-configuration' | translate }} + +
+
+ + {{ 'gateway.remote-shell' | translate }} + +
+
+ + gateway.thingsboard-host + + info_outlined + + + {{ 'gateway.thingsboard-host-required' | translate }} + + + + gateway.thingsboard-port + + + {{ 'gateway.thingsboard-port-required' | translate }} + + + {{ 'gateway.thingsboard-port-min' | translate }} + + + {{ 'gateway.thingsboard-port-max' | translate }} + + + {{ 'gateway.thingsboard-port-pattern' | translate }} + + info_outlined + + +
-
-
-
security.security
- - - {{ securityType.value | translate }} - - - security.access-token - - - {{ 'security.access-token-required' | translate }} - - - - info_outlined - - -
- - security.clientId - - - {{ 'security.clientId-required' | translate }} +
+
security.security
+ + + {{ securityType.value | translate }} + + + security.access-token + + + {{ 'security.access-token-required' | translate }} info_outlined + matTooltip="{{ 'gateway.hints.token' | translate }}">info_outlined - - security.username - - - {{ 'security.username-required' | translate }} - +
+ + security.clientId + + + {{ 'security.clientId-required' | translate }} + + + + info_outlined + + + + security.username + + + {{ 'security.username-required' | translate }} + + + + info_outlined + + +
+ + gateway.password + info_outlined + matTooltip="{{ 'gateway.hints.password' | translate }}">info_outlined -
- - gateway.password - - - - info_outlined - - - - - - + + + +
-
+ -
-
-
- - gateway.logs.date-format - - - {{ 'gateway.logs.date-format-required' | translate }} - - info_outlined - - - - gateway.logs.log-format - - - {{ 'gateway.logs.log-format-required' | translate }} - - info_outlined - - -
-
-
-
gateway.logs.remote
-
- - {{ 'gateway.logs.remote-logs' | translate }} - -
- - gateway.logs.level - - {{ logLevel }} - - -
-
-
gateway.logs.local
- - {{ localLogsConfigTranslateMap.get(logConfig) }} - - -
- - gateway.logs.level - - {{ logLevel }} - + +
+
+
+ + gateway.logs.date-format + + + {{ 'gateway.logs.date-format-required' | translate }} + + info_outlined + - - gateway.logs.file-path - - - {{ 'gateway.logs.file-path-required' | translate }} + + gateway.logs.log-format + + + {{ 'gateway.logs.log-format-required' | translate }} + info_outlined +
-
-
+
+
+
gateway.logs.remote
+
+ + {{ 'gateway.logs.remote-logs' | translate }} + +
+ + gateway.logs.level + + {{ logLevel }} + + +
+
+
gateway.logs.local
+ + {{ localLogsConfigTranslateMap.get(logConfig) }} + + +
+ + gateway.logs.level + + {{ logLevel }} + + - gateway.logs.saving-period - + gateway.logs.file-path + + + {{ 'gateway.logs.file-path-required' | translate }} + + +
+
+
+ + gateway.logs.saving-period + + + {{ 'gateway.logs.saving-period-required' | translate }} + + + {{ 'gateway.logs.saving-period-min' | translate }} + + + + + + {{ period.value | translate }} + + + +
+ + gateway.logs.backup-count + - {{ 'gateway.logs.saving-period-required' | translate }} + *ngIf="gatewayConfigGroup.get('logs.local.' + logSelector.value + '.backupCount').hasError('required')"> + {{ 'gateway.logs.backup-count-required' | translate }} - {{ 'gateway.logs.saving-period-min' | translate }} + *ngIf="gatewayConfigGroup.get('logs.local.' + logSelector.value + '.backupCount').hasError('min')"> + {{ 'gateway.logs.backup-count-min' | translate }} - - - - - {{ period.value | translate }} - - + info_outlined +
- - gateway.logs.backup-count - - - {{ 'gateway.logs.backup-count-required' | translate }} - - - {{ 'gateway.logs.backup-count-min' | translate }} - - info_outlined - - -
- + +
-
+
-
-
-
gateway.storage
-
gateway.hints.storage
- - - {{ storageTypesTranslationMap.get(storageType) | translate }} - - -
{{ 'gateway.hints.' + gatewayConfigGroup.get('storage.type').value | translate }}
- -
- - gateway.storage-read-record-count - - - {{ 'gateway.storage-read-record-count-required' | translate }} - - - {{ 'gateway.storage-read-record-count-min' | translate }} - - - {{ 'gateway.storage-read-record-count-pattern' | translate }} - - info_outlined - - - - gateway.storage-max-records - - - {{ 'gateway.storage-max-records-required' | translate }} - - - {{ 'gateway.storage-max-records-min' | translate }} - - - {{ 'gateway.storage-max-records-pattern' | translate }} - - info_outlined - - -
-
-
+ +
+
+
gateway.storage
+
gateway.hints.storage
+ + + {{ storageTypesTranslationMap.get(storageType) | translate }} + + +
{{ 'gateway.hints.' + gatewayConfigGroup.get('storage.type').value | translate }}
+ +
- gateway.storage-data-folder-path - - - {{ 'gateway.storage-data-folder-path-required' | translate }} - - info_outlined + gateway.storage-read-record-count + + + {{ 'gateway.storage-read-record-count-required' | translate }} + + + {{ 'gateway.storage-read-record-count-min' | translate }} + + + {{ 'gateway.storage-read-record-count-pattern' | translate }} + + info_outlined - gateway.storage-max-files - - - {{ 'gateway.storage-max-files-required' | translate }} + gateway.storage-max-records + + + {{ 'gateway.storage-max-records-required' | translate }} - - {{ 'gateway.storage-max-files-min' | translate }} + + {{ 'gateway.storage-max-records-min' | translate }} - - {{ 'gateway.storage-max-files-pattern' | translate }} + + {{ 'gateway.storage-max-records-pattern' | translate }} info_outlined + matTooltip="{{ 'gateway.hints.max-records-count' | translate }}">info_outlined -
-
- - gateway.storage-max-read-record-count - - - {{ 'gateway.storage-max-read-record-count-required' | translate }} +
+
+
+ + gateway.storage-data-folder-path + + + {{ 'gateway.storage-data-folder-path-required' | translate }} + + info_outlined + + + + gateway.storage-max-files + + + {{ 'gateway.storage-max-files-required' | translate }} + + + {{ 'gateway.storage-max-files-min' | translate }} + + + {{ 'gateway.storage-max-files-pattern' | translate }} + + info_outlined + + +
+
+ + gateway.storage-max-read-record-count + + + {{ 'gateway.storage-max-read-record-count-required' | translate }} + + + {{ 'gateway.storage-max-read-record-count-min' | translate }} + + + {{ 'gateway.storage-max-read-record-count-pattern' | translate }} + + info_outlined + + + + gateway.storage-max-file-records + + + {{ 'gateway.storage-max-records-required' | translate }} + + + {{ 'gateway.storage-max-records-min' | translate }} + + + {{ 'gateway.storage-max-records-pattern' | translate }} + + info_outlined + + +
+
+
+
+ + gateway.storage-path + + + {{ 'gateway.storage-path-required' | translate }} + + info_outlined + + + + gateway.messages-ttl-check-in-hours + + + {{ 'gateway.messages-ttl-check-in-hours-required' | translate }} + + + {{ 'gateway.messages-ttl-check-in-hours-min' | translate }} + + + {{ 'gateway.messages-ttl-check-in-hours-pattern' | translate }} + + info_outlined + + +
+ + gateway.messages-ttl-in-days + + + {{ 'gateway.messages-ttl-in-days-required' | translate }} - - {{ 'gateway.storage-max-read-record-count-min' | translate }} + + {{ 'gateway.messages-ttl-in-days-min' | translate }} - - {{ 'gateway.storage-max-read-record-count-pattern' | translate }} + + {{ 'gateway.messages-ttl-in-days-pattern' | translate }} info_outlined + matTooltip="{{ 'gateway.hints.ttl-messages-day' | translate }}">info_outlined +
+
+
+
+ +
+ + +
+
+ + {{ 'gateway.grpc' | translate }} + +
+ + {{ 'gateway.permit-without-calls' | translate }} + +
+
+
- gateway.storage-max-file-records - - - {{ 'gateway.storage-max-records-required' | translate }} + gateway.server-port + + info_outlined + + + {{ 'gateway.thingsboard-port-required' | translate }} - - {{ 'gateway.storage-max-records-min' | translate }} + + {{ 'gateway.thingsboard-port-min' | translate }} - - {{ 'gateway.storage-max-records-pattern' | translate }} + + {{ 'gateway.thingsboard-port-max' | translate }} + + + {{ 'gateway.thingsboard-port-pattern' | translate }} + + + gateway.grpc-keep-alive-timeout + info_outlined + matTooltip="{{ 'gateway.hints.grpc-keep-alive-timeout' | translate }}">info_outlined + + {{ 'gateway.grpc-keep-alive-timeout-required' | translate }} + + + {{ 'gateway.grpc-keep-alive-timeout-min' | translate }} + + + {{ 'gateway.grpc-keep-alive-timeout-pattern' | translate }} + -
- -
-
+
+
- gateway.storage-path - - - {{ 'gateway.storage-path-required' | translate }} + gateway.grpc-keep-alive + + info_outlined + + + {{ 'gateway.grpc-keep-alive-required' | translate }} + + + {{ 'gateway.grpc-keep-alive-min' | translate }} + + {{ 'gateway.grpc-keep-alive-pattern' | translate }} + + + + gateway.grpc-min-time-between-pings + info_outlined + matTooltip="{{ 'gateway.hints.grpc-min-time-between-pings' | translate }}">info_outlined + + {{ 'gateway.grpc-min-time-between-pings-required' | translate }} + + + {{ 'gateway.grpc-min-time-between-pings-min' | translate }} + + + {{ 'gateway.grpc-min-time-between-pings-pattern' | translate }} + +
+
- gateway.messages-ttl-check-in-hours - - - {{ 'gateway.messages-ttl-check-in-hours-required' | translate }} + gateway.grpc-max-pings-without-data + + info_outlined + + + {{ 'gateway.grpc-max-pings-without-data-required' | translate }} - - {{ 'gateway.messages-ttl-check-in-hours-min' | translate }} + + {{ 'gateway.grpc-max-pings-without-data-min' | translate }} - - {{ 'gateway.messages-ttl-check-in-hours-pattern' | translate }} + + {{ 'gateway.grpc-max-pings-without-data-pattern' | translate }} + + + gateway.grpc-min-ping-interval-without-data + info_outlined + matTooltip="{{ 'gateway.hints.grpc-min-ping-interval-without-data' | translate }}">info_outlined + + {{ 'gateway.grpc-min-ping-interval-without-data-required' | translate }} + + + {{ 'gateway.grpc-min-ping-interval-without-data-min' | translate }} + + + {{ 'gateway.grpc-min-ping-interval-without-data-pattern' | translate }} + -
- - gateway.messages-ttl-in-days - - - {{ 'gateway.messages-ttl-in-days-required' | translate }} - - - {{ 'gateway.messages-ttl-in-days-min' | translate }} - - - {{ 'gateway.messages-ttl-in-days-pattern' | translate }} - - info_outlined - - + - +
-
+
- -
-
- - {{ 'gateway.grpc' | translate }} - -
- - {{ 'gateway.permit-without-calls' | translate }} + + +
+
+ + {{ 'gateway.statistics.statistics' | translate }} + + gateway.statistics.send-period + + + {{ 'gateway.statistics.send-period-required' | translate }} + + + {{ 'gateway.statistics.send-period-min' | translate }} + + + {{ 'gateway.statistics.send-period-pattern' | translate }} + +
-
-
+
+
gateway.statistics.commands
+
gateway.hints.commands
+ +
+
+
+ + gateway.statistics.attribute-name + + + {{ 'gateway.statistics.attribute-name-required' | translate }} + + info_outlined + + + + gateway.statistics.timeout + + + {{ 'gateway.statistics.timeout-required' | translate }} + + + {{ 'gateway.statistics.timeout-min' | translate }} + + + {{ 'gateway.statistics.timeout-pattern' | translate }} + + info_outlined + + +
+ + gateway.statistics.command + + + {{ 'gateway.statistics.command-required' | translate }} + + + {{ 'gateway.statistics.command-pattern' | translate }} + + info_outlined + + +
+ +
+ +
+
+
+
+
+ + +
+
+
+ + {{ 'gateway.checking-device-activity' | translate }} + +
+
- gateway.server-port - - info_outlined - - - {{ 'gateway.thingsboard-port-required' | translate }} - - - {{ 'gateway.thingsboard-port-min' | translate }} + gateway.inactivity-timeout-seconds + + + {{ 'gateway.inactivity-timeout-seconds-required' | translate }} - - {{ 'gateway.thingsboard-port-max' | translate }} + + {{ 'gateway.inactivity-timeout-seconds-min' | translate }} - - {{ 'gateway.thingsboard-port-pattern' | translate }} + + {{ 'gateway.inactivity-timeout-seconds-pattern' | translate }} - - - gateway.grpc-keep-alive-timeout - info_outlined + matTooltip="{{ 'gateway.hints.inactivity-timeout' | translate }}">info_outlined - - {{ 'gateway.grpc-keep-alive-timeout-required' | translate }} - - - {{ 'gateway.grpc-keep-alive-timeout-min' | translate }} - - - {{ 'gateway.grpc-keep-alive-timeout-pattern' | translate }} - -
-
- gateway.grpc-keep-alive - - info_outlined - - - {{ 'gateway.grpc-keep-alive-required' | translate }} + gateway.inactivity-check-period-seconds + + + {{ 'gateway.inactivity-check-period-seconds-required' | translate }} - - {{ 'gateway.grpc-keep-alive-min' | translate }} + + {{ 'gateway.inactivity-check-period-seconds-min' | translate }} - - {{ 'gateway.grpc-keep-alive-pattern' | translate }} + + {{ 'gateway.inactivity-check-period-seconds-pattern' | translate }} - - - gateway.grpc-min-time-between-pings - info_outlined + matTooltip="{{ 'gateway.hints.inactivity-period' | translate }}">info_outlined - - {{ 'gateway.grpc-min-time-between-pings-required' | translate }} - - - {{ 'gateway.grpc-min-time-between-pings-min' | translate }} - - - {{ 'gateway.grpc-min-time-between-pings-pattern' | translate }} -
+
+
+
gateway.advanced
- gateway.grpc-max-pings-without-data - - info_outlined - - - {{ 'gateway.grpc-max-pings-without-data-required' | translate }} - - - {{ 'gateway.grpc-max-pings-without-data-min' | translate }} + gateway.min-pack-send-delay + + + {{ 'gateway.min-pack-send-delay-required' | translate }} - - {{ 'gateway.grpc-max-pings-without-data-pattern' | translate }} + + {{ 'gateway.min-pack-send-delay-min' | translate }} - - - gateway.grpc-min-ping-interval-without-data - info_outlined + matTooltip="{{ 'gateway.hints.minimal-pack-delay' | translate }}">info_outlined - - {{ 'gateway.grpc-min-ping-interval-without-data-required' | translate }} + + + gateway.mqtt-qos + + + {{ 'gateway.mqtt-qos-required' | translate }} - - {{ 'gateway.grpc-min-ping-interval-without-data-min' | translate }} + + {{ 'gateway.mqtt-qos-range' | translate }} - - {{ 'gateway.grpc-min-ping-interval-without-data-pattern' | translate }} + + {{ 'gateway.mqtt-qos-range' | translate }} + info_outlined +
- -
-
-
- -
-
- - {{ 'gateway.statistics.statistics' | translate }} - - - gateway.statistics.send-period - - - {{ 'gateway.statistics.send-period-required' | translate }} - - - {{ 'gateway.statistics.send-period-min' | translate }} - - - {{ 'gateway.statistics.send-period-pattern' | translate }} - - -
-
-
gateway.statistics.commands
-
gateway.hints.commands
- -
-
-
- - gateway.statistics.attribute-name - - - {{ 'gateway.statistics.attribute-name-required' | translate }} - - info_outlined - - - - gateway.statistics.timeout - - - {{ 'gateway.statistics.timeout-required' | translate }} - - - {{ 'gateway.statistics.timeout-min' | translate }} - - - {{ 'gateway.statistics.timeout-pattern' | translate }} - - info_outlined - - -
- - gateway.statistics.command - - - {{ 'gateway.statistics.command-required' | translate }} - - - {{ 'gateway.statistics.command-pattern' | translate }} - - info_outlined - - -
- -
- -
-
-
-
- -
-
-
- - {{ 'gateway.checking-device-activity' | translate }} - -
-
- - gateway.inactivity-timeout-seconds - - - {{ 'gateway.inactivity-timeout-seconds-required' | translate }} - - - {{ 'gateway.inactivity-timeout-seconds-min' | translate }} - - - {{ 'gateway.inactivity-timeout-seconds-pattern' | translate }} - - info_outlined - - - - gateway.inactivity-check-period-seconds - + + gateway.statistics.check-connectors-configuration + - {{ 'gateway.inactivity-check-period-seconds-required' | translate }} + *ngIf="gatewayConfigGroup.get('thingsboard.checkConnectorsConfigurationInSeconds').hasError('required')"> + {{ 'gateway.statistics.check-connectors-configuration-required' | translate }} - {{ 'gateway.inactivity-check-period-seconds-min' | translate }} + *ngIf="gatewayConfigGroup.get('thingsboard.checkConnectorsConfigurationInSeconds').hasError('min')"> + {{ 'gateway.statistics.check-connectors-configuration-min' | translate }} - {{ 'gateway.inactivity-check-period-seconds-pattern' | translate }} - - info_outlined - - -
-
-
-
gateway.advanced
-
- - gateway.min-pack-send-delay - - - {{ 'gateway.min-pack-send-delay-required' | translate }} - - - {{ 'gateway.min-pack-send-delay-min' | translate }} + *ngIf="gatewayConfigGroup.get('thingsboard.checkConnectorsConfigurationInSeconds').hasError('pattern')"> + {{ 'gateway.statistics.check-connectors-configuration-pattern' | translate }} - info_outlined - - - gateway.mqtt-qos - - - {{ 'gateway.mqtt-qos-required' | translate }} - - - {{ 'gateway.mqtt-qos-range' | translate }} - - - {{ 'gateway.mqtt-qos-range' | translate }} - - info_outlined - - -
- - gateway.statistics.check-connectors-configuration - - - {{ 'gateway.statistics.check-connectors-configuration-required' | translate }} - - - {{ 'gateway.statistics.check-connectors-configuration-min' | translate }} - - - {{ 'gateway.statistics.check-connectors-configuration-pattern' | translate }} - - +
-
+
From 99104167901d28b738e5d323b1ca3e6eca8f2853 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Jun 2024 13:11:54 +0300 Subject: [PATCH 34/45] Added Gateway Dashboard Connector optimization for multiple connector retoggle --- .../gateway/gateway-connectors.component.html | 2 +- .../gateway/gateway-connectors.component.ts | 83 +++++++++++++------ 2 files changed, 59 insertions(+), 26 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.html index 3a7f5403b9..d1267cae3a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.html @@ -46,7 +46,7 @@ + (click)="$event.stopPropagation(); onEnableConnector(attribute)"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts index 4f1b6b72a9..cd13916357 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-connectors.component.ts @@ -62,7 +62,7 @@ import { } from './gateway-widget.models'; import { MatDialog } from '@angular/material/dialog'; import { AddConnectorDialogComponent } from '@home/components/widget/lib/gateway/dialog/add-connector-dialog.component'; -import { takeUntil } from 'rxjs/operators'; +import { debounceTime, take, takeUntil, tap } from 'rxjs/operators'; import { ErrorStateMatcher } from '@angular/material/core'; import { PageData } from '@shared/models/page/page-data'; @@ -148,6 +148,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie private destroy$ = new Subject(); private subscription: IWidgetSubscription; + private attributeUpdateSubject = new Subject(); constructor(protected store: Store, private fb: FormBuilder, @@ -180,6 +181,8 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie basicConfig: this.fb.group({}) }); this.connectorForm.disable(); + + this.observeAttributeChange(); } get portErrorTooltip(): string { @@ -524,31 +527,12 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie } - enableConnector(attribute: AttributeData): void { - const wasEnabled = this.activeConnectors.includes(attribute.key); - const scopeOld = wasEnabled ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; - const scopeNew = !wasEnabled ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; + onEnableConnector(attribute: AttributeData): void { attribute.value.ts = new Date().getTime(); - const tasks = [this.attributeService.saveEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, [{ - key: 'active_connectors', - value: this.activeConnectors - }]), this.attributeService.saveEntityAttributes(this.device, AttributeScope.SERVER_SCOPE, [{ - key: 'inactive_connectors', - value: this.inactiveConnectors - }]), this.attributeService.deleteEntityAttributes(this.device, scopeOld, [attribute]), - this.attributeService.saveEntityAttributes(this.device, scopeNew, [attribute])]; - if (wasEnabled) { - const index = this.activeConnectors.indexOf(attribute.key); - this.activeConnectors.splice(index, 1); - this.inactiveConnectors.push(attribute.key); - } else { - const index = this.inactiveConnectors.indexOf(attribute.key); - this.inactiveConnectors.splice(index, 1); - this.activeConnectors.push(attribute.key); - } - forkJoin(tasks).subscribe(_ => { - this.updateData(true); - }); + + this.updateActiveConnectorKeys(attribute.key); + + this.attributeUpdateSubject.next(attribute); } getErrorsCount(attribute: AttributeData): string { @@ -599,6 +583,55 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie this.connectorForm.get(formControlName)?.patchValue('tb_gw_' + generateSecret(5)); } + private observeAttributeChange(): void { + this.attributeUpdateSubject.pipe( + debounceTime(300), + tap((attribute: AttributeData) => this.executeAttributeUpdates(attribute)), + takeUntil(this.destroy$), + ).subscribe(); + } + + private updateActiveConnectorKeys(key: string): void { + const wasEnabled = this.activeConnectors.includes(key); + if (wasEnabled) { + const index = this.activeConnectors.indexOf(key); + if (index !== -1) this.activeConnectors.splice(index, 1); + this.inactiveConnectors.push(key); + } else { + const index = this.inactiveConnectors.indexOf(key); + if (index !== -1) this.inactiveConnectors.splice(index, 1); + this.activeConnectors.push(key); + } + } + + private executeAttributeUpdates(attribute: AttributeData): void { + forkJoin(this.getAttributeExecutionTasks(attribute)) + .pipe( + take(1), + tap(() => this.updateData(true)), + takeUntil(this.destroy$), + ) + .subscribe(); + } + + private getAttributeExecutionTasks(attribute: AttributeData): Observable[] { + const isActive = this.activeConnectors.includes(attribute.key); + const scopeOld = isActive ? AttributeScope.SERVER_SCOPE : AttributeScope.SHARED_SCOPE; + const scopeNew = isActive ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; + + return [ + this.attributeService.saveEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, [{ + key: 'active_connectors', + value: this.activeConnectors + }]), + this.attributeService.saveEntityAttributes(this.device, AttributeScope.SERVER_SCOPE, [{ + key: 'inactive_connectors', + value: this.inactiveConnectors + }]), + this.attributeService.deleteEntityAttributes(this.device, scopeOld, [attribute]), + this.attributeService.saveEntityAttributes(this.device, scopeNew, [attribute])]; + } + private onDataUpdateError(e: any): void { const exceptionData = this.utils.parseException(e); let errorText = exceptionData.name; From 580f3b5b3c86c20508bd3c8332331627c12e8f53 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Jun 2024 17:20:15 +0300 Subject: [PATCH 35/45] Changed Security block for REST Connector --- .../rest-connector-security.component.html | 65 +++++++++ .../rest-connector-security.component.scss | 29 ++++ .../rest-connector-security.component.ts | 132 ++++++++++++++++++ ...teway-service-rpc-connector.component.html | 33 +---- ...gateway-service-rpc-connector.component.ts | 28 +--- .../lib/gateway/gateway-widget.models.ts | 12 ++ .../widget/widget-components.module.ts | 16 ++- 7 files changed, 249 insertions(+), 66 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.scss create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.html new file mode 100644 index 0000000000..afabe53499 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.html @@ -0,0 +1,65 @@ + +
+
+
gateway.security
+ + + {{ SecurityTypeTranslationsMap.get(type) | translate }} + + +
+ +
+
gateway.username
+
+ + + + warning + + +
+
+
+
gateway.password
+
+ + + + warning + +
+ +
+
+
+
+
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.scss new file mode 100644 index 0000000000..f014f56588 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.scss @@ -0,0 +1,29 @@ +/** + * Copyright © 2016-2024 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +:host { + width: 100%; + height: 100%; + display: block; + margin-bottom: 10px; + + .fields-label { + font-weight: 500; + } + + .hide-toggle { + display: none; + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts new file mode 100644 index 0000000000..65b3620ac7 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts @@ -0,0 +1,132 @@ +/// +/// Copyright © 2016-2024 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { + ChangeDetectionStrategy, + Component, + forwardRef, + OnDestroy, +} from '@angular/core'; +import { Subject } from 'rxjs'; +import { + ControlValueAccessor, + FormBuilder, + NG_VALIDATORS, + NG_VALUE_ACCESSOR, + UntypedFormGroup, + ValidationErrors, + Validator, + Validators +} from '@angular/forms'; +import { takeUntil } from 'rxjs/operators'; +import { + noLeadTrailSpacesRegex, + RestSecurityType, + RestSecurityTypeTranslationsMap +} from '@home/components/widget/lib/gateway/gateway-widget.models'; +import { SharedModule } from '@shared/shared.module'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'tb-rest-connector-security', + templateUrl: './rest-connector-security.component.html', + styleUrls: ['./rest-connector-security.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => RestConnectorSecurityComponent), + multi: true + }, + { + provide: NG_VALIDATORS, + useExisting: forwardRef(() => RestConnectorSecurityComponent), + multi: true + } + ], + standalone: true, + imports: [ + SharedModule, + CommonModule, + ] +}) +export class RestConnectorSecurityComponent implements ControlValueAccessor, Validator, OnDestroy { + BrokerSecurityType = RestSecurityType; + securityTypes: RestSecurityType[] = Object.values(RestSecurityType); + SecurityTypeTranslationsMap = RestSecurityTypeTranslationsMap; + securityFormGroup: UntypedFormGroup; + + private destroy$ = new Subject(); + private propagateChange = (_: any) => {}; + + constructor(private fb: FormBuilder) { + this.securityFormGroup = this.fb.group({ + type: [RestSecurityType.ANONYMOUS, []], + username: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], + password: ['', [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], + }); + this.observeSecurityForm(); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } + + registerOnChange(fn: any): void { + this.propagateChange = fn; + } + + registerOnTouched(fn: any): void {} + + writeValue(deviceInfo: any): void { + if (!deviceInfo.type) { + deviceInfo.type = RestSecurityType.ANONYMOUS; + } + this.securityFormGroup.reset(deviceInfo); + this.updateView(deviceInfo); + } + + validate(): ValidationErrors | null { + return this.securityFormGroup.valid ? null : { + securityForm: { valid: false } + }; + } + + updateView(value: any): void { + this.propagateChange(value); + } + + private updateValidators(type: RestSecurityType): void { + if (type === RestSecurityType.BASIC) { + this.securityFormGroup.get('username').enable({emitEvent: false}); + this.securityFormGroup.get('password').enable({emitEvent: false}); + } else { + this.securityFormGroup.get('username').disable({emitEvent: false}); + this.securityFormGroup.get('password').disable({emitEvent: false}); + } + } + + private observeSecurityForm(): void { + this.securityFormGroup.valueChanges + .pipe(takeUntil(this.destroy$)) + .subscribe(value => this.updateView(value)); + + this.securityFormGroup.get('type').valueChanges + .pipe(takeUntil(this.destroy$)) + .subscribe(type => this.updateValidators(type)); + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html index 2d992187f6..b3d38d6655 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.html @@ -368,38 +368,7 @@ {{ 'gateway.rpc.add-header' | translate }} -
- {{ 'gateway.rpc.security' | translate }} -
-
- {{ 'gateway.rpc.security-name' | translate }} - {{ 'gateway.rpc.value' | translate }} - -
- -
- - - - - - - - delete - - -
-
- -
+ diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index 9838fd2df2..96380d3108 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -114,17 +114,12 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue this.commandForm = this.connectorParamsFormGroupByType(this.connectorType); this.commandForm.valueChanges.subscribe(value => { const httpHeaders = {}; - const security = {}; switch (this.connectorType) { case ConnectorType.REST: value.httpHeaders.forEach(data => { httpHeaders[data.headerName] = data.value; }) value.httpHeaders = httpHeaders; - value.security.forEach(data => { - security[data.securityName] = data.value; - }) - value.security = security; break; case ConnectorType.REQUEST: value.httpHeaders.forEach(data => { @@ -252,7 +247,7 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue tries: [null, [Validators.required, Validators.min(1), Validators.pattern(this.numbersOnlyPattern)]], valueExpression: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], httpHeaders: this.fb.array([]), - security: this.fb.array([]) + security: [{}, [Validators.required]] }) break; case ConnectorType.REQUEST: @@ -312,22 +307,6 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue oidsFA.removeAt(index); } - addHTTPSecurity(value: { securityName: string, value: string } = {securityName: null, value: null}) { - const securityFA = this.commandForm.get('security') as FormArray; - const formGroup = this.fb.group({ - securityName: [value.securityName, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], - value: [value.value, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]] - }) - if (securityFA) { - securityFA.push(formGroup, {emitEvent: false}); - } - } - - removeHTTPSecurity(index: number) { - const oidsFA = this.commandForm.get('security') as FormArray; - oidsFA.removeAt(index); - } - getFormArrayControls(path: string) { return (this.commandForm.get(path) as FormArray).controls as FormControl[]; } @@ -402,11 +381,6 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue break; case ConnectorType.REST: this.clearFromArrayByName("httpHeaders"); - this.clearFromArrayByName("security"); - value.security && Object.entries(value.security).forEach(securityHeader => { - this.addHTTPSecurity({securityName: securityHeader[0], value: securityHeader[1] as string}) - }) - delete value.security; value.httpHeaders && Object.entries(value.httpHeaders).forEach(httpHeader => { this.addHTTPHeader({headerName: httpHeader[0], value: httpHeader[1] as string}) }) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts index 0e143cff36..2bf55275c2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts @@ -360,6 +360,18 @@ export const BrokerSecurityTypeTranslationsMap = new Map( + [ + [RestSecurityType.ANONYMOUS, 'gateway.broker.security-types.anonymous'], + [RestSecurityType.BASIC, 'gateway.broker.security-types.basic'], + ] +); + export const MqttVersions = [ { name: 3.1, value: 3 }, { name: 3.11, value: 4 }, diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts index d345f5954f..6d2cfb6fe3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-components.module.ts @@ -100,6 +100,7 @@ import { BarChartWidgetComponent } from '@home/components/widget/lib/chart/bar-c import { PolarAreaWidgetComponent } from '@home/components/widget/lib/chart/polar-area-widget.component'; import { RadarChartWidgetComponent } from '@home/components/widget/lib/chart/radar-chart-widget.component'; import { MobileAppQrcodeWidgetComponent } from '@home/components/widget/lib/mobile-app-qrcode-widget.component'; +import { RestConnectorSecurityComponent } from '@home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component'; @NgModule({ declarations: @@ -168,13 +169,14 @@ import { MobileAppQrcodeWidgetComponent } from '@home/components/widget/lib/mobi PolarAreaWidgetComponent, RadarChartWidgetComponent ], - imports: [ - CommonModule, - SharedModule, - RpcWidgetsModule, - HomePageWidgetsModule, - SharedHomeComponentsModule - ], + imports: [ + CommonModule, + SharedModule, + RpcWidgetsModule, + HomePageWidgetsModule, + SharedHomeComponentsModule, + RestConnectorSecurityComponent + ], exports: [ EntitiesTableWidgetComponent, AlarmsTableWidgetComponent, From e8fb1375ac19586dd2c440c784c30efbfe8c207d Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Jun 2024 17:44:31 +0300 Subject: [PATCH 36/45] refactoring --- .../rest-connector-security.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts index 65b3620ac7..d00813bfd6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/rest-connector-secuirity/rest-connector-security.component.ts @@ -106,7 +106,7 @@ export class RestConnectorSecurityComponent implements ControlValueAccessor, Val }; } - updateView(value: any): void { + private updateView(value: any): void { this.propagateChange(value); } From 59cf88a656e344bb8a2e29304cf9d6f0faa8f876 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 20 Jun 2024 12:08:35 +0300 Subject: [PATCH 37/45] Gateway - General Config - Security: added static height for username field --- .../gateway-configuration.component.html | 100 +++++++++--------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html index 8aeaeef2ed..8c6224e116 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html @@ -93,64 +93,66 @@ matTooltip="{{ 'gateway.hints.token' | translate }}">info_outlined -
- - security.clientId - - - {{ 'security.clientId-required' | translate }} - - - - info_outlined - - - - security.username - - - {{ 'security.username-required' | translate }} - +
+
+ + security.clientId + + + {{ 'security.clientId-required' | translate }} + + + + info_outlined + + + + security.username + + + {{ 'security.username-required' | translate }} + + + + info_outlined + + +
+ + gateway.password + info_outlined + matTooltip="{{ 'gateway.hints.password' | translate }}">info_outlined -
- - gateway.password - - - - info_outlined - - + - -
{{ 'gateway.rpc.method' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts index 9838fd2df2..02e8532364 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc-connector.component.ts @@ -269,7 +269,6 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue }) break; case ConnectorType.OPCUA: - case ConnectorType.OPCUA_ASYNCIO: formGroup = this.fb.group({ method: [null, [Validators.required, Validators.pattern(noLeadTrailSpacesRegex)]], arguments: this.fb.array([]), @@ -413,7 +412,6 @@ export class GatewayServiceRPCConnectorComponent implements OnInit, ControlValue delete value.httpHeaders; break; case ConnectorType.OPCUA: - case ConnectorType.OPCUA_ASYNCIO: this.clearFromArrayByName("arguments"); value.arguments.forEach(value => { this.addOCPUAArguments(value) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc.component.ts index b5cde980f9..dadd1a38d2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-service-rpc.component.ts @@ -150,7 +150,6 @@ export class GatewayServiceRPCComponent implements OnInit { case ConnectorType.BACNET: case ConnectorType.CAN: case ConnectorType.OPCUA: - case ConnectorType.OPCUA_ASYNCIO: return params.method; case ConnectorType.BLE: case ConnectorType.OCPP: diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts index 0e143cff36..0e56433987 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-widget.models.ts @@ -125,7 +125,6 @@ export enum ConnectorType { MODBUS = 'modbus', GRPC = 'grpc', OPCUA = 'opcua', - OPCUA_ASYNCIO = 'opcua_asyncio', BLE = 'ble', REQUEST = 'request', CAN = 'can', @@ -145,7 +144,6 @@ export const GatewayConnectorDefaultTypesTranslatesMap = new Map Date: Thu, 20 Jun 2024 17:33:49 +0300 Subject: [PATCH 39/45] adjustments --- application/src/main/data/json/tenant/dashboards/gateways.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index 42c4f199b5..d9aafe7ea4 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -2134,7 +2134,7 @@ "padding": "0px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n", + "markdownTextPattern": "
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n", "applyDefaultMarkdownStyle": false, "markdownCss": ".mat-mdc-form-field-subscript-wrapper {\n display: none !important;\n}" }, From a6d9f40e6099a4e543ae6428d187e514da464f08 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 20 Jun 2024 17:40:49 +0300 Subject: [PATCH 40/45] adjustments --- application/src/main/data/json/tenant/dashboards/gateways.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index d9aafe7ea4..a367080484 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -2134,7 +2134,7 @@ "padding": "0px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n", + "markdownTextPattern": "
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n", "applyDefaultMarkdownStyle": false, "markdownCss": ".mat-mdc-form-field-subscript-wrapper {\n display: none !important;\n}" }, From 1132448d9f2cac3abe558d0584ed3be2e004d7f8 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 20 Jun 2024 17:42:59 +0300 Subject: [PATCH 41/45] adjustments --- .../data/json/tenant/dashboards/gateways.json | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index a367080484..9b02a19905 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -5632,33 +5632,6 @@ } } }, - "gateway_devices_5": { - "name": "gateway_devices_opcua_async", - "root": false, - "layouts": { - "main": { - "widgets": { - "e3a9539d-2ccb-96e0-2afa-36f93e40233d": { - "sizeX": 24, - "sizeY": 11, - "row": 0, - "col": 0 - } - }, - "gridSettings": { - "backgroundColor": "#eeeeee", - "columns": 24, - "margin": 0, - "outerMargin": true, - "backgroundSizeMode": "100%", - "autoFillHeight": false, - "backgroundImageUrl": null, - "mobileAutoFillHeight": false, - "mobileRowHeight": 70 - } - } - } - }, "gateway_devices_6": { "name": "gateway_devices_ble", "root": false, From 81d34670e8b4d684ca18ac4046b58a152c4eb1f0 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 20 Jun 2024 17:57:03 +0300 Subject: [PATCH 42/45] adjustments --- .../data/json/tenant/dashboards/gateways.json | 166 ------------------ 1 file changed, 166 deletions(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index 9b02a19905..d4613eaa62 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -2996,172 +2996,6 @@ "id": "bb27723a-989c-2327-5808-b56d490b93ab", "typeFullFqn": "system.cards.entities_table" }, - "e3a9539d-2ccb-96e0-2afa-36f93e40233d": { - "type": "latest", - "sizeX": 7.5, - "sizeY": 6.5, - "config": { - "timewindow": { - "displayValue": "", - "selectedTab": 0, - "realtime": { - "realtimeType": 1, - "interval": 1000, - "timewindowMs": 86400000, - "quickInterval": "CURRENT_DAY" - }, - "history": { - "historyType": 0, - "interval": 1000, - "timewindowMs": 60000, - "fixedTimewindow": { - "startTimeMs": 1684327643501, - "endTimeMs": 1684414043501 - }, - "quickInterval": "CURRENT_DAY" - }, - "aggregation": { - "type": "NONE", - "limit": 200 - } - }, - "showTitle": true, - "backgroundColor": "rgb(255, 255, 255)", - "color": "rgba(0, 0, 0, 0.87)", - "padding": "4px", - "settings": { - "entitiesTitle": "Devices", - "enableSearch": true, - "enableSelectColumnDisplay": true, - "enableStickyHeader": true, - "enableStickyAction": true, - "reserveSpaceForHiddenAction": "true", - "displayEntityName": true, - "entityNameColumnTitle": "Device Name", - "displayEntityLabel": false, - "displayEntityType": false, - "displayPagination": true, - "defaultPageSize": 10, - "defaultSortOrder": "entityName", - "useRowStyleFunction": false - }, - "title": "Devices", - "dropShadow": true, - "enableFullscreen": true, - "titleStyle": { - "fontSize": "16px", - "fontWeight": 400, - "padding": "5px 10px 5px 10px" - }, - "useDashboardTimewindow": false, - "showLegend": false, - "datasources": [ - { - "type": "entity", - "name": null, - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "3931abd5-2205-9386-6ea9-8e8a8131bb9d", - "dataKeys": [ - { - "name": "type", - "type": "entityField", - "label": "Device Type", - "color": "#2196f3", - "settings": {}, - "_hash": 0.3129929097366162, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - }, - { - "name": "active", - "type": "attribute", - "label": "Status", - "color": "#4caf50", - "settings": { - "columnWidth": "0px", - "useCellStyleFunction": false, - "useCellContentFunction": true, - "cellContentFunction": "let cssClass;\r\nswitch (value) {\r\n case \"Active\":\r\n cssClass = \"status status-active\";\r\n break;\r\n case \"Inactive\":\r\n default:\r\n cssClass = \"status status-inactive\";\r\n break;\r\n }\r\n \r\n return `${value}`;", - "defaultColumnVisibility": "visible", - "columnSelectionToDisplay": "enabled" - }, - "_hash": 0.5969880627410065, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": true, - "postFuncBody": "return value == 'true' ? \"Active\": \"Inactive\";" - }, - { - "name": "connectorName", - "type": "attribute", - "label": "Connector Name", - "color": "#f44336", - "settings": {}, - "_hash": 0.012483045440007778, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - }, - { - "name": "connectorType", - "type": "attribute", - "label": "Connector Type", - "color": "#ffc107", - "settings": {}, - "_hash": 0.6004192233378134, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - } - ], - "displayTimewindow": true, - "showTitleIcon": false, - "titleTooltip": "", - "widgetStyle": {}, - "widgetCss": ".status {\r\n border-radius: 20px;\r\n font-weight: 500;\r\n padding: 5px 15px;\r\n }\r\n\r\n .status-active {\r\n color: green;\r\n background: rgba(0, 128, 0, 0.1);\r\n }\r\n\r\n .status-inactive {\r\n color: red;\r\n background: rgba(255, 0, 0, 0.1);\r\n }\r\n", - "pageSize": 1024, - "noDataDisplayMessage": "", - "enableDataExport": false, - "actions": { - "actionCellButton": [ - { - "name": "Show Device Info", - "icon": "info", - "useShowWidgetActionFunction": null, - "showWidgetActionFunction": "return true;", - "type": "custom", - "customFunction": "const url = `${window.location.origin + widgetContext.utils.getEntityDetailsPageURL(entityId.id, entityId.entityType)}`;\nwindow.open(url, '_blank');", - "openInSeparateDialog": false, - "openInPopover": false, - "id": "94de7690-f91d-b032-6771-85af99abd749" - } - ] - } - }, - "row": 0, - "col": 0, - "id": "e3a9539d-2ccb-96e0-2afa-36f93e40233d", - "typeFullFqn": "system.cards.entities_table" - }, "cf2eba6b-44f6-9cc2-6089-35c735f54898": { "type": "latest", "sizeX": 7.5, From 205e930d88d059062651313bc00a879b0cb4e8bf Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 21 Jun 2024 15:08:09 +0300 Subject: [PATCH 43/45] Added Connector Name to Gateway Connector Logs --- application/src/main/data/json/tenant/dashboards/gateways.json | 2 +- ui-ngx/src/app/core/utils.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index 42c4f199b5..8f426b1624 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -880,7 +880,7 @@ "isConnectorLog": true, "connectorLogState": "connector_logs" }, - "title": "Gateway Logs", + "title": "${entityNameLogs}", "showTitleIcon": false, "dropShadow": true, "enableFullscreen": true, diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index dc9ed5004b..a15e9462f3 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -415,6 +415,8 @@ export const createLabelFromDatasource = (datasource: Datasource, pattern: strin label = label.replace(variable, datasource.name); } else if (variableName === 'entityName') { label = label.replace(variable, datasource.entityName); + } else if (variableName === 'entityNameLogs') { + label = label.replace(variable, datasource.entityName + ' Logs'); } else if (variableName === 'deviceName') { label = label.replace(variable, datasource.entityName); } else if (variableName === 'entityLabel') { From 03b64319318053fd0b38bba419307fd93cba3ea5 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 21 Jun 2024 16:36:40 +0300 Subject: [PATCH 44/45] refactoring --- .../src/main/data/json/tenant/dashboards/gateways.json | 2 +- ui-ngx/src/app/core/utils.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/application/src/main/data/json/tenant/dashboards/gateways.json b/application/src/main/data/json/tenant/dashboards/gateways.json index ec6388abc3..11813ae878 100644 --- a/application/src/main/data/json/tenant/dashboards/gateways.json +++ b/application/src/main/data/json/tenant/dashboards/gateways.json @@ -880,7 +880,7 @@ "isConnectorLog": true, "connectorLogState": "connector_logs" }, - "title": "${entityNameLogs}", + "title": "${entityName} Logs", "showTitleIcon": false, "dropShadow": true, "enableFullscreen": true, diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index a15e9462f3..3bdb49e070 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -415,9 +415,7 @@ export const createLabelFromDatasource = (datasource: Datasource, pattern: strin label = label.replace(variable, datasource.name); } else if (variableName === 'entityName') { label = label.replace(variable, datasource.entityName); - } else if (variableName === 'entityNameLogs') { - label = label.replace(variable, datasource.entityName + ' Logs'); - } else if (variableName === 'deviceName') { + } else if (variableName === 'deviceName') { label = label.replace(variable, datasource.entityName); } else if (variableName === 'entityLabel') { label = label.replace(variable, datasource.entityLabel || datasource.entityName); From 4c322ad62b0187e127d7f05475bf7915488b7c18 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 21 Jun 2024 16:37:37 +0300 Subject: [PATCH 45/45] refactoring --- ui-ngx/src/app/core/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index 3bdb49e070..dc9ed5004b 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -415,7 +415,7 @@ export const createLabelFromDatasource = (datasource: Datasource, pattern: strin label = label.replace(variable, datasource.name); } else if (variableName === 'entityName') { label = label.replace(variable, datasource.entityName); - } else if (variableName === 'deviceName') { + } else if (variableName === 'deviceName') { label = label.replace(variable, datasource.entityName); } else if (variableName === 'entityLabel') { label = label.replace(variable, datasource.entityLabel || datasource.entityName);