Fixing device types not shown issue

revert-70aa11f8
Rasika Perera 8 years ago
parent 9148c3baea
commit 0fb87f3aa2

@ -27,12 +27,12 @@ function onRequest(context) {
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var typesListResponse = deviceModule.getDeviceTypes(); var typesListResponse = deviceModule.getDeviceTypes();
if (typesListResponse["status"] == "success") { if (typesListResponse["status"] == "success") {
var deviceTypes = typesListResponse["content"]; var deviceTypes = typesListResponse.content.deviceTypes;
if (deviceTypes) { if (deviceTypes) {
var deviceTypesList = [], virtualDeviceTypesList = []; var deviceTypesList = [], virtualDeviceTypesList = [];
for (var i = 0; i < deviceTypes.length; i++) { for (var i = 0; i < deviceTypes.length; i++) {
var deviceType = deviceTypes[i];
var deviceTypeLabel = deviceTypes[i].name; var deviceTypeLabel = deviceType;
var configs = utility.getDeviceTypeConfig(deviceTypeLabel); var configs = utility.getDeviceTypeConfig(deviceTypeLabel);
var deviceCategory = "device"; var deviceCategory = "device";
if (configs) { if (configs) {
@ -45,22 +45,20 @@ function onRequest(context) {
} }
if (deviceCategory == 'virtual') { if (deviceCategory == 'virtual') {
virtualDeviceTypesList.push({ virtualDeviceTypesList.push({
"hasCustTemplate": false, "hasCustTemplate": false,
"deviceTypeLabel": deviceTypeLabel, "deviceTypeLabel": deviceTypeLabel,
"deviceTypeName": deviceTypes[i].name, "deviceTypeName": deviceType,
"deviceCategory": deviceCategory, "deviceCategory": deviceCategory,
"deviceTypeId": deviceTypes[i].id, "thumb": utility.getDeviceThumb(deviceType)
"thumb": utility.getDeviceThumb(deviceTypes[i].name) });
});
} else { } else {
deviceTypesList.push({ deviceTypesList.push({
"hasCustTemplate": false, "hasCustTemplate": false,
"deviceTypeLabel": deviceTypeLabel, "deviceTypeLabel": deviceTypeLabel,
"deviceTypeName": deviceTypes[i].name, "deviceTypeName": deviceType,
"deviceCategory": deviceCategory, "deviceCategory": deviceCategory,
"deviceTypeId": deviceTypes[i].id, "thumb": utility.getDeviceThumb(deviceType)
"thumb": utility.getDeviceThumb(deviceTypes[i].name) });
});
} }
} }
if (virtualDeviceTypesList.length > 0) { if (virtualDeviceTypesList.length > 0) {

Loading…
Cancel
Save