Fixing UI issues occured after restructuring.

revert-70aa11f8
charithag 9 years ago
parent d8d74ed595
commit 905f9ae4c1

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
@ -14,7 +14,6 @@
* KIND, either express or implied. See the License for the * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*
*/ */
package org.wso2.carbon.device.mgt.core.group.mgt.dao; package org.wso2.carbon.device.mgt.core.group.mgt.dao;
@ -39,7 +38,7 @@ public class GroupManagementDAOFactory {
private static final Log log = LogFactory.getLog(GroupManagementDAOFactory.class); private static final Log log = LogFactory.getLog(GroupManagementDAOFactory.class);
private static DataSource dataSource; private static DataSource dataSource;
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>(); private static ThreadLocal<Connection> currentConnection = new ThreadLocal<>();
/** /**
* Get instance of GroupDAO * Get instance of GroupDAO
@ -162,7 +161,8 @@ public class GroupManagementDAOFactory {
Connection conn = currentConnection.get(); Connection conn = currentConnection.get();
if (conn == null) { if (conn == null) {
throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
"This might have ideally been caused by not properly initiating the transaction via " + "This might have ideally been caused by not properly " +
"initiating the transaction via " +
"'beginTransaction'/'openConnection' methods"); "'beginTransaction'/'openConnection' methods");
} }
try { try {

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
@ -43,6 +43,7 @@ import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.mgt.core.config.tenant.TenantConfigurationManagementServiceImpl; import org.wso2.carbon.device.mgt.core.config.tenant.TenantConfigurationManagementServiceImpl;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.group.mgt.dao.GroupManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.notification.mgt.NotificationManagementServiceImpl; import org.wso2.carbon.device.mgt.core.notification.mgt.NotificationManagementServiceImpl;
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl;
@ -53,7 +54,6 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceIm
import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImpl; import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderServiceImpl;
import org.wso2.carbon.device.mgt.core.util.DeviceManagementSchemaInitializer; import org.wso2.carbon.device.mgt.core.util.DeviceManagementSchemaInitializer;
import org.wso2.carbon.email.sender.core.service.EmailSenderService;
import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.ndatasource.core.DataSourceService;
import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.service.RealmService;
@ -103,14 +103,32 @@ import java.util.List;
*/ */
public class DeviceManagementServiceComponent { public class DeviceManagementServiceComponent {
private static Log log = LogFactory.getLog(DeviceManagementServiceComponent.class);
private static final Object LOCK = new Object(); private static final Object LOCK = new Object();
private static Log log = LogFactory.getLog(DeviceManagementServiceComponent.class);
private static List<PluginInitializationListener> listeners = new ArrayList<>(); private static List<PluginInitializationListener> listeners = new ArrayList<>();
private static List<DeviceManagementService> deviceManagers = new ArrayList<>(); private static List<DeviceManagementService> deviceManagers = new ArrayList<>();
private static List<DeviceManagerStartupListener> startupListeners = new ArrayList<>(); private static List<DeviceManagerStartupListener> startupListeners = new ArrayList<>();
private DeviceManagementPluginRepository pluginRepository = new DeviceManagementPluginRepository(); private DeviceManagementPluginRepository pluginRepository = new DeviceManagementPluginRepository();
public static void registerPluginInitializationListener(PluginInitializationListener listener) {
synchronized (LOCK) {
listeners.add(listener);
for (DeviceManagementService deviceManagementService : deviceManagers) {
listener.registerDeviceManagementService(deviceManagementService);
}
}
}
public static void registerStartupListener(DeviceManagerStartupListener startupListener) {
startupListeners.add(startupListener);
}
public static void notifyStartupListeners() {
for (DeviceManagerStartupListener startupListener : startupListeners) {
startupListener.notifyObserver();
}
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) { protected void activate(ComponentContext componentContext) {
try { try {
@ -124,6 +142,7 @@ public class DeviceManagementServiceComponent {
DataSourceConfig dsConfig = config.getDeviceManagementConfigRepository().getDataSourceConfig(); DataSourceConfig dsConfig = config.getDeviceManagementConfigRepository().getDataSourceConfig();
DeviceManagementDAOFactory.init(dsConfig); DeviceManagementDAOFactory.init(dsConfig);
GroupManagementDAOFactory.init(dsConfig);
NotificationManagementDAOFactory.init(dsConfig); NotificationManagementDAOFactory.init(dsConfig);
OperationManagementDAOFactory.init(dsConfig); OperationManagementDAOFactory.init(dsConfig);
@ -159,15 +178,6 @@ public class DeviceManagementServiceComponent {
//do nothing //do nothing
} }
public static void registerPluginInitializationListener(PluginInitializationListener listener) {
synchronized (LOCK) {
listeners.add(listener);
for (DeviceManagementService deviceManagementService : deviceManagers) {
listener.registerDeviceManagementService(deviceManagementService);
}
}
}
private void initOperationsManager() throws OperationManagementException { private void initOperationsManager() throws OperationManagementException {
OperationManager operationManager = new OperationManagerImpl(); OperationManager operationManager = new OperationManagerImpl();
DeviceManagementDataHolder.getInstance().setOperationManager(operationManager); DeviceManagementDataHolder.getInstance().setOperationManager(operationManager);
@ -349,14 +359,4 @@ public class DeviceManagementServiceComponent {
DeviceManagementDataHolder.getInstance().setConfigurationContextService(null); DeviceManagementDataHolder.getInstance().setConfigurationContextService(null);
} }
public static void registerStartupListener(DeviceManagerStartupListener startupListener) {
startupListeners.add(startupListener);
}
public static void notifyStartupListeners() {
for (DeviceManagerStartupListener startupListener : startupListeners) {
startupListener.notifyObserver();
}
}
} }

@ -20,7 +20,7 @@
* This backendServiceInvoker contains the wrappers for back end jaggary calls. * This backendServiceInvoker contains the wrappers for back end jaggary calls.
*/ */
var backendServiceInvoker = function () { var backendServiceInvoker = function () {
var log = new Log("/app/modules/backend-service-invoker.js") var log = new Log("/app/modules/backend-service-invoker.js");
var publicXMLHTTPInvokers = {}; var publicXMLHTTPInvokers = {};
var privateMethods = {}; var privateMethods = {};
var publicWSInvokers = {}; var publicWSInvokers = {};
@ -72,8 +72,6 @@ var backendServiceInvoker = function () {
} else { } else {
xmlHttpRequest.send(); xmlHttpRequest.send();
} }
log.debug("Service Invoker-URL: " + url);
log.debug("Service Invoker-Method: " + method);
if ((xmlHttpRequest.status >= 200 && xmlHttpRequest.status < 300) || xmlHttpRequest.status == 302) { if ((xmlHttpRequest.status >= 200 && xmlHttpRequest.status < 300) || xmlHttpRequest.status == 302) {
if (xmlHttpRequest.responseText != null) { if (xmlHttpRequest.responseText != null) {
@ -188,7 +186,7 @@ var backendServiceInvoker = function () {
privateMethods.initiateWSRequest = function (action, endpoint, successCallback, errorCallback, soapVersion, payload) { privateMethods.initiateWSRequest = function (action, endpoint, successCallback, errorCallback, soapVersion, payload) {
var ws = require('ws'); var ws = require('ws');
var wsRequest = new ws.WSRequest(); var wsRequest = new ws.WSRequest();
var options = new Array(); var options = [];
if (IS_OAUTH_ENABLED) { if (IS_OAUTH_ENABLED) {
var accessToken = privateMethods.getAccessToken(); var accessToken = privateMethods.getAccessToken();
if (accessToken) { if (accessToken) {

@ -274,7 +274,7 @@ deviceModule = function () {
utility.startTenantFlow(carbonUser); utility.startTenantFlow(carbonUser);
var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/view?type=" + deviceType + "&id=" + deviceId; var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/view?type=" + deviceType + "&id=" + deviceId;
var dataNew = serviceInvokers.XMLHttp.get( return serviceInvokers.XMLHttp.get(
url, function (responsePayload) { url, function (responsePayload) {
var device = responsePayload.responseContent; var device = responsePayload.responseContent;
if (device) { if (device) {
@ -307,7 +307,6 @@ deviceModule = function () {
return response; return response;
} }
); );
return dataNew;
} catch (e) { } catch (e) {
throw e; throw e;
} finally { } finally {
@ -349,27 +348,18 @@ deviceModule = function () {
return result; return result;
}; };
publicMethods.getOwnDevicesCount = function () { publicMethods.getAllDevicesCount = function () {
var carbonUser = session.get(constants.USER_SESSION_KEY); var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/count";
var listAllDevicesEndPoint = deviceCloudService + "/device/user/" + carbonUser.username + "/all/count"; return serviceInvokers.XMLHttp.get(
return get(listAllDevicesEndPoint, {}, "json").data; url, function (responsePayload) {
}; return responsePayload;
publicMethods.getUnGroupedDevices = function () {
var carbonUser = session.get(constants.USER_SESSION_KEY);
var listAllDevicesEndPoint = deviceCloudService + "/device/user/" + carbonUser.username + "/ungrouped";
return get(listAllDevicesEndPoint, {}, "json").data;
};
publicMethods.getUnGroupedDevicesCount = function () {
var result = publicMethods.getUnGroupedDevices();
var devices = result.data;
var count = 0;
if (devices) {
count = devices.length;
} }
result.data = count; ,
return result; function (responsePayload) {
log.error(responsePayload);
return -1;
}
);
}; };
publicMethods.getAllPermittedDevices = function () { publicMethods.getAllPermittedDevices = function () {

@ -23,169 +23,26 @@ var groupModule = {};
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var devicemgtProps = require('/app/conf/devicemgt-props.js').config(); var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;
var deviceCloudService = devicemgtProps["httpsURL"] + "/common/group_manager"; var deviceCloudService = devicemgtProps["httpsURL"] + "/common/group_manager";
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);
var deviceModule = require("/app/modules/device.js").deviceModule;
var endPoint, data, response; var endPoint;
groupModule.addGroup = function (group) {
var name = group["name"];
var description = group["description"];
//URL: POST https://localhost:9443/devicecloud/group_manager/group
endPoint = deviceCloudService + "/group";
data = {"name": name, "username": user.username, "description": description};
return post(endPoint, data, "json");
};
groupModule.updateGroup = function (groupId, group) {
var name = group["name"];
var description = group["description"];
//URL: PUT https://localhost:9443/devicecloud/group_manager/group/id/{groupId}
endPoint = deviceCloudService + "/group/id/" + groupId;
data = {"name": name, "username": user.username, "description": description};
return put(endPoint, data, "json");
};
groupModule.removeGroup = function (groupId) {
//URL: DELETE https://localhost:9443/devicecloud/group_manager/group/id/{groupId}
endPoint = deviceCloudService + "/group/id/" + groupId + "?username=" + user.username;
return del(endPoint, {}, "json");
};
groupModule.getGroup = function (groupId) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}
endPoint = deviceCloudService + "/group/id/" + groupId;
data = {"username": user.username};
return get(endPoint, data, "json");
};
groupModule.findGroups = function (name) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/name/{name}
endPoint = deviceCloudService + "/group/name/" + name;
data = {"username": user.username};
return get(endPoint, data, "json");
};
groupModule.getGroups = function () {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/all
endPoint = deviceCloudService + "/group/user/" + user.username + "/all";
data = {"username": user.username};
return get(endPoint, data, "json");
};
groupModule.getGroupCount = function () { groupModule.getGroupCount = function () {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/all/count endPoint = deviceCloudService + "/groups/count?userName=" + user.username;
endPoint = deviceCloudService + "/group/user/" + user.username + "/all/count"; return serviceInvokers.XMLHttp.get(
data = {"username": user.username}; endPoint, function (responsePayload) {
response = get(endPoint, data, "json"); return responsePayload;
if (response) {
return response.data;
} else {
return -1;
} }
}; ,
function (responsePayload) {
groupModule.shareGroup = function (groupId, shareUser, role) { log.error(responsePayload);
//URL: POST https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/share return -1;
endPoint = deviceCloudService + "/group/id/" + groupId + "/share";
data = {"username": user.username, "shareUser": shareUser, "role": role};
return post(endPoint, data, "json");
};
groupModule.unshareGroup = function (groupId, shareUser, role) {
//URL: POST https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/unshare
endPoint = deviceCloudService + "/group/id/" + groupId + "/unshare";
data = {"username": user.username, "unShareUser": unShareUser, "role": role};
return post(endPoint, data, "json");
};
groupModule.addRole = function (groupId, role, permissions) {
//URL: POST https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/role
endPoint = deviceCloudService + "/group/id/" + groupId + "/role";
data = {"username": user.username, "permissions": permissions, "role": role};
return post(endPoint, data, "json");
};
groupModule.deleteRole = function (groupId, role) {
//URL: DELETE https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/role
endPoint = deviceCloudService + "/group/id/" + groupId + "/role/" + role;
return del(endPoint, {}, "json");
};
groupModule.getGroupRoles = function (groupId) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/role/all
endPoint = deviceCloudService + "/group/id/" + groupId + "/role/all";
data = {"username": user.username};
return get(endPoint, data, "json");
};
groupModule.getUserRoles = function (groupId, userId) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/{user}/role/all
endPoint = deviceCloudService + "/group/id/" + groupId + "/" + userId + "/role/all";
data = {"username": user.username};
return get(endPoint, data, "json");
};
groupModule.getRoleMapping = function (groupId, userId) {
var allRoles = groupModule.getGroupRoles(groupId).data;
var userRolesObj = groupModule.getUserRoles(groupId, userId);
var userRoles = userRolesObj.data;
var roleMap = [];
for (var role in allRoles) {
var objRole = {"role": allRoles[role], "assigned": false};
for (var usrRole in userRoles) {
if (allRoles[role] == userRoles[usrRole]) {
objRole.assigned = true;
break;
}
}
roleMap.push(objRole);
}
var result = {};
result.data = roleMap;
result.xhr = userRolesObj.xhr;
return result;
};
groupModule.setRoleMapping = function (groupId, userId, roleMap) {
var result;
for (var role in roleMap) {
if (roleMap[role].assigned == true) {
result = groupModule.shareGroup(groupId,userId,roleMap[role].role);
} else {
result = groupModule.unshareGroup(groupId,userId,roleMap[role].role);
}
}
return result;
};
groupModule.getUsers = function (groupId) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/user/all
endPoint = deviceCloudService + "/group/id/" + groupId + "/user/all";
data = {"username": user.username};
return get(endPoint, data, "json");
};
groupModule.getDevices = function (groupId) {
var result = groupModule.getGroup(groupId);
var group = result.data;
if (group) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/device/all
endPoint = deviceCloudService + "/group/id/" + groupId + "/device/all";
data = {"username": user.username};
result = get(endPoint, data, "json");
} }
return result; );
};
groupModule.assignDevice = function (groupId, deviceId, deviceType) {
//URL: GET https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/device/assign
endPoint = deviceCloudService + "/group/id/" + groupId + "/device/assign";
data = {"username": user.username, "deviceId": deviceId, "deviceType": deviceType};
return put(endPoint, data, "json");
}; };
}(groupModule)); }(groupModule));

@ -53,7 +53,7 @@ var userModule = function () {
throw constants.ERRORS.USER_NOT_FOUND; throw constants.ERRORS.USER_NOT_FOUND;
} }
return carbonUser; return carbonUser;
} };
/** /**
* Only GET method is implemented for now since there are no other type of methods used this method. * Only GET method is implemented for now since there are no other type of methods used this method.
@ -436,7 +436,7 @@ var userModule = function () {
} finally { } finally {
utility.endTenantFlow(); utility.endTenantFlow();
} }
} };
/* /*
@NewlyAdded @NewlyAdded
@ -629,44 +629,44 @@ var userModule = function () {
publicMethods.getUIPermissions = function () { publicMethods.getUIPermissions = function () {
var permissions = {}; var permissions = {};
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/devices/list") || if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/devices/list") ||
publicMethods.isAuthorized("/permission/admin/device-mgt/user/devices/list")) { publicMethods.isAuthorized("/permission/admin/device-mgt/user/devices/list")) {
permissions["LIST_DEVICES"] = true; permissions["LIST_DEVICES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/list")) {
permissions["LIST_GROUPS"] = true; permissions["LIST_GROUPS"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/users/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/users/list")) {
permissions["LIST_USERS"] = true; permissions["LIST_USERS"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/roles/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/roles/list")) {
permissions["LIST_ROLES"] = true; permissions["LIST_ROLES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/policies/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/policies/list")) {
permissions["LIST_POLICIES"] = true; permissions["LIST_POLICIES"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/groups/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/groups/add")) {
permissions["ADD_GROUP"] = true; permissions["ADD_GROUP"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/users/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/users/add")) {
permissions["ADD_USER"] = true; permissions["ADD_USER"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/users/remove")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/users/remove")) {
permissions["REMOVE_USER"] = true; permissions["REMOVE_USER"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/roles/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/roles/add")) {
permissions["ADD_ROLE"] = true; permissions["ADD_ROLE"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/policies/add")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/policies/add")) {
permissions["ADD_POLICY"] = true; permissions["ADD_POLICY"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/policies/priority")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/policies/priority")) {
permissions["CHANGE_POLICY_PRIORITY"] = true; permissions["CHANGE_POLICY_PRIORITY"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/dashboard/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/dashboard/view")) {
permissions["VIEW_DASHBOARD"] = true; permissions["VIEW_DASHBOARD"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/admin/platform-configs/view")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/emm-admin/platform-configs/view")) {
permissions["TENANT_CONFIGURATION"] = true; permissions["TENANT_CONFIGURATION"] = true;
} }
if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/devices/list")) { if (publicMethods.isAuthorized("/permission/admin/device-mgt/user/devices/list")) {

@ -10,5 +10,177 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{unit "cdmf.unit.dashboard"}} <div class="wr-content">
{{#if permissions.VIEW_DASHBOARD}}
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Devices</div>
<div>
<div class="tile-icon"><i class="fw fw-mobile"></i></div>
<div class="tile-stats">
<span id="device-count">{{device_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/devices">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/device/enroll">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Groups</div>
<div>
<div class="tile-icon"><i class="fw fw-grouping"></i></div>
<div class="tile-stats">
<span id="group-count">{{group_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/groups">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/group/add">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Users</div>
<div>
<div class="tile-icon"><i class="fw fw-user"></i></div>
<div class="tile-stats">
<span id="user-count">{{user_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/users">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/user/add">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Policies</div>
<div>
<div class="tile-icon"><i class="fw fw-policy"></i></div>
<div class="tile-stats">
<span id="policy-count">{{policy_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/policies">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/policy/add">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Roles</div>
<div>
<div class="tile-icon"><i class="fw fw-bookmark"></i></div>
<div class="tile-stats">
<span id="role-count">{{role_count}}</span>
<span class="tile-stats-free">
<a id="device-count-view-btn" href="{{@app.context}}/roles">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/roles/add-role">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
{{else}}
Permission denied
{{/if}}
</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}}

@ -35,7 +35,7 @@ function onRequest(context) {
var groupModule = require("/app/modules/group.js").groupModule; var groupModule = require("/app/modules/group.js").groupModule;
var policyModule = require("/app/modules/policy.js").policyModule; var policyModule = require("/app/modules/policy.js").policyModule;
page.device_count = deviceModule.getOwnDevicesCount(); page.device_count = deviceModule.getAllDevicesCount();
page.group_count = groupModule.getGroupCount(); page.group_count = groupModule.getGroupCount();
page.user_count = userModule.getUsers()["content"].length; page.user_count = userModule.getUsers()["content"].length;
page.policy_count = policyModule.getAllPolicies()["content"].length; page.policy_count = policyModule.getAllPolicies()["content"].length;

@ -1,173 +0,0 @@
<div class="wr-content">
{{#if permissions.VIEW_DASHBOARD}}
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Devices</div>
<div>
<div class="tile-icon"><i class="fw fw-mobile"></i></div>
<div class="tile-stats">
<span id="device-count">{{device_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/devices">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/device/enroll">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Groups</div>
<div>
<div class="tile-icon"><i class="fw fw-grouping"></i></div>
<div class="tile-stats">
<span id="group-count">{{group_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/groups">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/group/add">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Users</div>
<div>
<div class="tile-icon"><i class="fw fw-user"></i></div>
<div class="tile-stats">
<span id="user-count">{{user_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/users">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/user/add">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Policies</div>
<div>
<div class="tile-icon"><i class="fw fw-policy"></i></div>
<div class="tile-stats">
<span id="policy-count">{{policy_count}}</span>
<span class="tile-stats-free">
<a href="{{@app.context}}/policies">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/policy/add">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row wr-stats-board">
<div class="col-md-4">
<div class="wr-stats-board-tile">
<div class="tile-name">Roles</div>
<div>
<div class="tile-icon"><i class="fw fw-bookmark"></i></div>
<div class="tile-stats">
<span id="role-count">{{role_count}}</span>
<span class="tile-stats-free">
<a id="device-count-view-btn" href="{{@app.context}}/roles">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
<a href="{{@app.context}}/roles/add-role">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add
</a>
</span>
</div>
</div>
</div>
</div>
</div>
{{else}}
Permission denied
{{/if}}
</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>
Loading…
Cancel
Save