From 4691bedbc525d5e60609f38474e99a2dfb762a3f Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Thu, 22 Sep 2016 14:35:17 +0530 Subject: [PATCH] Fixes to devices listing --- .../app/pages/cdmf.page.devices/devices.js | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js index d7a19da36b..ae506f4b07 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js @@ -24,22 +24,22 @@ function onRequest(context) { var groupName = request.getParameter("groupName"); var groupOwner = request.getParameter("groupOwner"); - var page = {}; + var viewModel = {}; var title = "Devices"; if (groupName) { title = groupName + " " + title; - page.groupName = groupName; + viewModel.groupName = groupName; } - page.title = title; + viewModel.title = title; var currentUser = session.get(constants.USER_SESSION_KEY); if (currentUser) { - page.permissions = {}; + viewModel.permissions = {}; var uiPermissions = userModule.getUIPermissions(); - page.permissions.list = stringify(uiPermissions); + viewModel.permissions.list = stringify(uiPermissions); if (uiPermissions.ADD_DEVICE) { - page.permissions.enroll = true; + viewModel.permissions.enroll = true; } - page.currentUser = currentUser; + viewModel.currentUser = currentUser; var deviceCount = 0; if (groupName && groupOwner) { var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; @@ -48,30 +48,30 @@ function onRequest(context) { deviceCount = deviceModule.getDevicesCount(); } if (deviceCount > 0) { - page.deviceCount = deviceCount; + viewModel.deviceCount = deviceCount; var utility = require("/app/modules/utility.js").utility; var typesListResponse = deviceModule.getDeviceTypes(); var deviceTypes = []; if (typesListResponse["status"] == "success") { - var data = typesListResponse["content"]; + var data = typesListResponse.content.deviceTypes; if (data) { for (var i = 0; i < data.length; i++) { - var config = utility.getDeviceTypeConfig(data[i].name); + var config = utility.getDeviceTypeConfig(data[i]); if (!config) { continue; } var deviceType = config.deviceType; deviceTypes.push({ - "type": data[i].name, - "category": deviceType.category, - "label": deviceType.label, - "thumb": utility.getDeviceThumb(data[i].name) - }); + "type": data[i], + "category": deviceType.category, + "label": deviceType.label, + "thumb": utility.getDeviceThumb(data[i]) + }); } } } - page.deviceTypes = stringify(deviceTypes); + viewModel.deviceTypes = stringify(deviceTypes); } } - return page; + return viewModel; }