revert-70aa11f8
harshanl 8 years ago
commit 12713f3301

@ -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.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; 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.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.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
@ -74,7 +75,7 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
} }
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
throw new DeviceManagementException("Error occurred while adding device management provider '" + throw new DeviceManagementException("Error occurred while adding device management provider '" +
deviceType + "'", e); deviceType + "'", e);
} }
if (isSharedWithAllTenants) { if (isSharedWithAllTenants) {
DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType); DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType);
@ -137,10 +138,16 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
deviceTypeIdentifier = new DeviceTypeIdentifier(deviceManagementService.getType(), tenantId); deviceTypeIdentifier = new DeviceTypeIdentifier(deviceManagementService.getType(), tenantId);
} }
if (pushNoteConfig != null) { if (pushNoteConfig != null) {
NotificationStrategy notificationStrategy = PushNotificationProvider provider = DeviceManagementDataHolder.getInstance()
DeviceManagementDataHolder.getInstance().getPushNotificationProviderRepository().getProvider( .getPushNotificationProviderRepository().getProvider(pushNoteConfig.getType());
pushNoteConfig.getType()).getNotificationStrategy(pushNoteConfig); 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( operationManagerRepository.addOperationManager(deviceTypeIdentifier, new OperationManagerImpl(
notificationStrategy)); notificationStrategy));
} else { } else {
@ -172,7 +179,8 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
deviceTypeName = provider.getType().toLowerCase(); deviceTypeName = provider.getType().toLowerCase();
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig(); ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain()); int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId, provisioningConfig.isSharedWithAllTenants()); DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId,
provisioningConfig.isSharedWithAllTenants());
registerPushNotificationStrategy(provider); registerPushNotificationStrategy(provider);
//TODO: //TODO:
//This is a temporory fix. //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. //until fix that, use following variable to enable and disable of checking user authorization.
DeviceManagementDataHolder.getInstance().setRequireDeviceAuthorization(provider.getType(), DeviceManagementDataHolder.getInstance().setRequireDeviceAuthorization(provider.getType(),
provider.getDeviceManager().requireDeviceAuthorization()); provider.getDeviceManager()
.requireDeviceAuthorization());
} catch (Throwable e) { } catch (Throwable e) {
/* Throwable is caught intentionally as failure of one plugin - due to invalid start up parameters, /* 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 */ etc - should not block the initialization of other device management providers */
log.error("Error occurred while initializing device management provider '" + log.error("Error occurred while initializing device management provider '" +
provider.getType() + "'", e); provider.getType() + "'", e);
} }
} }
this.isInited = true; this.isInited = true;

@ -1,5 +1,5 @@
{ {
"appContext": "/emm/", "appContext": "/devicemgt/",
"webAgentContext" : "/emm-web-agent/", "webAgentContext" : "/emm-web-agent/",
"apiContext": "api", "apiContext": "api",
"httpsURL" : "%https.ip%", "httpsURL" : "%https.ip%",

@ -26,25 +26,26 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
<div class="wr-content"> <div class="row">
{{#if permissions.VIEW_DASHBOARD}} {{#if permissions.VIEW_DASHBOARD}}
<div class="row wr-stats-board"> <div class="col-md-3 wr-stats-board">
<div class="col-md-4"> <div class="wr-stats-board-tile">
<div class="wr-stats-board-tile"> <div class="tile-name">Devices</div>
<div class="tile-name">Devices</div> <div>
<div> <div class="tile-icon"><i class="fw fw-mobile"></i></div>
<div class="tile-icon"><i class="fw fw-mobile"></i></div> <div class="tile-stats">
<div class="tile-stats"> <span id="device-count">{{deviceCount}}</span>
<span id="device-count">{{device_count}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/devices"> {{#if deviceCount}}
<span class="fw-stack"> <a href="{{@app.context}}/devices">
<i class="fw fw-ring fw-stack-2x"></i> <span class="fw-stack">
<i class="fw fw-view fw-stack-1x"></i> <i class="fw fw-ring fw-stack-2x"></i>
</span> <i class="fw fw-view fw-stack-1x"></i>
View </span>
</a> View
</a>
{{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/device/enroll"> <a href="{{@app.context}}/device/enroll">
<span class="fw-stack"> <span class="fw-stack">
@ -54,20 +55,19 @@
Add Add
</a> </a>
</span> </span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row wr-stats-board"> <div class="col-md-3 wr-stats-board">
<div class="col-md-4"> <div class="wr-stats-board-tile">
<div class="wr-stats-board-tile"> <div class="tile-name">Groups</div>
<div class="tile-name">Groups</div> <div>
<div> <div class="tile-icon"><i class="fw fw-grouping"></i></div>
<div class="tile-icon"><i class="fw fw-grouping"></i></div> <div class="tile-stats">
<div class="tile-stats"> <span id="group-count">{{groupCount}}</span>
<span id="group-count">{{group_count}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if groupCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/groups"> <a href="{{@app.context}}/groups">
<span class="fw-stack"> <span class="fw-stack">
@ -76,6 +76,7 @@
</span> </span>
View View
</a> </a>
{{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/group/add"> <a href="{{@app.context}}/group/add">
<span class="fw-stack"> <span class="fw-stack">
@ -85,20 +86,19 @@
Add Add
</a> </a>
</span> </span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row wr-stats-board"> <div class="col-md-3 wr-stats-board">
<div class="col-md-4"> <div class="wr-stats-board-tile">
<div class="wr-stats-board-tile"> <div class="tile-name">Users</div>
<div class="tile-name">Users</div> <div>
<div> <div class="tile-icon"><i class="fw fw-user"></i></div>
<div class="tile-icon"><i class="fw fw-user"></i></div> <div class="tile-stats">
<div class="tile-stats"> <span id="user-count">{{userCount}}</span>
<span id="user-count">{{user_count}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if userCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/users"> <a href="{{@app.context}}/users">
<span class="fw-stack"> <span class="fw-stack">
@ -107,6 +107,7 @@
</span> </span>
View View
</a> </a>
{{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/user/add"> <a href="{{@app.context}}/user/add">
<span class="fw-stack"> <span class="fw-stack">
@ -116,20 +117,19 @@
Add Add
</a> </a>
</span> </span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row wr-stats-board"> <div class="col-md-3 wr-stats-board">
<div class="col-md-4"> <div class="wr-stats-board-tile">
<div class="wr-stats-board-tile"> <div class="tile-name">Policies</div>
<div class="tile-name">Policies</div> <div>
<div> <div class="tile-icon"><i class="fw fw-policy"></i></div>
<div class="tile-icon"><i class="fw fw-policy"></i></div> <div class="tile-stats">
<div class="tile-stats"> <span id="policy-count">{{policyCount}}</span>
<span id="policy-count">{{policy_count}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if policyCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policies"> <a href="{{@app.context}}/policies">
<span class="fw-stack"> <span class="fw-stack">
@ -138,6 +138,7 @@
</span> </span>
View View
</a> </a>
{{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policy/add"> <a href="{{@app.context}}/policy/add">
<span class="fw-stack"> <span class="fw-stack">
@ -147,20 +148,19 @@
Add Add
</a> </a>
</span> </span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row wr-stats-board"> <div class="col-md-3 wr-stats-board">
<div class="col-md-4"> <div class="wr-stats-board-tile">
<div class="wr-stats-board-tile"> <div class="tile-name">Roles</div>
<div class="tile-name">Roles</div> <div>
<div> <div class="tile-icon"><i class="fw fw-bookmark"></i></div>
<div class="tile-icon"><i class="fw fw-bookmark"></i></div> <div class="tile-stats">
<div class="tile-stats"> <span id="role-count">{{roleCount}}</span>
<span id="role-count">{{role_count}}</span>
<span class="tile-stats-free"> <span class="tile-stats-free">
{{#if roleCount}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a id="device-count-view-btn" href="{{@app.context}}/roles"> <a id="device-count-view-btn" href="{{@app.context}}/roles">
<span class="fw-stack"> <span class="fw-stack">
@ -169,6 +169,7 @@
</span> </span>
View View
</a> </a>
{{/if}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/roles/add-role"> <a href="{{@app.context}}/roles/add-role">
<span class="fw-stack"> <span class="fw-stack">
@ -178,32 +179,14 @@
Add Add
</a> </a>
</span> </span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{else}} {{else}}
Permission denied <h1 class="page-sub-title">
Permitted None
</h1>
{{/if}} {{/if}}
</div> </div>
<div id="qr-code-modal" data-enrollment-url="{{enrollmentURL}}" class="hidden">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
Scan QR code to start enrollment
</h3>
<h4>
Please scan the QR code using your mobile device to retrieve enrollment URL.
</h4>
<div class="panel panel-default">
<div class="panel-body col-centered ">
<div class="qr-code"></div>
</div>
</div>
</div>
</div>
</div>
</div>
{{/zone}} {{/zone}}

@ -32,16 +32,16 @@ function onRequest() {
return; return;
} }
var page = {}; var viewModel = {};
page.permissions = permissions; viewModel.permissions = permissions;
page.enrollmentURL = devicemgtProps.enrollmentURL; viewModel.enrollmentURL = devicemgtProps.enrollmentURL;
page.device_count = deviceModule.getDevicesCount(); viewModel.deviceCount = deviceModule.getDevicesCount();
//TODO: Enable Group Management Service API on CDMF //TODO: Enable Group Management Service API on CDMF
//page.group_count = groupModule.getGroupCount(); //page.group_count = groupModule.getGroupCount();
page.group_count = -1; viewModel.groupCount = -1;
page.user_count = userModule.getUsersCount(); viewModel.userCount = userModule.getUsersCount();
page.policy_count = policyModule.getPoliciesCount(); viewModel.policyCount = policyModule.getPoliciesCount();
page.role_count = userModule.getRolesCount(); viewModel.roleCount = userModule.getRolesCount();
return page; return viewModel;
} }

@ -27,12 +27,12 @@ function onRequest(context) {
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var typesListResponse = deviceModule.getDeviceTypes(); var typesListResponse = deviceModule.getDeviceTypes();
if (typesListResponse["status"] == "success") { if (typesListResponse["status"] == "success") {
var deviceTypes = typesListResponse["content"]; var deviceTypes = typesListResponse.content.deviceTypes;
if (deviceTypes) { if (deviceTypes) {
var deviceTypesList = [], virtualDeviceTypesList = []; var deviceTypesList = [], virtualDeviceTypesList = [];
for (var i = 0; i < deviceTypes.length; i++) { for (var i = 0; i < deviceTypes.length; i++) {
var deviceType = deviceTypes[i];
var deviceTypeLabel = deviceTypes[i].name; var deviceTypeLabel = deviceType;
var configs = utility.getDeviceTypeConfig(deviceTypeLabel); var configs = utility.getDeviceTypeConfig(deviceTypeLabel);
var deviceCategory = "device"; var deviceCategory = "device";
if (configs) { if (configs) {
@ -45,22 +45,20 @@ function onRequest(context) {
} }
if (deviceCategory == 'virtual') { if (deviceCategory == 'virtual') {
virtualDeviceTypesList.push({ virtualDeviceTypesList.push({
"hasCustTemplate": false, "hasCustTemplate": false,
"deviceTypeLabel": deviceTypeLabel, "deviceTypeLabel": deviceTypeLabel,
"deviceTypeName": deviceTypes[i].name, "deviceTypeName": deviceType,
"deviceCategory": deviceCategory, "deviceCategory": deviceCategory,
"deviceTypeId": deviceTypes[i].id, "thumb": utility.getDeviceThumb(deviceType)
"thumb": utility.getDeviceThumb(deviceTypes[i].name) });
});
} else { } else {
deviceTypesList.push({ deviceTypesList.push({
"hasCustTemplate": false, "hasCustTemplate": false,
"deviceTypeLabel": deviceTypeLabel, "deviceTypeLabel": deviceTypeLabel,
"deviceTypeName": deviceTypes[i].name, "deviceTypeName": deviceType,
"deviceCategory": deviceCategory, "deviceCategory": deviceCategory,
"deviceTypeId": deviceTypes[i].id, "thumb": utility.getDeviceThumb(deviceType)
"thumb": utility.getDeviceThumb(deviceTypes[i].name) });
});
} }
} }
if (virtualDeviceTypesList.length > 0) { if (virtualDeviceTypesList.length > 0) {

Loading…
Cancel
Save