From 530e603fb5868a7536925fe8b072fba06b8798e2 Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 23 Mar 2017 12:22:27 +0530 Subject: [PATCH] enable role filtering and role count in device cloud --- .../app/pages/cdmf.page.roles/roles.hbs | 95 +++++++++++-------- .../app/pages/cdmf.page.roles/roles.js | 10 ++ 2 files changed, 68 insertions(+), 37 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs index 47e8181218..5476c743dd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs @@ -50,45 +50,66 @@ {{/zone}} {{#zone "content"}} -
- {{#unless isCloud}} - {{#if removePermitted}} - + {{#if hasRoles}} +
+ {{#unless isCloud}} + {{#if removePermitted}} + + {{/if}} + {{#if editPermitted}} + + {{/if}} + {{/unless}} + {{#if isCloud}} + {{/if}} - {{#if editPermitted}} - - {{/if}} - {{/unless}} - {{#if isCloud}} - - {{/if}} - - Loading roles . . . -
-
- -
- - - - - - - - - - -
By Role Name
-
- - + +
+ + + + + + + + + + +
By Role Name
+
+ + + + {{else}} + +
+
+

You Haven't created roles yet.

+
Please click "Add A New Role", if you wish to add a role. +
+ + + + + + + Add Role + +
+
+ + {{/if}} {{/zone}} {{#zone "bottomJs"}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js index 10121aa72d..145d39ee4e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js @@ -33,6 +33,16 @@ function onRequest(context) { context["adminRole"] = deviceMgtProps["adminRole"]; context["isCloud"] = deviceMgtProps["isCloud"]; + var roleCount = userModule.getRolesCount() + if (deviceMgtProps["isCloud"]) { + roleCount = userModule.getFilteredRoles("devicemgt").content.count; + } + + if (roleCount > 0) { + context["hasRoles"] = true; + } else { + context["hasRoles"] = false; + } return context; } \ No newline at end of file