|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
function onRequest(context) {
|
|
|
|
|
var log = new Log("detail.js");
|
|
|
|
|
var log = new Log("device-view.js");
|
|
|
|
|
var deviceType = context.uriParams.deviceType;
|
|
|
|
|
var deviceId = request.getParameter("id");
|
|
|
|
|
|
|
|
|
@ -7,19 +7,8 @@ function onRequest(context) {
|
|
|
|
|
var deviceModule = require("/app/modules/device.js").deviceModule;
|
|
|
|
|
var device = deviceModule.viewDevice(deviceType, deviceId);
|
|
|
|
|
|
|
|
|
|
if (device) {
|
|
|
|
|
var viewModel = {};
|
|
|
|
|
var deviceInfo = device.properties.DEVICE_INFO;
|
|
|
|
|
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) {
|
|
|
|
|
deviceInfo = parse(stringify(deviceInfo));
|
|
|
|
|
viewModel.system = device.properties.IMEI;
|
|
|
|
|
viewModel.machine = "Virtual Firealarm";
|
|
|
|
|
viewModel.vendor = device.properties.VENDOR;
|
|
|
|
|
}
|
|
|
|
|
device.viewModel = viewModel;
|
|
|
|
|
if (device && device.status != "error") {
|
|
|
|
|
return {"device": device};
|
|
|
|
|
}
|
|
|
|
|
context.device = device;
|
|
|
|
|
|
|
|
|
|
return context;
|
|
|
|
|
}
|
|
|
|
|
}
|