Merge pull request #76 from menaka121/master

Connected cup start agent url generation fixed
merge-requests/1/head
Charitha Goonetilleke 9 years ago
commit 8aa804bb92

@ -7,7 +7,7 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.coffeking.agent</artifactId> <artifactId>org.coffeeking.agent</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>1.9.2-SNAPSHOT</version> <version>1.9.2-SNAPSHOT</version>
<name>connected-cup-agent Maven Webapp</name> <name>connected-cup-agent Maven Webapp</name>

@ -40,7 +40,8 @@
<module>plugin</module> <module>plugin</module>
<module>controller</module> <module>controller</module>
<module>manager</module> <module>manager</module>
<module>connected-cup-agent</module> <module>agent</module>
</modules> </modules>
<build> <build>

@ -18,7 +18,7 @@
<div class="add-margin-top-4x"> <div class="add-margin-top-4x">
<div class="add-margin-top-4x"> <div class="add-margin-top-4x">
<div class="buttons"> <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> </div>
</div> </div>

@ -22,6 +22,9 @@ function onRequest(context) {
var deviceType = context.uriParams.deviceType; var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("id"); 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) { if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/device.js").deviceModule;
var device = deviceModule.viewDevice(deviceType, deviceId); var device = deviceModule.viewDevice(deviceType, deviceId);
@ -29,7 +32,8 @@ function onRequest(context) {
if (device && device.status != "error") { if (device && device.status != "error") {
log.info(device); log.info(device);
var deviceProperties = device.properties; var deviceProperties = device.properties;
device.accessToken = deviceProperties.accessToken device.accessToken = deviceProperties.accessToken;
device.ip = serverIp;
return {"device": device}; return {"device": device};
} }
} }

Loading…
Cancel
Save