From 5770ecab2fc23687cd316ee288ae3c9e52d252d5 Mon Sep 17 00:00:00 2001 From: Menaka Madushanka Date: Thu, 14 Jan 2016 15:04:56 +0530 Subject: [PATCH] fixed to get the server ip when starting the agent --- .../device-view.hbs | 2 +- .../device-view.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs index ee2213f7..c26c6d41 100644 --- a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs +++ b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.hbs @@ -18,7 +18,7 @@
diff --git a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js index 23d67125..530e0710 100644 --- a/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js +++ b/modules/samples/connectedcup/feature/connectedcup-feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js @@ -22,6 +22,9 @@ function onRequest(context) { var deviceType = context.uriParams.deviceType; var deviceId = request.getParameter("id"); + var property = require("process").getProperty; + var serverIp = property("carbon.local.ip"); + if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); @@ -29,7 +32,8 @@ function onRequest(context) { if (device && device.status != "error") { log.info(device); var deviceProperties = device.properties; - device.accessToken = deviceProperties.accessToken + device.accessToken = deviceProperties.accessToken; + device.ip = serverIp; return {"device": device}; } }