From 70b1f9374c6c21272a5f14396a419e933d4f412c Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 27 Sep 2016 20:45:13 +0530 Subject: [PATCH] Fixing incorrect device object returned from JS to Hbs templates --- .../analytics-view.js | 2 +- .../device-view.js | 3 +-- .../analytics-view.js | 2 +- .../device-view.js | 2 +- .../device-view.js | 3 +-- .../device-view.js | 2 +- .../analytics-view.js | 2 +- .../device-view.js | 2 +- .../analytics-view.js | 2 +- .../cdmf.unit.device.type.drone.device-view/device-view.js | 2 +- .../analytics-view.js | 2 +- .../cdmf.unit.device.type.firealarm.device-view/device-view.js | 2 +- .../analytics-view.js | 2 +- .../device-view.js | 2 +- .../analytics-view.js | 2 +- .../cdmf.unit.device.type.watertank.device-view/device-view.js | 2 +- 16 files changed, 16 insertions(+), 18 deletions(-) diff --git a/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.analytics-view/analytics-view.js b/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.analytics-view/analytics-view.js index 8c55ef0f..c70c6d0c 100644 --- a/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.analytics-view/analytics-view.js +++ b/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.analytics-view/analytics-view.js @@ -34,7 +34,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != 'error') { return { - 'device': device, + 'device': device.content, 'backendApiUri': devicemgtProps['httpsURL'] + '/connectedcup/stats/' + deviceId, 'dashboardserverURL': devicemgtProps['dashboardserverURL'] }; diff --git a/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js b/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js index d887dc31..b4fa71bc 100644 --- a/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js +++ b/modules/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view/device-view.js @@ -29,7 +29,6 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != 'error') { - log.info(device); var constants = require('/app/modules/constants.js'); var tokenPair = session.get(constants.ACCESS_TOKEN_PAIR_IDENTIFIER); var token = ''; @@ -38,7 +37,7 @@ function onRequest(context) { } device.accessToken = token; device.ip = devicemgtProps['httpsWebURL']; - return {'device': device}; + return {'device': device.content}; } } } diff --git a/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.analytics-view/analytics-view.js b/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.analytics-view/analytics-view.js index adbbd7b7..93257b8d 100644 --- a/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.analytics-view/analytics-view.js +++ b/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.analytics-view/analytics-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { return { - "device": device, + "device": device.content, "backendApiUrl": devicemgtProps["httpsURL"] + "/CONNECTEDLAP/stats/" + deviceId + "/" }; } else { diff --git a/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.device-view/device-view.js b/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.device-view/device-view.js index b0b65887..00e27a0f 100644 --- a/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.device-view/device-view.js +++ b/modules/samples/connectedlap/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.CONNECTEDLAP.device-view/device-view.js @@ -28,7 +28,7 @@ function onRequest(context) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; + return {"device": device.content, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); exit(); diff --git a/modules/samples/currentsensor/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.currentsensor.device-view/device-view.js b/modules/samples/currentsensor/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.currentsensor.device-view/device-view.js index a50f5305..6e95ccbc 100644 --- a/modules/samples/currentsensor/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.currentsensor.device-view/device-view.js +++ b/modules/samples/currentsensor/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.currentsensor.device-view/device-view.js @@ -31,8 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - log.info(device); - return {"device": device, "port" : port, "host" : host , "sessionId" : sessionId}; + return {"device": device.content, "port" : port, "host" : host , "sessionId" : sessionId}; } } } \ No newline at end of file diff --git a/modules/samples/digitaldisplay/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.device-view/device-view.js b/modules/samples/digitaldisplay/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.device-view/device-view.js index 9c203853..ad872af0 100644 --- a/modules/samples/digitaldisplay/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.device-view/device-view.js +++ b/modules/samples/digitaldisplay/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.device-view/device-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - return {"device": device}; + return {"device": device.content}; } else { response.sendError(404, "Device Id " + deviceId + "of type " + deviceType + " cannot be found!"); exit(); diff --git a/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.analytics-view/analytics-view.js b/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.analytics-view/analytics-view.js index 5336bc2c..2a4900e1 100644 --- a/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.analytics-view/analytics-view.js +++ b/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.analytics-view/analytics-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { return { - "device": device, + "device": device.content, "backendApiUri": devicemgtProps["httpsURL"] + "/"+deviceType+"/device/stats/" + deviceId }; } else { diff --git a/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.device-view/device-view.js b/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.device-view/device-view.js index b0b65887..00e27a0f 100644 --- a/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.device-view/device-view.js +++ b/modules/samples/doormanager/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.doormanager.device-view/device-view.js @@ -28,7 +28,7 @@ function onRequest(context) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; + return {"device": device.content, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); exit(); diff --git a/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.analytics-view/analytics-view.js b/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.analytics-view/analytics-view.js index 1961b3df..be217aef 100644 --- a/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.analytics-view/analytics-view.js +++ b/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.analytics-view/analytics-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { return { - "device": device, + "device": device.content, "backendApiUrl": devicemgtProps["httpsURL"] + "/"+deviceType+"/device/stats/" + deviceId }; } else { diff --git a/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.device-view/device-view.js b/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.device-view/device-view.js index b0b65887..00e27a0f 100644 --- a/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.device-view/device-view.js +++ b/modules/samples/droneanalyzer/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.drone.device-view/device-view.js @@ -28,7 +28,7 @@ function onRequest(context) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; + return {"device": device.content, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); exit(); diff --git a/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.analytics-view/analytics-view.js b/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.analytics-view/analytics-view.js index c51b47c0..9d98a3d6 100644 --- a/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.analytics-view/analytics-view.js +++ b/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.analytics-view/analytics-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != 'error') { return { - 'device': device, + 'device': device.content, 'backendApiUrl': devicemgtProps['httpsURL'] + '/firealarm/device/stats/' + deviceId + '/sensors/' }; } else { diff --git a/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.device-view/device-view.js b/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.device-view/device-view.js index 445194ff..70a6f7db 100644 --- a/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.device-view/device-view.js +++ b/modules/samples/firealarm/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.firealarm.device-view/device-view.js @@ -29,7 +29,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != 'error') { return { - 'device': device, + 'device': device.content, 'backendApiUri': devicemgtProps['httpsURL'] + '/' + deviceType + '/', 'autoCompleteParams': autoCompleteParams }; diff --git a/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.analytics-view/analytics-view.js b/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.analytics-view/analytics-view.js index 5336bc2c..2a4900e1 100644 --- a/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.analytics-view/analytics-view.js +++ b/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.analytics-view/analytics-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { return { - "device": device, + "device": device.content, "backendApiUri": devicemgtProps["httpsURL"] + "/"+deviceType+"/device/stats/" + deviceId }; } else { diff --git a/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.device-view/device-view.js b/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.device-view/device-view.js index b0b65887..00e27a0f 100644 --- a/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.device-view/device-view.js +++ b/modules/samples/geolocationTracker/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.geolocationTracker.device-view/device-view.js @@ -28,7 +28,7 @@ function onRequest(context) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; + return {"device": device.content, "backendApiUri" : devicemgtProps["httpsURL"] + "/"+deviceType+"/", "autoCompleteParams" : autoCompleteParams}; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); exit(); diff --git a/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.analytics-view/analytics-view.js b/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.analytics-view/analytics-view.js index b0721f26..f40a0548 100644 --- a/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.analytics-view/analytics-view.js +++ b/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.analytics-view/analytics-view.js @@ -31,7 +31,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != 'error') { return { - 'device': device, + 'device': device.content, 'backendApiUrl': devicemgtProps['httpsURL'] + '/watertank/device/stats/' + deviceId + '/sensors/' }; } else { diff --git a/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.device-view/device-view.js b/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.device-view/device-view.js index 6262ee17..f74b6cbf 100644 --- a/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.device-view/device-view.js +++ b/modules/samples/watertank/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.watertank.device-view/device-view.js @@ -29,7 +29,7 @@ function onRequest(context) { var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != 'error') { return { - 'device': device, + 'device': device.content, 'backendApiUri': devicemgtProps['httpsURL'] + '/' + deviceType + '/', 'autoCompleteParams': autoCompleteParams };