From 0fab418187126dce9e5b21995ff35ec2afa2c1fb Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 13 Sep 2016 19:43:43 +0530 Subject: [PATCH] Fixing invalid device count and group count --- .../devicemgt/app/modules/business-controllers/device.js | 8 ++++---- .../devicemgt/app/pages/cdmf.page.dashboard/dashboard.js | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index b970b04cf9..6c7dbcc174 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -298,20 +298,20 @@ deviceModule = function () { var url; if (uiPermissions.LIST_DEVICES) { url = devicemgtProps["httpsURL"] + - devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices/count"; + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices?offset=0&limit=1"; } else if (uiPermissions.LIST_OWN_DEVICES) { url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + - "/devices/user/" + carbonUser.username + "/count"; + "/devices?offset=0&limit=1&user=" + carbonUser.username; } else { log.error("Access denied for user: " + carbonUser.username); return -1; } return serviceInvokers.XMLHttp.get( url, function (responsePayload) { - return responsePayload; + return parse(responsePayload["responseText"])["count"]; }, function (responsePayload) { - log.error(responsePayload); + log.error(responsePayload["responseText"]); return -1; } ); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js index 06ac10ba3a..7fcd099e18 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js @@ -36,10 +36,12 @@ function onRequest() { page.permissions = permissions; page.enrollmentURL = devicemgtProps.enrollmentURL; page.device_count = deviceModule.getDevicesCount(); - page.group_count = groupModule.getGroupCount(); + //TODO: Enable Group Management Service API on CDMF + //page.group_count = groupModule.getGroupCount(); + page.group_count = -1; page.user_count = userModule.getUsers()["content"].length; page.policy_count = policyModule.getAllPolicies()["content"].length; page.role_count = userModule.getRoles()["content"].length; return page; -} +} \ No newline at end of file