fixed to get the server ip when starting the agent

application-manager-new
Menaka Madushanka 9 years ago
parent f1a22397a3
commit 5770ecab2f

@ -18,7 +18,7 @@
<div class="add-margin-top-4x">
<div class="add-margin-top-4x">
<div class="buttons">
<a class="btn-operations" target="_blank" href="https://localhost:9443/connected-cup-agent/index.jsp?deviceOwner={{@user.username}}&deviceId={{../device.deviceIdentifier}}&token={{../device.accessToken}}" >Go To Device</a>
<a class="btn-operations" target="_blank" href="https://{{../device.ip}}:9443/connected-cup-agent/index.jsp?deviceOwner={{@user.username}}&deviceId={{../device.deviceIdentifier}}&token={{../device.accessToken}}" >Go To Device</a>
</div>
</div>
</div>

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

Loading…
Cancel
Save