This commit is contained in:
Maksym Dudnik 2023-06-02 11:46:33 +03:00
parent ae3bdc1687
commit a6d7b46b38
2 changed files with 7 additions and 2 deletions

View File

@ -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);
}

View File

@ -52,6 +52,8 @@ export class GatewayServiceRPCComponent extends PageComponent implements AfterVi
isConnector: boolean;
connectorType: string;
RPCCommands: Array<string> = [
"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);