From dec2950f6ec126b30500e14d4475a8707478bfc4 Mon Sep 17 00:00:00 2001 From: Megala Date: Sun, 13 Nov 2016 19:21:15 +0530 Subject: [PATCH 1/9] Adding additional configurations for app-conf --- .../resources/jaggeryapps/devicemgt/app/conf/app-conf.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json index b26d93b60..d3e82ad57 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json @@ -32,8 +32,10 @@ "identityProviderUrl" : "https://localhost:9443/samlsso", "acs": "https://localhost:9443/emm/uuf/sso/acs", "identityAlias": "wso2carbon", - "responseSigningEnabled" : "true", - "useTenantKey": false + "responseSigningEnabled" : true, + "validateAssertionValidityPeriod": true, + "validateAudienceRestriction": true, + "assertionSigningEnabled": true } }, "generalConfig" : { From 57e46525f8161923e0d0cde74d77db7b2f65b9e5 Mon Sep 17 00:00:00 2001 From: Megala Date: Tue, 15 Nov 2016 10:25:33 +0530 Subject: [PATCH 2/9] Changing the dashboard menu to be only visible for super-tenant users --- .../app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js index b7aba2e89..34500e206 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js @@ -30,6 +30,8 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var constants = require("/app/modules/constants.js"); + var carbon = require("carbon"); + var superTenant = carbon.server.superTenant; var links = { "user-mgt": [], "role-mgt": [], @@ -55,7 +57,10 @@ function onRequest(context) { permissions["LIST_CERTIFICATES"] = userModule.isAuthorized("/permission/admin/device-mgt/certificates/view"); permissions["CONFIG_MGT_PERMITTED"] = (permissions["LIST_PLATFORM_CONFIGURATIONS"] || permissions["LIST_CERTIFICATES"]); permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view"); - permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view"); + + // Restricting the dashboard menu only for super-tenant users + permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view") && + (viewModel["currentUser"].domain == superTenant.domain); viewModel["permissions"] = permissions; viewModel["appContext"] = mdmProps["appContext"]; From 6d3fbc422ff68d19635a10188ab5bd2203af1713 Mon Sep 17 00:00:00 2001 From: Megala Date: Tue, 15 Nov 2016 22:59:12 +0530 Subject: [PATCH 3/9] Adding link for the dashboard in tenant mode --- .../app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs | 2 +- .../app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs index 6420510a6..80d6026fc 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -75,7 +75,7 @@ {{/if}} {{#if permissions.VIEW_DASHBOARD}} -
  • +
  • Device Management Dashboard
  • {{/if}} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js index 34500e206..41615c6a6 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js @@ -59,8 +59,7 @@ function onRequest(context) { permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view"); // Restricting the dashboard menu only for super-tenant users - permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view") && - (viewModel["currentUser"].domain == superTenant.domain); + permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view"); viewModel["permissions"] = permissions; viewModel["appContext"] = mdmProps["appContext"]; From 3ff394902e108226a59d7248733d707baf6731ad Mon Sep 17 00:00:00 2001 From: Megala Date: Tue, 15 Nov 2016 23:04:51 +0530 Subject: [PATCH 4/9] Removing unnecessary require statements --- .../app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js index 41615c6a6..b7aba2e89 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js @@ -30,8 +30,6 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var constants = require("/app/modules/constants.js"); - var carbon = require("carbon"); - var superTenant = carbon.server.superTenant; var links = { "user-mgt": [], "role-mgt": [], @@ -57,8 +55,6 @@ function onRequest(context) { permissions["LIST_CERTIFICATES"] = userModule.isAuthorized("/permission/admin/device-mgt/certificates/view"); permissions["CONFIG_MGT_PERMITTED"] = (permissions["LIST_PLATFORM_CONFIGURATIONS"] || permissions["LIST_CERTIFICATES"]); permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view"); - - // Restricting the dashboard menu only for super-tenant users permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view"); viewModel["permissions"] = permissions; From e25e9fd4a1d82cdfdb1ced8567bf7621bb8338fe Mon Sep 17 00:00:00 2001 From: inoshperera Date: Wed, 16 Nov 2016 09:33:43 +0530 Subject: [PATCH 5/9] adding support for webclip uninstallation for ios --- .../ApplicationOperationsImpl.java | 10 +++++++--- .../mdmmgt/beans/ios/RemoveApplication.java | 9 +++++++++ .../util/IOSApplicationOperationUtil.java | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java index 766698c9c..f0c92c31f 100644 --- a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java +++ b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java @@ -73,7 +73,8 @@ public class ApplicationOperationsImpl implements ApplicationOperations { getDevicesOfUser(userName); for (org.wso2.carbon.device.mgt.common.Device device : deviceList) { - if(applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ + if(MDMAppConstants.WEBAPP.equals(applicationOperationAction.getApp().getPlatform()) || + applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); } } @@ -176,8 +177,11 @@ public class ApplicationOperationsImpl implements ApplicationOperations { operation = IOSApplicationOperationUtil.createInstallAppOperation(mobileApp); } else { - operation = - IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + if (MDMAppConstants.WEBAPP.equals(app.getPlatform())) { + operation = IOSApplicationOperationUtil.createWebClipUninstallOperation(mobileApp); + } else { + operation = IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + } } } activity = MDMServiceAPIUtils.getAppManagementService(applicationOperationAction.getTenantId()) diff --git a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java index 22c7963de..d5ae92170 100644 --- a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java +++ b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java @@ -23,6 +23,15 @@ import java.io.Serializable; public class RemoveApplication implements Serializable { private String bundleId; + private String url; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } public String getBundleId() { return bundleId; diff --git a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java index 5b2dec4eb..5e73a5775 100644 --- a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java +++ b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java @@ -111,4 +111,22 @@ public class IOSApplicationOperationUtil { return operation; } + /** + * Create uninstall operations for webclip. + * + * @param application + * @return Uninstall operation + * @throws DeviceApplicationException + */ + public static Operation createWebClipUninstallOperation(MobileApp application) throws + DeviceApplicationException { + ProfileOperation operation = new ProfileOperation(); + operation.setCode(MDMAppConstants.IOSConstants.OPCODE_REMOVE_APPLICATION); + operation.setType(Operation.Type.PROFILE); + RemoveApplication removeApplication = new RemoveApplication(); + removeApplication.setUrl(application.getIdentifier()); + operation.setPayLoad(removeApplication.toJSON()); + return operation; + } + } From edd400bde4f2740a0faa8bbf96566b6302a72952 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 18 Nov 2016 19:54:59 +0530 Subject: [PATCH 6/9] Changing menu item names --- .../mdm.unit.ui.navbar.nav-menu/nav-menu.hbs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs index 80d6026fc..ac2b44eaf 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -25,10 +25,14 @@
  • - Resource Dashboard + System Resources
  • - + {{#if permissions.VIEW_DASHBOARD}} +
  • + Device Statistics +
  • + {{/if}} {{#if permissions.LIST_DEVICES}}
  • @@ -74,11 +78,6 @@
  • {{/if}} - {{#if permissions.VIEW_DASHBOARD}} -
  • - Device Management Dashboard -
  • - {{/if}} {{/zone}} {{#zone "navbarCollapsableRightItems"}} @@ -110,7 +109,7 @@ - View All Notifications + View All Notifications From dbeedf246ba7bcdec77de26366838f4d4c6755fb Mon Sep 17 00:00:00 2001 From: dilanua Date: Sun, 20 Nov 2016 10:55:56 +0530 Subject: [PATCH 7/9] Adding deviceStatisticsEnabled property to check visibility of device-statistics menu item --- .../jaggeryapps/devicemgt/app/conf/config.json | 4 ++-- .../units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs | 11 +++++++---- .../units/mdm.unit.ui.navbar.nav-menu/nav-menu.js | 12 ++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 06417b7e8..4fb7741b9 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -7,7 +7,6 @@ "httpsWebURL" : "%https.ip%", "wssURL" : "%https.ip%", "wsURL" : "%http.ip%", - "dashboardServerURL" : "%https.ip%", "enrollmentDir": "/emm-web-agent/enrollment", "iOSConfigRoot" : "%https.ip%/ios-enrollment/", "iOSAPIRoot" : "%https.ip%/ios/", @@ -121,5 +120,6 @@ "isOAuthEnabled" : true, "backendRestEndpoints" : { "deviceMgt" : "/api/device-mgt/v1.0" - } + }, + "deviceStatisticsEnabled" : false } \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs index ac2b44eaf..cd674764c 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -28,10 +28,12 @@ System Resources - {{#if permissions.VIEW_DASHBOARD}} -
  • - Device Statistics -
  • + {{#if dashboardAvailable}} + {{#if permissions.VIEW_DASHBOARD}} +
  • + Device Statistics +
  • + {{/if}} {{/if}} {{#if permissions.LIST_DEVICES}}
  • @@ -104,6 +106,7 @@
    + diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js index b7aba2e89..4269d3929 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js @@ -17,6 +17,10 @@ */ function onRequest(context) { + var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; + var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; + var constants = require("/app/modules/constants.js"); + context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { if (arguments.length < 3) { throw new Error("Handlebars Helper equal needs 2 parameters"); @@ -27,9 +31,7 @@ function onRequest(context) { return options.fn(this); } }); - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - var constants = require("/app/modules/constants.js"); + var links = { "user-mgt": [], "role-mgt": [], @@ -40,7 +42,7 @@ function onRequest(context) { // following viewModel.link value comes here based on the value passed at the point // where units are attached to a page zone. - // eg: {{unit "appbar" pageLink="users" title="User Management"}} + // eg: {{unit "app-bar" pageLink="users" title="User Management"}} viewModel["currentActions"] = links[viewModel["pageLink"]]; viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"]; viewModel["currentUser"] = session.get(constants["USER_SESSION_KEY"]); @@ -57,6 +59,8 @@ function onRequest(context) { permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view"); permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view"); + viewModel["dashboardAvailable"] = mdmProps["deviceStatisticsEnabled"]; + viewModel["permissions"] = permissions; viewModel["appContext"] = mdmProps["appContext"]; viewModel["serverURL"] = mdmProps["httpsWebURL"]; From 861c5f861eadcf335c5b9c9abcb37ea9e7184d72 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sun, 20 Nov 2016 12:09:59 +0530 Subject: [PATCH 8/9] Updating device statistics menu item url --- .../app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs index cd674764c..864ea7e57 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -30,7 +30,7 @@
  • {{#if dashboardAvailable}} {{#if permissions.VIEW_DASHBOARD}} -
  • +
  • Device Statistics
  • {{/if}} From 1cce94cef9446e648b2de7698483e4a7c3359600 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sun, 20 Nov 2016 22:31:27 +0530 Subject: [PATCH 9/9] Fixing operation button stuck issue --- .../public/js/operation-bar.js | 73 ++++++++----------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js index 90ce9ce4a..84cbb2376 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js @@ -51,9 +51,9 @@ function getSelectedDeviceIds() { var deviceId = device.data('deviceid'); var deviceType = device.data('type'); deviceIdentifierList.push({ - "id": deviceId, - "type": deviceType - }); + "id": deviceId, + "type": deviceType + }); }); if (deviceIdentifierList.length == 0) { var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); @@ -62,9 +62,9 @@ function getSelectedDeviceIds() { var deviceId = $(thisTable.api().row(this).node()).data('deviceid'); var deviceType = $(thisTable.api().row(this).node()).data('devicetype'); deviceIdentifierList.push({ - "id": deviceId, - "type": deviceType - }); + "id": deviceId, + "type": deviceType + }); } }); } @@ -102,11 +102,6 @@ function getDevicesByTypes(deviceList) { return deviceTypes; } -//function unloadOperationBar() { -// $("#showOperationsBtn").addClass("hidden"); -// $(".wr-operations").html(""); -//} - function loadOperationBar(deviceType, ownership, mode) { var operationBar = $("#operations-bar"); var operationBarSrc = operationBar.attr("src"); @@ -166,7 +161,7 @@ function loadOperationBar(deviceType, ownership, mode) { /* adding ownership in addition to device-type as it's vital in cases where UI for the same feature should change according to ownership - */ + */ if (ownership) { current.ownership = ownership; } @@ -190,22 +185,21 @@ function loadOperationBar(deviceType, ownership, mode) { } function runOperation(operationName) { + if (operationName == "NOTIFICATION") { + var messageTitle = $("#messageTitle").val(); + var messageText = $("#messageText").val(); + if (!messageTitle || !messageText) { + var errorMsg = "#notification-error-msg span"; + var errorMsgWrapper = "#notification-error-msg"; + $(errorMsg).text("Either the message title / message text or both are empty."); + $(errorMsgWrapper).removeClass("hidden"); + return; + } + } + var deviceIdList = getSelectedDeviceIds(); var list = getDevicesByTypes(deviceIdList); - var successCallback = function (data) { - if (operationName == "NOTIFICATION") { - $(modalPopupContent).html($("#messageSuccess").html()); - } else { - $(modalPopupContent).html($("#operationSuccess").html()); - } - showPopup(); - }; - var errorCallback = function (data) { - $(modalPopupContent).html($("#errorOperationUnexpected").html()); - showPopup(); - }; - var payload, serviceEndPoint; if (list[platformTypeConstants.IOS]) { payload = @@ -217,27 +211,22 @@ function runOperation(operationName) { serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName); } else if (list[platformTypeConstants.WINDOWS]) { payload = operationModule.generatePayload(platformTypeConstants.WINDOWS, operationName, - list[platformTypeConstants.WINDOWS]); + list[platformTypeConstants.WINDOWS]); serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName); } - if (operationName == "NOTIFICATION") { - var errorMsgWrapper = "#notification-error-msg"; - var errorMsg = "#notification-error-msg span"; - var messageTitle = $("#messageTitle").val(); - var messageText = $("#messageText").val(); - if (!(messageTitle && messageText)) { - $(errorMsg).text("Enter a message. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); + + var successCallback = function () { + if (operationName == "NOTIFICATION") { + $(modalPopupContent).html($("#messageSuccess").html()); } else { - invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); - $(modalPopupContent).removeData(); - hidePopup(); + $(modalPopupContent).html($("#operationSuccess").html()); } - } else { - invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); - $(modalPopupContent).removeData(); - hidePopup(); - } + }; + var errorCallback = function () { + $(modalPopupContent).html($("#errorOperationUnexpected").html()); + }; + + invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); } /*