From 8a586eee2caa8787b4562f750058f4b7caf022b4 Mon Sep 17 00:00:00 2001 From: Amanda Randombage <74random.amanda@gmail.com> Date: Wed, 9 Oct 2019 08:56:32 +0000 Subject: [PATCH] Add UI feature to delete multiple devices permanently --- .../devicemgt/app/conf/config.json | 1 + .../app/modules/business-controllers/user.js | 3 + .../public/templates/device-listing.hbs | 2 +- .../app/pages/cdmf.page.devices/devices.hbs | 88 ++++++++- .../app/pages/cdmf.page.devices/devices.js | 3 + .../cdmf.page.devices/public/js/listing.js | 182 +++++++++++++++++- 6 files changed, 269 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index a87877d6dce..232074d687a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -161,6 +161,7 @@ "perm:device:enroll", "perm:geo-service:analytics-view", "perm:geo-service:alerts-manage", + "perm:devices:permanent-delete", "appm:read" ], "isOAuthEnabled": true, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js index 25f92f9c7ae..344206796ca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js @@ -623,6 +623,9 @@ var userModule = function () { if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/devices/update-enrollment")) { permissions["UPDATE_ENROLLMENT"] = true; } + if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/devices/permanent-delete")) { + permissions["PERMANENT_DELETE"] = true; + } return permissions; }; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs index c0fe1718663..53cb478806c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/public/templates/device-listing.hbs @@ -23,7 +23,7 @@ {{#equal enrolmentInfo.status "ACTIVE"}} Active{{/equal}} {{#equal enrolmentInfo.status "INACTIVE"}} Inactive{{/equal}} {{#equal enrolmentInfo.status "BLOCKED"}} Blocked{{/equal}} - {{#equal enrolmentInfo.status "REMOVED"}} Removed{{/equal}} + {{#equal enrolmentInfo.status "REMOVED"}} Removed{{/equal}} {{type}} {{enrolmentInfo.ownership}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs index cb067c464c4..3a12ea975eb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs @@ -218,15 +218,31 @@ data-toggle="modal" data-target="#modalDemo"> - + {{#if group}} Remove from group {{else}} - Remove Device + Dis-enroll Device {{/if}} + + {{#if permissions.permanentDelete}} +
  • + + + + + + Delete Device + +
  • + {{/if}} + {{#if permissions.updateEnrollment}}
  • @@ -423,6 +439,58 @@ +
    + + + +
    + +
    + + + +
    +
    +
    + + + +
    +