From 2c3905b4950ce380bcaa539349c371403e9b57c5 Mon Sep 17 00:00:00 2001 From: Maksym Dudnik Date: Wed, 26 Jul 2023 20:09:43 +0300 Subject: [PATCH] hot fixes --- .../widget/lib/gateway/gateway-connectors.component.html | 2 +- .../widget/lib/gateway/gateway-connectors.component.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 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 e3589f7ac1..52e0b4f661 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 @@ -137,7 +137,7 @@ {{ 'gateway.connectors-table-name' | translate }} - + {{ 'gateway.connectors-table-type' | translate }} 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 dbc1f5271a..65cf929705 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 @@ -99,7 +99,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie @Input() device: EntityId; - @ViewChild('searchInput') searchInputField: ElementRef; + @ViewChild('nameInput') nameInput: ElementRef; @ViewChild(MatSort) sort: MatSort; connectorForm: FormGroup; @@ -217,7 +217,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie value }]; const attributesToDelete = []; - const scope = (!this.initialConnector || this.activeConnectors.includes(this.initialConnector.name)) ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; + const scope = (this.initialConnector && this.activeConnectors.includes(this.initialConnector.name)) ? AttributeScope.SHARED_SCOPE : AttributeScope.SERVER_SCOPE; let updateActiveConnectors = false; if (this.initialConnector && this.initialConnector.name !== value.name) { attributesToDelete.push({key: this.initialConnector.name}); @@ -251,6 +251,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie tasks.push(this.attributeService.deleteEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, attributesToDelete)); } forkJoin(tasks).subscribe(_ => { + this.initialConnector = value; this.showToast('Update Successful'); this.updateData(true); }); @@ -306,7 +307,9 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie if (this.connectorForm.disabled) { this.connectorForm.enable(); } + this.nameInput.nativeElement.focus(); this.clearOutConnectorForm(); + } clearOutConnectorForm(): void { @@ -381,7 +384,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie this.activeConnectors.splice(activeIndex, 1); } if (inactiveIndex !== -1) { - this.inactiveConnectors.splice(activeIndex, 1); + this.inactiveConnectors.splice(inactiveIndex, 1); } tasks.push(this.attributeService.saveEntityAttributes(this.device, scope, [{ key: scope == AttributeScope.SHARED_SCOPE ? 'active_connectors' : 'inactive_connectors',