From 29086834ebf7226b5b6391e9332acfaeee68f740 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Wed, 30 Aug 2017 19:45:16 +0530 Subject: [PATCH 1/2] Added tooltips for policy listing page. --- .../devicemgt/app/pages/cdmf.page.policies/policies.hbs | 4 +++- .../app/pages/cdmf.page.policies/public/js/policy-list.js | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs index 77ec4d34a6..0e4a7840e8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs @@ -237,10 +237,12 @@ data-search="{{status}}" data-display="{{status}}"> - + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js index 0d94332844..64be08e91b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/public/js/policy-list.js @@ -385,4 +385,7 @@ $(document).ready(function () { $("#policy-listing-status").removeClass("hidden"); } $("#policy-grid").removeClass("hidden"); + + $('[data-toggle="tooltip"]').tooltip(); + }); \ No newline at end of file From 8cac8a3bdccdee6dfad8f2f5176e2eca3d991195 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 31 Aug 2017 12:03:58 +0530 Subject: [PATCH 2/2] Added edit buttons for User and policy views. --- .../app/pages/cdmf.page.policy.view/view.hbs | 8 ++++++++ .../app/pages/cdmf.page.policy.view/view.js | 9 ++++++++- .../app/pages/cdmf.page.user.view/view.hbs | 15 +++++++++++++++ .../app/pages/cdmf.page.user.view/view.js | 8 +++++++- .../cdmf.unit.policy.view/public/js/view.js | 18 ++++++++++++++++++ 5 files changed, 56 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs index ad8f81f82a..49c4d14be1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.hbs @@ -37,6 +37,14 @@ {{/zone}} +{{#zone "navbarActions"}} + {{#if canEdit}} +
  • + +
  • + {{/if}} +{{/zone}} + {{#zone "content"}} {{unit "cdmf.unit.device.operation-mod"}} {{unit "cdmf.unit.policy.view"}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js index 07e42077e6..0032639ca3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policy.view/view.js @@ -17,7 +17,14 @@ */ function onRequest(context) { + var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var utility = require("/app/modules/utility.js")["utility"]; var deviceType = request.getParameter("type"); - return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view")}; + + var canEdit = false; + if(userModule.isAuthorized("/permission/admin/device-mgt/policy/manage")) { + canEdit = true; + } + + return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view"), "canEdit": canEdit}; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs index dd86421cc7..aec56d47c9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs @@ -35,6 +35,21 @@ {{/zone}} +{{#zone "navbarActions"}} + {{#if canEdit}} +
  • + + + + + + Edit + +
  • + {{/if}} +{{/zone}} + {{#zone "content"}} {{#if canView}} {{#if exists}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js index 0be5dd28df..997711701c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js @@ -48,7 +48,13 @@ function onRequest(context) { canView = true; } + var canEdit = false; + if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit")) { + canEdit = true; + } + var isCloud = deviceMgtProps.isCloud; - return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canView": canView, "isCloud" : isCloud}; + return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canEdit": canEdit, + "canView": canView, "isCloud" : isCloud}; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js index 73f504e81e..2f035e80c3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js @@ -66,6 +66,7 @@ var displayPolicy = function (policyPayloadObj) { $("#roles-row").addClass("hidden"); } + var policyId = policyPayloadObj["id"]; var deviceType = policy["platform"]; var policyOperations = $("#policy-operations"); var policyViewTemplateSrc = $(policyOperations).data("template"); @@ -110,6 +111,23 @@ var displayPolicy = function (policyPayloadObj) { if (!hasPolicyProfileScript) { populateGenericProfileOperations(policyPayloadObj["profile"]["profileFeaturesList"]); } + + var policyEditContent = + "" + + "" + + "" + + "" + + "" + + " Edit" + + ""; + + $("#policy-edit").html(policyEditContent); + }; /**