From a6d7b46b38b0c3929d298280530f5f95d82ded86 Mon Sep 17 00:00:00 2001 From: Maksym Dudnik Date: Fri, 2 Jun 2023 11:46:33 +0300 Subject: [PATCH] fixes --- .../components/device/gateway-connectors.component.ts | 2 +- .../components/device/gateway-service-rpc.component.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts b/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts index 20aa4be780..87c9c3c669 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts +++ b/ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts @@ -358,7 +358,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie $event.stopPropagation(); } const params = deepClone(this.ctx.stateController.getStateParams()); - params.connector_logs = attribute; + params.connector_rpc = attribute; params.targetEntityParamName = "connector_rpc"; this.ctx.stateController.openState("connector_rpc", params); } diff --git a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts b/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts index 233304bf54..ab29766fd0 100644 --- a/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts +++ b/ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts @@ -52,6 +52,8 @@ export class GatewayServiceRPCComponent extends PageComponent implements AfterVi isConnector: boolean; + connectorType: string; + RPCCommands: Array = [ "Ping", "Stats", @@ -87,13 +89,16 @@ export class GatewayServiceRPCComponent extends PageComponent implements AfterVi this.isConnector = this.ctx.settings.isConnector; if (!this.isConnector) { this.commandForm.get('command').setValue(this.RPCCommands[0]); + } else { + this.connectorType = this.ctx.stateController.getStateParams().connector_rpc.value.type; } } sendCommand() { const formValues = this.commandForm.value; - this.ctx.controlApi.sendTwoWayCommand('gateway_'+formValues.command.toLowerCase(), {},formValues.time).subscribe(resp=>{ + const commandPrefix = this.isConnector ? `${this.connectorType}_` : 'gateway_'; + this.ctx.controlApi.sendTwoWayCommand(commandPrefix+formValues.command.toLowerCase(), {},formValues.time).subscribe(resp=>{ this.commandForm.get('result').setValue(JSON.stringify(resp)); },error => { console.log(error);