Returning correct representation of the device to template.

merge-requests/1/head
Rasika Perera 8 years ago
parent 52dfcecb62
commit 17dd96aa10

@ -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"] + "/android_sense/stats/" + deviceId + "/sensors/"
};
} else {

@ -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"] + "/android_sense/",
"autoCompleteParams": autoCompleteParams
};

@ -33,7 +33,7 @@ function onRequest(context) {
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") {
return {
"device": device,
"device": device.content,
"backendApiUri": devicemgtProps["httpsURL"] + "/arduino/device/stats/" + deviceId
};
} else {

@ -28,7 +28,7 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") {
return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/arduino/", "autoCompleteParams" : autoCompleteParams};
return {"device": device.content, "backendApiUri" : devicemgtProps["httpsURL"] + "/arduino/", "autoCompleteParams" : autoCompleteParams};
} else {
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");
exit();

@ -33,7 +33,7 @@ function onRequest(context) {
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") {
return {
"device": device,
"device": device.content,
"backendApiUri": devicemgtProps["httpsURL"] + "/raspberrypi/device/stats/" + deviceId
};
} else {

@ -28,7 +28,7 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") {
return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/raspberrypi/", "autoCompleteParams" : autoCompleteParams};
return {"device": device.content, "backendApiUri" : devicemgtProps["httpsURL"] + "/raspberrypi/", "autoCompleteParams" : autoCompleteParams};
} else {
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");
exit();

@ -33,7 +33,7 @@ function onRequest(context) {
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") {
return {
"device": device,
"device": device.content,
"backendApiUri": devicemgtProps["httpsURL"] + "/virtual_firealarm/device/stats/" + deviceId
};
} else {

@ -23,7 +23,7 @@ function onRequest(context) {
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId);
var device = deviceModule.viewDevice(deviceType, deviceId)["content"];
if (device) {
var viewModel = {};

Loading…
Cancel
Save