diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java index 504d29d5f1..8246c7e283 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java @@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; +import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationProvider; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; @@ -74,7 +75,7 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis } } catch (DeviceManagementException e) { throw new DeviceManagementException("Error occurred while adding device management provider '" + - deviceType + "'", e); + deviceType + "'", e); } if (isSharedWithAllTenants) { DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType); @@ -137,10 +138,16 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); deviceTypeIdentifier = new DeviceTypeIdentifier(deviceManagementService.getType(), tenantId); } + if (pushNoteConfig != null) { - NotificationStrategy notificationStrategy = - DeviceManagementDataHolder.getInstance().getPushNotificationProviderRepository().getProvider( - pushNoteConfig.getType()).getNotificationStrategy(pushNoteConfig); + PushNotificationProvider provider = DeviceManagementDataHolder.getInstance() + .getPushNotificationProviderRepository().getProvider(pushNoteConfig.getType()); + if (provider == null) { + throw new DeviceManagementException( + "No registered push notification provider found for the type: '" + + pushNoteConfig.getType() + "'."); + } + NotificationStrategy notificationStrategy = provider.getNotificationStrategy(pushNoteConfig); operationManagerRepository.addOperationManager(deviceTypeIdentifier, new OperationManagerImpl( notificationStrategy)); } else { @@ -172,7 +179,8 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis deviceTypeName = provider.getType().toLowerCase(); ProvisioningConfig provisioningConfig = provider.getProvisioningConfig(); int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain()); - DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId, provisioningConfig.isSharedWithAllTenants()); + DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId, + provisioningConfig.isSharedWithAllTenants()); registerPushNotificationStrategy(provider); //TODO: //This is a temporory fix. @@ -180,12 +188,13 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis //until fix that, use following variable to enable and disable of checking user authorization. DeviceManagementDataHolder.getInstance().setRequireDeviceAuthorization(provider.getType(), - provider.getDeviceManager().requireDeviceAuthorization()); + provider.getDeviceManager() + .requireDeviceAuthorization()); } catch (Throwable e) { /* Throwable is caught intentionally as failure of one plugin - due to invalid start up parameters, etc - should not block the initialization of other device management providers */ log.error("Error occurred while initializing device management provider '" + - provider.getType() + "'", e); + provider.getType() + "'", e); } } this.isInited = true; 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 cf19f5ec5b..9625762d80 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 @@ -1,5 +1,5 @@ { - "appContext": "/emm/", + "appContext": "/devicemgt/", "webAgentContext" : "/emm-web-agent/", "apiContext": "api", "httpsURL" : "%https.ip%", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs index 02be4f0a7e..199e362a46 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs @@ -26,25 +26,26 @@ {{/zone}} {{#zone "content"}} -
+
{{#if permissions.VIEW_DASHBOARD}} -
-
-
-
Devices
-
-
-
- {{device_count}} +
+
+
Devices
+
+
+
+ {{deviceCount}} - - - - - - View - + {{#if deviceCount}} + + + + + + View + + {{/if}} @@ -54,20 +55,19 @@ Add -
-
-
-
-
Groups
-
-
-
- {{group_count}} +
+
+
Groups
+
+
+
+ {{groupCount}} + {{#if groupCount}} @@ -76,6 +76,7 @@ View + {{/if}} @@ -85,20 +86,19 @@ Add -
-
-
-
-
Users
-
-
-
- {{user_count}} +
+
+
Users
+
+
+
+ {{userCount}} + {{#if userCount}} @@ -107,6 +107,7 @@ View + {{/if}} @@ -116,20 +117,19 @@ Add -
-
-
-
-
Policies
-
-
-
- {{policy_count}} +
+
+
Policies
+
+
+
+ {{policyCount}} + {{#if policyCount}} @@ -138,6 +138,7 @@ View + {{/if}} @@ -147,20 +148,19 @@ Add -
-
-
-
-
Roles
-
-
-
- {{role_count}} +
+
+
Roles
+
+
+
+ {{roleCount}} + {{#if roleCount}} @@ -169,6 +169,7 @@ View + {{/if}} @@ -178,32 +179,14 @@ Add -
{{else}} - Permission denied +

+ Permitted None +

{{/if}}
- {{/zone}} \ No newline at end of file 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 c5682c0c5b..c848b86f6e 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 @@ -32,16 +32,16 @@ function onRequest() { return; } - var page = {}; - page.permissions = permissions; - page.enrollmentURL = devicemgtProps.enrollmentURL; - page.device_count = deviceModule.getDevicesCount(); + var viewModel = {}; + viewModel.permissions = permissions; + viewModel.enrollmentURL = devicemgtProps.enrollmentURL; + viewModel.deviceCount = deviceModule.getDevicesCount(); //TODO: Enable Group Management Service API on CDMF //page.group_count = groupModule.getGroupCount(); - page.group_count = -1; - page.user_count = userModule.getUsersCount(); - page.policy_count = policyModule.getPoliciesCount(); - page.role_count = userModule.getRolesCount(); + viewModel.groupCount = -1; + viewModel.userCount = userModule.getUsersCount(); + viewModel.policyCount = policyModule.getPoliciesCount(); + viewModel.roleCount = userModule.getRolesCount(); - return page; + return viewModel; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.js index e9c68c6452..62ca011b0b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.js @@ -27,12 +27,12 @@ function onRequest(context) { var utility = require("/app/modules/utility.js").utility; var typesListResponse = deviceModule.getDeviceTypes(); if (typesListResponse["status"] == "success") { - var deviceTypes = typesListResponse["content"]; + var deviceTypes = typesListResponse.content.deviceTypes; if (deviceTypes) { var deviceTypesList = [], virtualDeviceTypesList = []; for (var i = 0; i < deviceTypes.length; i++) { - - var deviceTypeLabel = deviceTypes[i].name; + var deviceType = deviceTypes[i]; + var deviceTypeLabel = deviceType; var configs = utility.getDeviceTypeConfig(deviceTypeLabel); var deviceCategory = "device"; if (configs) { @@ -45,22 +45,20 @@ function onRequest(context) { } if (deviceCategory == 'virtual') { virtualDeviceTypesList.push({ - "hasCustTemplate": false, - "deviceTypeLabel": deviceTypeLabel, - "deviceTypeName": deviceTypes[i].name, - "deviceCategory": deviceCategory, - "deviceTypeId": deviceTypes[i].id, - "thumb": utility.getDeviceThumb(deviceTypes[i].name) - }); + "hasCustTemplate": false, + "deviceTypeLabel": deviceTypeLabel, + "deviceTypeName": deviceType, + "deviceCategory": deviceCategory, + "thumb": utility.getDeviceThumb(deviceType) + }); } else { deviceTypesList.push({ - "hasCustTemplate": false, - "deviceTypeLabel": deviceTypeLabel, - "deviceTypeName": deviceTypes[i].name, - "deviceCategory": deviceCategory, - "deviceTypeId": deviceTypes[i].id, - "thumb": utility.getDeviceThumb(deviceTypes[i].name) - }); + "hasCustTemplate": false, + "deviceTypeLabel": deviceTypeLabel, + "deviceTypeName": deviceType, + "deviceCategory": deviceCategory, + "thumb": utility.getDeviceThumb(deviceType) + }); } } if (virtualDeviceTypesList.length > 0) {