Fixing incorrect device object returned from JS to Hbs templates

merge-requests/1/head
Rasika Perera 8 years ago
parent eb3c68d895
commit 70b1f9374c

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

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

@ -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 {

@ -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();

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

@ -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();

@ -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 {

@ -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();

@ -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 {

@ -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();

@ -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 {

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

@ -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 {

@ -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();

@ -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 {

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

Loading…
Cancel
Save