Browse Source

fixes

pull/8337/head
Maksym Dudnik 3 years ago
parent
commit
a6d7b46b38
  1. 2
      ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts
  2. 7
      ui-ngx/src/app/shared/components/device/gateway-service-rpc.component.ts

2
ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts

@ -358,7 +358,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
$event.stopPropagation(); $event.stopPropagation();
} }
const params = deepClone(this.ctx.stateController.getStateParams()); const params = deepClone(this.ctx.stateController.getStateParams());
params.connector_logs = attribute; params.connector_rpc = attribute;
params.targetEntityParamName = "connector_rpc"; params.targetEntityParamName = "connector_rpc";
this.ctx.stateController.openState("connector_rpc", params); this.ctx.stateController.openState("connector_rpc", params);
} }

7
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; isConnector: boolean;
connectorType: string;
RPCCommands: Array<string> = [ RPCCommands: Array<string> = [
"Ping", "Ping",
"Stats", "Stats",
@ -87,13 +89,16 @@ export class GatewayServiceRPCComponent extends PageComponent implements AfterVi
this.isConnector = this.ctx.settings.isConnector; this.isConnector = this.ctx.settings.isConnector;
if (!this.isConnector) { if (!this.isConnector) {
this.commandForm.get('command').setValue(this.RPCCommands[0]); this.commandForm.get('command').setValue(this.RPCCommands[0]);
} else {
this.connectorType = this.ctx.stateController.getStateParams().connector_rpc.value.type;
} }
} }
sendCommand() { sendCommand() {
const formValues = this.commandForm.value; 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)); this.commandForm.get('result').setValue(JSON.stringify(resp));
},error => { },error => {
console.log(error); console.log(error);

Loading…
Cancel
Save