From 173c2ec0d2f0cb8dadaf2fca378d9a26ff9c9230 Mon Sep 17 00:00:00 2001 From: Maksym Dudnik Date: Thu, 27 Jul 2023 13:47:27 +0300 Subject: [PATCH] update --- .../widget/lib/gateway/gateway-connectors.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 65fff6d58d..ba608c172b 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 @@ -39,7 +39,6 @@ import { DialogService } from '@core/services/dialog.service'; import { WidgetContext } from '@home/models/widget-component.models'; import { deepClone } from '@core/utils'; import { NULL_UUID } from '@shared/models/id/has-uuid'; -import { tap } from 'rxjs/operators'; export interface gatewayConnector { @@ -434,6 +433,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie 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; + attribute.value = typeof attribute.value === 'string' ? JSON.parse(attribute.value) : attribute.value; const tasks = [this.attributeService.saveEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, [{ key: 'active_connectors', value: this.activeConnectors @@ -442,6 +442,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie value: this.inactiveConnectors }]), this.attributeService.deleteEntityAttributes(this.device, scopeOld, [attribute]), this.attributeService.saveEntityAttributes(this.device, scopeNew, [attribute])]; + console.log(attribute) if (wasEnabled) { const index = this.activeConnectors.indexOf(attribute.key); this.activeConnectors.splice(index, 1);