mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'release-2.0.x' of https://github.com/wso2/carbon-device-mgt into release-2.0.x
This commit is contained in:
commit
b20a2e0997
@ -119,7 +119,7 @@ public class ApiPermissionFilter implements Filter {
|
|||||||
.getThreadLocalCarbonContext().getTenantId());
|
.getThreadLocalCarbonContext().getTenantId());
|
||||||
return userRealm.getAuthorizationManager().isUserAuthorized(username, permission, action);
|
return userRealm.getAuthorizationManager().isUserAuthorized(username, permission, action);
|
||||||
} catch (UserStoreException e) {
|
} catch (UserStoreException e) {
|
||||||
String errorMsg = String.format("Unable to authorize the user : %s", username, e);
|
String errorMsg = String.format("Unable to authorize the user : %s", username);
|
||||||
log.error(errorMsg, e);
|
log.error(errorMsg, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -288,7 +288,7 @@ public class APIPublisherUtil {
|
|||||||
log.debug("'managed-api-transports' attribute is not configured. Therefore using the default, " +
|
log.debug("'managed-api-transports' attribute is not configured. Therefore using the default, " +
|
||||||
"which is 'https'");
|
"which is 'https'");
|
||||||
}
|
}
|
||||||
transports = "https";
|
transports = "https,http";
|
||||||
}
|
}
|
||||||
apiConfig.setTransports(transports);
|
apiConfig.setTransports(transports);
|
||||||
|
|
||||||
|
|||||||
@ -83,11 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
|
|||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||||
try {
|
try {
|
||||||
Type jsonType = null;
|
getGson().toJson(object, type, writer);
|
||||||
if (type.equals(type)) {
|
|
||||||
jsonType = type;
|
|
||||||
}
|
|
||||||
getGson().toJson(object, jsonType, writer);
|
|
||||||
} finally {
|
} finally {
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,11 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
|
|||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||||
try {
|
try {
|
||||||
Type jsonType = null;
|
getGson().toJson(object, type, writer);
|
||||||
if (type.equals(type)) {
|
|
||||||
jsonType = type;
|
|
||||||
}
|
|
||||||
getGson().toJson(object, jsonType, writer);
|
|
||||||
} finally {
|
} finally {
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,6 +95,7 @@
|
|||||||
<Import-Package>
|
<Import-Package>
|
||||||
javax.naming,
|
javax.naming,
|
||||||
javax.sql,
|
javax.sql,
|
||||||
|
javax.xml,
|
||||||
javax.xml.bind,
|
javax.xml.bind,
|
||||||
javax.xml.bind.annotation,
|
javax.xml.bind.annotation,
|
||||||
javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}",
|
javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}",
|
||||||
|
|||||||
@ -21,8 +21,10 @@ package org.wso2.carbon.device.mgt.extensions.device.type.deployer.util;
|
|||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.exception.DeviceTypeConfigurationException;
|
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.exception.DeviceTypeConfigurationException;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,8 +36,12 @@ public class DeviceTypeConfigUtil {
|
|||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true);
|
||||||
try {
|
try {
|
||||||
|
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
||||||
return docBuilder.parse(file);
|
return docBuilder.parse(file);
|
||||||
|
} catch (ParserConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new DeviceTypeConfigurationException("Error occurred while parsing file, while converting " +
|
throw new DeviceTypeConfigurationException("Error occurred while parsing file, while converting " +
|
||||||
"to a org.w3c.dom.Document", e);
|
"to a org.w3c.dom.Document", e);
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.mgt.jaxrs.beans;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.beans.BasePaginatedResult;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DeviceToGroupsAssignment extends BasePaginatedResult {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "List of device group ids.")
|
||||||
|
@JsonProperty("deviceGroupIds")
|
||||||
|
private List<Integer> deviceGroupIds = new ArrayList<>();
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "Device identifier of the device needed to be assigned with group")
|
||||||
|
@JsonProperty("deviceIdentifier")
|
||||||
|
private DeviceIdentifier deviceIdentifier;
|
||||||
|
|
||||||
|
|
||||||
|
public List<Integer> getDeviceGroupIds() {
|
||||||
|
return deviceGroupIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceGroupIds(List<Integer> deviceGroupIds) {
|
||||||
|
this.deviceGroupIds = deviceGroupIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeviceIdentifier getDeviceIdentifier() {
|
||||||
|
return deviceIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceIdentifier(DeviceIdentifier deviceIdentifier) {
|
||||||
|
this.deviceIdentifier = deviceIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -83,11 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, Messag
|
|||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||||
try {
|
try {
|
||||||
Type jsonType = null;
|
getGson().toJson(object, type, writer);
|
||||||
if (type.equals(type)) {
|
|
||||||
jsonType = type;
|
|
||||||
}
|
|
||||||
getGson().toJson(object, jsonType, writer);
|
|
||||||
} finally {
|
} finally {
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|||||||
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
|
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceToGroupsAssignment;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList;
|
||||||
|
|
||||||
@ -774,4 +775,115 @@ public interface GroupManagementService {
|
|||||||
required = true)
|
required = true)
|
||||||
@Valid List<DeviceIdentifier> deviceIdentifiers);
|
@Valid List<DeviceIdentifier> deviceIdentifiers);
|
||||||
|
|
||||||
|
@Path("/device/assign")
|
||||||
|
@POST
|
||||||
|
@ApiOperation(
|
||||||
|
produces = MediaType.APPLICATION_JSON,
|
||||||
|
httpMethod = HTTPConstants.HEADER_POST,
|
||||||
|
value = "Assign devices to groups",
|
||||||
|
notes = "Add existing device to device groups.",
|
||||||
|
tags = "Device Group Management",
|
||||||
|
authorizations = {
|
||||||
|
@Authorization(
|
||||||
|
value = "permission",
|
||||||
|
scopes = {@AuthorizationScope(scope = "/device-mgt/groups/devices/add",
|
||||||
|
description = "Add devices")}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "OK. \n Successfully assign the device to groups.",
|
||||||
|
responseHeaders = {
|
||||||
|
@ResponseHeader(
|
||||||
|
name = "Content-Type",
|
||||||
|
description = "The content type of the body"),
|
||||||
|
@ResponseHeader(
|
||||||
|
name = "ETag",
|
||||||
|
description = "Entity Tag of the response resource.\n" +
|
||||||
|
"Used by caches, or in conditional requests."),
|
||||||
|
@ResponseHeader(
|
||||||
|
name = "Last-Modified",
|
||||||
|
description = "Date and time the resource has been modified the last time.\n" +
|
||||||
|
"Used by caches, or in conditional requests."),
|
||||||
|
}),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 304,
|
||||||
|
message = "Not Modified. \n Empty body because the client has already the latest version of " +
|
||||||
|
"the requested resource."),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 404,
|
||||||
|
message = "No groups found.",
|
||||||
|
response = ErrorResponse.class),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 406,
|
||||||
|
message = "Not Acceptable.\n The requested media type is not supported."),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 500,
|
||||||
|
message = "Internal Server Error. \n Server error occurred while adding devices to the group.",
|
||||||
|
response = ErrorResponse.class)
|
||||||
|
})
|
||||||
|
Response updateDeviceAssigningToGroups(
|
||||||
|
@ApiParam(
|
||||||
|
name = "deviceToGroupsAssignment",
|
||||||
|
value = "Device to groups assignment",
|
||||||
|
required = true)
|
||||||
|
@Valid DeviceToGroupsAssignment deviceToGroupsAssignment);
|
||||||
|
|
||||||
|
@Path("/device")
|
||||||
|
@GET
|
||||||
|
@ApiOperation(
|
||||||
|
produces = MediaType.APPLICATION_JSON,
|
||||||
|
httpMethod = HTTPConstants.HEADER_GET,
|
||||||
|
value = "List of groups that have the device",
|
||||||
|
notes = "List of groups that have the device.",
|
||||||
|
tags = "Device Group Management",
|
||||||
|
authorizations = {
|
||||||
|
@Authorization(
|
||||||
|
value = "permission",
|
||||||
|
scopes = {@AuthorizationScope(scope = "/device-mgt/groups/devices/view",
|
||||||
|
description = "Add devices")}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@ApiResponses(value = {
|
||||||
|
@ApiResponse(code = 200, message = "OK.",
|
||||||
|
responseHeaders = {
|
||||||
|
@ResponseHeader(
|
||||||
|
name = "Content-Type",
|
||||||
|
description = "The content type of the body"),
|
||||||
|
@ResponseHeader(
|
||||||
|
name = "ETag",
|
||||||
|
description = "Entity Tag of the response resource.\n" +
|
||||||
|
"Used by caches, or in conditional requests."),
|
||||||
|
@ResponseHeader(
|
||||||
|
name = "Last-Modified",
|
||||||
|
description = "Date and time the resource has been modified the last time.\n" +
|
||||||
|
"Used by caches, or in conditional requests."),
|
||||||
|
}),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 304,
|
||||||
|
message = "Not Modified. \n Empty body because the client has already the latest version of " +
|
||||||
|
"the requested resource."),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 404,
|
||||||
|
message = "No groups found.",
|
||||||
|
response = ErrorResponse.class),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 406,
|
||||||
|
message = "Not Acceptable.\n The requested media type is not supported."),
|
||||||
|
@ApiResponse(
|
||||||
|
code = 500,
|
||||||
|
message = "Internal Server Error. \n Server error occurred.",
|
||||||
|
response = ErrorResponse.class)
|
||||||
|
})
|
||||||
|
Response getGroups(
|
||||||
|
@ApiParam(
|
||||||
|
name = "deviceId",
|
||||||
|
value = "Id of the device.")
|
||||||
|
@QueryParam("deviceId") String deviceId,
|
||||||
|
@ApiParam(
|
||||||
|
name = "deviceType",
|
||||||
|
value = "Type of the device.")
|
||||||
|
@QueryParam("deviceType") String deviceType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.CarbonConstants;
|
||||||
import org.wso2.carbon.context.CarbonContext;
|
import org.wso2.carbon.context.CarbonContext;
|
||||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
@ -35,12 +36,14 @@ import org.wso2.carbon.device.mgt.common.group.mgt.RoleDoesNotExistException;
|
|||||||
import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService;
|
import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceToGroupsAssignment;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.service.api.GroupManagementService;
|
import org.wso2.carbon.device.mgt.jaxrs.service.api.GroupManagementService;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
|
import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GroupManagementServiceImpl implements GroupManagementService {
|
public class GroupManagementServiceImpl implements GroupManagementService {
|
||||||
@ -243,7 +246,8 @@ public class GroupManagementServiceImpl implements GroupManagementService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Response removeDevicesFromGroup(int groupId, List<DeviceIdentifier> deviceIdentifiers) {
|
@Override
|
||||||
|
public Response removeDevicesFromGroup(int groupId, List<DeviceIdentifier> deviceIdentifiers) {
|
||||||
try {
|
try {
|
||||||
DeviceMgtAPIUtils.getGroupManagementProviderService().removeDevice(groupId, deviceIdentifiers);
|
DeviceMgtAPIUtils.getGroupManagementProviderService().removeDevice(groupId, deviceIdentifiers);
|
||||||
return Response.status(Response.Status.OK).build();
|
return Response.status(Response.Status.OK).build();
|
||||||
@ -256,4 +260,45 @@ public class GroupManagementServiceImpl implements GroupManagementService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response updateDeviceAssigningToGroups(DeviceToGroupsAssignment deviceToGroupsAssignment) {
|
||||||
|
try {
|
||||||
|
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
|
||||||
|
deviceIdentifiers.add(deviceToGroupsAssignment.getDeviceIdentifier());
|
||||||
|
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
|
||||||
|
List<DeviceGroup> deviceGroups = service.getGroups(deviceToGroupsAssignment.getDeviceIdentifier());
|
||||||
|
for (DeviceGroup group : deviceGroups) {
|
||||||
|
Integer groupId = group.getGroupId();
|
||||||
|
if (deviceToGroupsAssignment.getDeviceGroupIds().contains(groupId)) {
|
||||||
|
deviceToGroupsAssignment.getDeviceGroupIds().remove(groupId);
|
||||||
|
} else if (!CarbonConstants.REGISTRY_SYSTEM_USERNAME.equals(group.getOwner())) {
|
||||||
|
DeviceMgtAPIUtils.getGroupManagementProviderService().removeDevice(groupId, deviceIdentifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int groupId : deviceToGroupsAssignment.getDeviceGroupIds()) {
|
||||||
|
DeviceMgtAPIUtils.getGroupManagementProviderService().addDevices(groupId, deviceIdentifiers);
|
||||||
|
}
|
||||||
|
return Response.status(Response.Status.OK).build();
|
||||||
|
} catch (GroupManagementException e) {
|
||||||
|
String msg = "Error occurred while assigning device to groups.";
|
||||||
|
log.error(msg, e);
|
||||||
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||||
|
} catch (DeviceNotFoundException e) {
|
||||||
|
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response getGroups(String deviceId, String deviceType) {
|
||||||
|
try {
|
||||||
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType);
|
||||||
|
List<DeviceGroup> deviceGroups = DeviceMgtAPIUtils.getGroupManagementProviderService().getGroups(deviceIdentifier);
|
||||||
|
return Response.status(Response.Status.OK).entity(deviceGroups).build();
|
||||||
|
} catch (GroupManagementException e) {
|
||||||
|
String msg = "Error occurred while removing devices from group.";
|
||||||
|
log.error(msg, e);
|
||||||
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -370,7 +370,7 @@ public class DeviceInfo implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdatedTime() {
|
public Date getUpdatedTime() {
|
||||||
if(updatedTime.equals(null)){
|
if(updatedTime == null){
|
||||||
updatedTime = new Date();
|
updatedTime = new Date();
|
||||||
}
|
}
|
||||||
return updatedTime;
|
return updatedTime;
|
||||||
|
|||||||
@ -137,7 +137,7 @@ public class DeviceLocation implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Date getUpdatedTime() {
|
public Date getUpdatedTime() {
|
||||||
if(updatedTime.equals(null)){
|
if(updatedTime == null ){
|
||||||
updatedTime = new Date();
|
updatedTime = new Date();
|
||||||
}
|
}
|
||||||
return updatedTime;
|
return updatedTime;
|
||||||
|
|||||||
@ -48,6 +48,10 @@ public class NotificationContext {
|
|||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProperties(Map<String, String> propertiesMap) {
|
||||||
|
properties = propertiesMap;
|
||||||
|
}
|
||||||
|
|
||||||
public Operation getOperation() {
|
public Operation getOperation() {
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,9 +121,9 @@ if (uriMatcher.match("/{context}/api/user/authenticate")) {
|
|||||||
} else {
|
} else {
|
||||||
userRoles = String(addUserFormData.userRoles).split(",");
|
userRoles = String(addUserFormData.userRoles).split(",");
|
||||||
}
|
}
|
||||||
if (username.length < devicemgtProps.usernameLength) {
|
if (username.length < devicemgtProps.userValidationConfig.usernameLength) {
|
||||||
log.error("Username Must be between 1 and " + devicemgtProps.usernameLength + " characters long");
|
log.error("Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long");
|
||||||
result = "Username Must be between 1 and " + devicemgtProps.usernameLength + " characters long";
|
result = "Username Must be between 1 and " + devicemgtProps.userValidationConfig.usernameLength + " characters long";
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
result = userModule.addUser(username, firstname, lastname, emailAddress, userRoles);
|
result = userModule.addUser(username, firstname, lastname, emailAddress, userRoles);
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"appContext": "/devicemgt/",
|
"appContext": "/devicemgt/",
|
||||||
"webAgentContext" : "/emm-web-agent/",
|
|
||||||
"apiContext": "api",
|
|
||||||
"httpsURL" : "%https.ip%",
|
"httpsURL" : "%https.ip%",
|
||||||
"httpURL" : "%http.ip%",
|
"httpURL" : "%http.ip%",
|
||||||
"httpsWebURL" : "%https.ip%",
|
"httpsWebURL" : "%https.ip%",
|
||||||
@ -15,7 +13,7 @@
|
|||||||
"iOSConfigRoot" : "%https.ip%/ios-enrollment/",
|
"iOSConfigRoot" : "%https.ip%/ios-enrollment/",
|
||||||
"iOSAPIRoot" : "%https.ip%/ios/",
|
"iOSAPIRoot" : "%https.ip%/ios/",
|
||||||
"adminService": "%https.ip%",
|
"adminService": "%https.ip%",
|
||||||
"apimgt-gateway": false,
|
"gatewayEnabled": false,
|
||||||
"oauthProvider": {
|
"oauthProvider": {
|
||||||
"appRegistration": {
|
"appRegistration": {
|
||||||
"appType": "webapp",
|
"appType": "webapp",
|
||||||
@ -32,19 +30,8 @@
|
|||||||
"adminUser":"admin@carbon.super",
|
"adminUser":"admin@carbon.super",
|
||||||
"adminUserTenantId":"-1234",
|
"adminUserTenantId":"-1234",
|
||||||
"adminRole":"admin",
|
"adminRole":"admin",
|
||||||
"usernameLength":30,
|
|
||||||
"pageSize":10,
|
|
||||||
"ssoConfiguration" : {
|
|
||||||
"enabled" : false,
|
|
||||||
"issuer" : "devicemgt",
|
|
||||||
"appName" : "devicemgt",
|
|
||||||
"identityProviderURL" : "%https.ip%/sso/samlsso.jag",
|
|
||||||
"responseSigningEnabled" : "true",
|
|
||||||
"keyStorePassword" : "wso2carbon",
|
|
||||||
"identityAlias" : "wso2carbon",
|
|
||||||
"keyStoreName" : "/repository/resources/security/wso2carbon.jks"
|
|
||||||
},
|
|
||||||
"userValidationConfig" : {
|
"userValidationConfig" : {
|
||||||
|
"usernameLength":30,
|
||||||
"usernameJSRegEx" : "^[\\S]{3,30}$",
|
"usernameJSRegEx" : "^[\\S]{3,30}$",
|
||||||
"usernameRegExViolationErrorMsg" : "Provided username is invalid.",
|
"usernameRegExViolationErrorMsg" : "Provided username is invalid.",
|
||||||
"usernameHelpMsg" : "Should be in minimum 3 characters long and do not include any whitespaces.",
|
"usernameHelpMsg" : "Should be in minimum 3 characters long and do not include any whitespaces.",
|
||||||
|
|||||||
@ -105,4 +105,33 @@ var groupModule = {};
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
groupModule.getGroup = function (groupId) {
|
||||||
|
return serviceInvokers.XMLHttp.get(
|
||||||
|
deviceServiceEndpoint + "/groups/id/" + groupId, function (responsePayload) {
|
||||||
|
return JSON.parse(responsePayload.responseText);
|
||||||
|
},
|
||||||
|
function (responsePayload) {
|
||||||
|
log.error(responsePayload);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
groupModule.getRolesOfGroup = function (groupId) {
|
||||||
|
return serviceInvokers.XMLHttp.get(
|
||||||
|
deviceServiceEndpoint + "/groups/id/" + groupId + "/roles", function (responsePayload) {
|
||||||
|
var data = JSON.parse(responsePayload.responseText);
|
||||||
|
if(data) {
|
||||||
|
return data.roles;
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (responsePayload) {
|
||||||
|
log.error(responsePayload);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
}(groupModule));
|
}(groupModule));
|
||||||
|
|||||||
@ -138,7 +138,7 @@ var handlers = function () {
|
|||||||
"client credentials to session context. No username of logged in user is found as " +
|
"client credentials to session context. No username of logged in user is found as " +
|
||||||
"input - setUpEncodedTenantBasedClientAppCredentials(x)");
|
"input - setUpEncodedTenantBasedClientAppCredentials(x)");
|
||||||
} else {
|
} else {
|
||||||
if (devicemgtProps["apimgt-gateway"]) {
|
if (devicemgtProps["gatewayEnabled"]) {
|
||||||
var tenantBasedClientAppCredentials = tokenUtil.getTenantBasedClientAppCredentials(username);
|
var tenantBasedClientAppCredentials = tokenUtil.getTenantBasedClientAppCredentials(username);
|
||||||
if (!tenantBasedClientAppCredentials) {
|
if (!tenantBasedClientAppCredentials) {
|
||||||
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
|
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " +
|
||||||
@ -176,7 +176,7 @@ var handlers = function () {
|
|||||||
"client credentials to session context. No username of logged in user is found as " +
|
"client credentials to session context. No username of logged in user is found as " +
|
||||||
"input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
|
"input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)");
|
||||||
} else {
|
} else {
|
||||||
if (devicemgtProps["apimgt-gateway"]) {
|
if (devicemgtProps["gatewayEnabled"]) {
|
||||||
var tenantBasedWebSocketClientAppCredentials
|
var tenantBasedWebSocketClientAppCredentials
|
||||||
= tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
|
= tokenUtil.getTenantBasedWebSocketClientAppCredentials(username);
|
||||||
if (!tenantBasedWebSocketClientAppCredentials) {
|
if (!tenantBasedWebSocketClientAppCredentials) {
|
||||||
|
|||||||
@ -33,7 +33,7 @@ function onRequest(context) {
|
|||||||
viewModel["roles"] = response["content"];
|
viewModel["roles"] = response["content"];
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel["charLimit"] = mdmProps["usernameLength"];
|
viewModel["charLimit"] = mdmProps["userValidationConfig"]["usernameLength"];
|
||||||
viewModel["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"];
|
viewModel["usernameJSRegEx"] = mdmProps["userValidationConfig"]["usernameJSRegEx"];
|
||||||
viewModel["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"];
|
viewModel["usernameHelpText"] = mdmProps["userValidationConfig"]["usernameHelpMsg"];
|
||||||
viewModel["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
viewModel["usernameRegExViolationErrorMsg"] = mdmProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
||||||
|
|||||||
@ -171,7 +171,7 @@
|
|||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<!--suppress HtmlUnknownTarget -->
|
<!--suppress HtmlUnknownTarget -->
|
||||||
<a href="{{@app.context}}/roles/add-role">
|
<a href="{{@app.context}}/role/add">
|
||||||
<span class="fw-stack">
|
<span class="fw-stack">
|
||||||
<i class="fw fw-ring fw-stack-2x"></i>
|
<i class="fw fw-ring fw-stack-2x"></i>
|
||||||
<i class="fw fw-add fw-stack-1x"></i>
|
<i class="fw fw-add fw-stack-1x"></i>
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
<i class="icon fw fw-home"></i>
|
<i class="icon fw fw-home"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{#if groupName}}
|
{{#if group}}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{@app.context}}/groups">
|
<a href="{{@app.context}}/groups">
|
||||||
Groups
|
Groups
|
||||||
@ -34,7 +34,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#">
|
<a href="#">
|
||||||
{{groupName}}
|
{{group.name}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -47,7 +47,7 @@
|
|||||||
{{/zone}}
|
{{/zone}}
|
||||||
|
|
||||||
{{#zone "navbarActions"}}
|
{{#zone "navbarActions"}}
|
||||||
{{#if groupName}}
|
{{#if group}}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{@app.context}}/devices" class="cu-btn">
|
<a href="{{@app.context}}/devices" class="cu-btn">
|
||||||
<span class="icon fw-stack">
|
<span class="icon fw-stack">
|
||||||
@ -57,6 +57,15 @@
|
|||||||
Assign from My Devices
|
Assign from My Devices
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{@app.context}}/group/{{group.id}}/analytics" class="cu-btn">
|
||||||
|
<span class="icon fw-stack">
|
||||||
|
<i class="fw fw-statistics fw-stack-1x"></i>
|
||||||
|
<i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
</span>
|
||||||
|
View Analytics
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if permissions.enroll}}
|
{{#if permissions.enroll}}
|
||||||
<li>
|
<li>
|
||||||
@ -73,6 +82,55 @@
|
|||||||
{{/zone}}
|
{{/zone}}
|
||||||
|
|
||||||
{{#zone "content"}}
|
{{#zone "content"}}
|
||||||
|
{{#if group}}
|
||||||
|
<h1 class="page-sub-title">
|
||||||
|
{{group.name}} group
|
||||||
|
</h1>
|
||||||
|
<div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;">
|
||||||
|
<div class="media">
|
||||||
|
<div id="device_overview">
|
||||||
|
<div class="media-left col-lg-1">
|
||||||
|
<div class="icon">
|
||||||
|
<img src="/devicemgt/public/cdmf.page.groups/images/group-icon.png" style="background-color: #11375b; height: 152px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="media-body asset-desc add-padding-left-5x">
|
||||||
|
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">
|
||||||
|
Overview
|
||||||
|
</div>
|
||||||
|
<table class="table table-responsive table-striped" id="members" style="margin-bottom: 0px;">
|
||||||
|
<tbody>
|
||||||
|
<tr role="row" class="even">
|
||||||
|
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Owner</td>
|
||||||
|
<td style="padding:10px 15px;">{{group.owner}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr role="row" class="odd">
|
||||||
|
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Shared with roles</td>
|
||||||
|
<td style="padding:10px 15px;">
|
||||||
|
{{#each roles}}
|
||||||
|
{{this}}<br/>
|
||||||
|
{{/each}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr role="row" class="even">
|
||||||
|
<td class="sorting_1" style="padding:10px 15px;width: 15%;">Device Count</td>
|
||||||
|
<td style="padding:10px 15px;">{{deviceCount}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr role="row" class="odd">
|
||||||
|
<td class="sorting_1" style="padding:10px 15px;width: 15%;">Description</td>
|
||||||
|
<td style="padding:10px 15px;">{{group.description}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<h1 class="page-sub-title add-margin-top-5x">
|
||||||
|
Devices in {{group.name}} group
|
||||||
|
</h1>
|
||||||
|
{{/if}}
|
||||||
<div class="wr-device-list row">
|
<div class="wr-device-list row">
|
||||||
<div class="wr-hidden-operations wr-advance-operations"></div>
|
<div class="wr-hidden-operations wr-advance-operations"></div>
|
||||||
<div class="col-md-12 wr-page-content">
|
<div class="col-md-12 wr-page-content">
|
||||||
@ -82,7 +140,6 @@
|
|||||||
{{#if deviceCount}}
|
{{#if deviceCount}}
|
||||||
<div id="loading-content" class="col-centered">
|
<div id="loading-content" class="col-centered">
|
||||||
<i class="fw fw-settings fw-spin fw-2x"></i>
|
<i class="fw fw-settings fw-spin fw-2x"></i>
|
||||||
|
|
||||||
Loading devices . . .
|
Loading devices . . .
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
@ -157,7 +214,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<h3 class="text-muted">
|
<h3 class="text-muted">
|
||||||
You don't have any device
|
You don't have any device
|
||||||
{{#if groupName}}
|
{{#if group}}
|
||||||
assigned to this group
|
assigned to this group
|
||||||
{{else}}
|
{{else}}
|
||||||
enrolled
|
enrolled
|
||||||
@ -165,7 +222,7 @@
|
|||||||
at the moment.
|
at the moment.
|
||||||
</h3>
|
</h3>
|
||||||
<h3>
|
<h3>
|
||||||
{{#if groupName}}
|
{{#if group}}
|
||||||
<!--suppress HtmlUnknownTarget -->
|
<!--suppress HtmlUnknownTarget -->
|
||||||
<a href="{{@app.context}}/devices" class="btn-operations btn-default">
|
<a href="{{@app.context}}/devices" class="btn-operations btn-default">
|
||||||
<span class="fw-stack">
|
<span class="fw-stack">
|
||||||
@ -208,20 +265,16 @@
|
|||||||
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
|
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
|
||||||
<i class="icon fw fw-error"></i><span></span>
|
<i class="icon fw fw-error"></i><span></span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div id="user-groups">Loading...</div>
|
||||||
<h4>
|
|
||||||
Please select group
|
|
||||||
<br>
|
|
||||||
<div id="user-groups">Loading...</div>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a href="#" id="group-device-yes-link" class="btn-operations">
|
<a href="{{@app.context}}/group/add" id="group-add-link" class="btn-operations">
|
||||||
Assign
|
Add device group
|
||||||
|
</a>
|
||||||
|
<a href="#" id="group-device-yes-link" class="btn-operations">
|
||||||
|
Update assignment
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="#" id="group-device-cancel-link" class="btn-operations btn-default">
|
<a href="#" id="group-device-cancel-link" class="btn-operations btn-default">
|
||||||
Cancel
|
Cancel
|
||||||
</a>
|
</a>
|
||||||
@ -233,17 +286,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 col-centered">
|
<div class="col-md-3 col-centered">
|
||||||
<h3>Device was successfully associated with group.</h3>
|
<h3>Device associations updated.</h3>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="group-deassociate-device-200-content" class="hide">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 col-centered">
|
|
||||||
<h3>Device was successfully removed from group.</h3>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -20,15 +20,19 @@ function onRequest(context) {
|
|||||||
var constants = require("/app/modules/constants.js");
|
var constants = require("/app/modules/constants.js");
|
||||||
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
|
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
|
||||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||||
|
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
|
||||||
|
|
||||||
var groupName = request.getParameter("groupName");
|
|
||||||
var groupId = request.getParameter("groupId");
|
var groupId = request.getParameter("groupId");
|
||||||
|
|
||||||
var viewModel = {};
|
var viewModel = {};
|
||||||
var title = "Devices";
|
var title = "Devices";
|
||||||
if (groupName) {
|
if (groupId) {
|
||||||
title = groupName + " " + title;
|
var group = groupModule.getGroup(groupId);
|
||||||
viewModel.groupName = groupName;
|
if (group) {
|
||||||
|
title = group.name + " " + title;
|
||||||
|
viewModel.roles = groupModule.getRolesOfGroup(groupId);
|
||||||
|
viewModel.group = group;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
viewModel.title = title;
|
viewModel.title = title;
|
||||||
var currentUser = session.get(constants.USER_SESSION_KEY);
|
var currentUser = session.get(constants.USER_SESSION_KEY);
|
||||||
@ -42,7 +46,6 @@ function onRequest(context) {
|
|||||||
viewModel.currentUser = currentUser;
|
viewModel.currentUser = currentUser;
|
||||||
var deviceCount = 0;
|
var deviceCount = 0;
|
||||||
if (groupId) {
|
if (groupId) {
|
||||||
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
|
|
||||||
deviceCount = groupModule.getGroupDeviceCount(groupId);
|
deviceCount = groupModule.getGroupDeviceCount(groupId);
|
||||||
} else {
|
} else {
|
||||||
deviceCount = deviceModule.getDevicesCount();
|
deviceCount = deviceModule.getDevicesCount();
|
||||||
|
|||||||
@ -51,7 +51,7 @@ function InitiateViewOption(url) {
|
|||||||
var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
||||||
var assetContainer = "#ast-container";
|
var assetContainer = "#ast-container";
|
||||||
|
|
||||||
var deviceListing, currentUser, groupName, groupId;
|
var deviceListing, currentUser, groupId;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DOM ready functions.
|
* DOM ready functions.
|
||||||
@ -70,7 +70,6 @@ $(document).ready(function () {
|
|||||||
deviceListing = $("#device-listing");
|
deviceListing = $("#device-listing");
|
||||||
currentUser = deviceListing.data("current-user");
|
currentUser = deviceListing.data("current-user");
|
||||||
|
|
||||||
groupName = getParameterByName("groupName");
|
|
||||||
groupId = getParameterByName("groupId");
|
groupId = getParameterByName("groupId");
|
||||||
|
|
||||||
/* Adding selected class for selected devices */
|
/* Adding selected class for selected devices */
|
||||||
@ -161,7 +160,7 @@ function toTitleCase(str) {
|
|||||||
|
|
||||||
function loadDevices(searchType, searchParam) {
|
function loadDevices(searchType, searchParam) {
|
||||||
var serviceURL;
|
var serviceURL;
|
||||||
if (groupName && groupId && $.hasPermission("LIST_OWN_DEVICES")) {
|
if (groupId && $.hasPermission("LIST_OWN_DEVICES")) {
|
||||||
serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices";
|
serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices";
|
||||||
} else if ($.hasPermission("LIST_DEVICES")) {
|
} else if ($.hasPermission("LIST_DEVICES")) {
|
||||||
serviceURL = "/api/device-mgt/v1.0/devices";
|
serviceURL = "/api/device-mgt/v1.0/devices";
|
||||||
@ -261,7 +260,7 @@ function loadDevices(searchType, searchParam) {
|
|||||||
return '<a href="' + context + '/device/' + row.deviceType + '?id=' + row.deviceIdentifier
|
return '<a href="' + context + '/device/' + row.deviceType + '?id=' + row.deviceIdentifier
|
||||||
+ '"><div class="thumbnail icon"><img class="square-element text fw " src="'
|
+ '"><div class="thumbnail icon"><img class="square-element text fw " src="'
|
||||||
+ getDeviceTypeThumb(
|
+ getDeviceTypeThumb(
|
||||||
row.deviceType) + '"/></div></a>';
|
row.deviceType) + '"/></div></a>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -345,33 +344,33 @@ function loadDevices(searchType, searchParam) {
|
|||||||
'<span class="hidden-xs hidden-on-grid-view">Analytics</span>';
|
'<span class="hidden-xs hidden-on-grid-view">Analytics</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!groupName || !groupId) && groupingEnabled(row.deviceType)) {
|
if (!groupId && groupingEnabled(row.deviceType)) {
|
||||||
html +=
|
html +=
|
||||||
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view group-device-link" '
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view group-device-link" '
|
||||||
+
|
+
|
||||||
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
|
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
|
||||||
+ '" data-devicename="' +
|
+ '" data-devicename="' +
|
||||||
row.name + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
|
row.name + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
|
||||||
'<i class="fw fw-grouping fw-stack-1x"></i></span>' +
|
'<i class="fw fw-grouping fw-stack-1x"></i></span>' +
|
||||||
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>';
|
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html +=
|
html +=
|
||||||
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
|
||||||
+
|
+
|
||||||
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
|
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
|
||||||
+ '" data-devicename="' + row.name + '">' +
|
+ '" data-devicename="' + row.name + '">' +
|
||||||
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
|
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
|
||||||
'<i class="fw fw-edit fw-stack-1x"></i></span>' +
|
'<i class="fw fw-edit fw-stack-1x"></i></span>' +
|
||||||
'<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
|
'<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
|
||||||
html +=
|
html +=
|
||||||
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" '
|
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" '
|
||||||
+
|
+
|
||||||
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
|
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
|
||||||
+ '" data-devicename="' + row.name + '">' +
|
+ '" data-devicename="' + row.name + '">' +
|
||||||
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
|
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
|
||||||
'<i class="fw fw-delete fw-stack-1x"></i></span>' +
|
'<i class="fw fw-delete fw-stack-1x"></i></span>' +
|
||||||
'<span class="hidden-xs hidden-on-grid-view">Delete</span>';
|
'<span class="hidden-xs hidden-on-grid-view">Delete</span>';
|
||||||
}
|
}
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
@ -427,16 +426,16 @@ function loadDevices(searchType, searchParam) {
|
|||||||
|
|
||||||
$(data.devices).each(function (index) {
|
$(data.devices).each(function (index) {
|
||||||
objects.push(
|
objects.push(
|
||||||
{
|
{
|
||||||
model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"),
|
model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"),
|
||||||
vendor: getPropertyValue(data.devices[index].properties, "VENDOR"),
|
vendor: getPropertyValue(data.devices[index].properties, "VENDOR"),
|
||||||
user: data.devices[index].enrolmentInfo.owner,
|
user: data.devices[index].enrolmentInfo.owner,
|
||||||
status: data.devices[index].enrolmentInfo.status,
|
status: data.devices[index].enrolmentInfo.status,
|
||||||
ownership: data.devices[index].enrolmentInfo.ownership,
|
ownership: data.devices[index].enrolmentInfo.ownership,
|
||||||
deviceType: data.devices[index].type,
|
deviceType: data.devices[index].type,
|
||||||
deviceIdentifier: data.devices[index].deviceIdentifier,
|
deviceIdentifier: data.devices[index].deviceIdentifier,
|
||||||
name: data.devices[index].name
|
name: data.devices[index].name
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -449,20 +448,20 @@ function loadDevices(searchType, searchParam) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$('#device-grid').datatables_extended_serverside_paging(
|
$('#device-grid').datatables_extended_serverside_paging(
|
||||||
null,
|
null,
|
||||||
serviceURL,
|
serviceURL,
|
||||||
dataFilter,
|
dataFilter,
|
||||||
columns,
|
columns,
|
||||||
fnCreatedRow,
|
fnCreatedRow,
|
||||||
function () {
|
function () {
|
||||||
$(".icon .text").res_text(0.2);
|
$(".icon .text").res_text(0.2);
|
||||||
$('#device-grid').removeClass('hidden');
|
$('#device-grid').removeClass('hidden');
|
||||||
$("#loading-content").remove();
|
$("#loading-content").remove();
|
||||||
attachDeviceEvents();
|
attachDeviceEvents();
|
||||||
}, {
|
}, {
|
||||||
"placeholder": "Search By Device Name",
|
"placeholder": "Search By Device Name",
|
||||||
"searchKey": "name"
|
"searchKey": "name"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$(deviceCheckbox).click(function () {
|
$(deviceCheckbox).click(function () {
|
||||||
@ -556,6 +555,34 @@ function hidePopup() {
|
|||||||
$('.modal-backdrop').remove();
|
$('.modal-backdrop').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function markAlreadyAssignedGroups(deviceId, deviceType) {
|
||||||
|
var successCallback = function (data, textStatus, xhr) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
if (data.length > 0) {
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
$('.groupCheckBoxes').each(
|
||||||
|
function () {
|
||||||
|
if (data[i].id == $(this).data('groupid')) {
|
||||||
|
$(this).attr('checked', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
displayErrors(xhr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
invokerUtil.get("/api/device-mgt/v1.0/groups/device?deviceId=" + deviceId + "&deviceType=" + deviceType,
|
||||||
|
successCallback, function (message) {
|
||||||
|
displayErrors(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Following functions should be triggered after AJAX request is made.
|
* Following functions should be triggered after AJAX request is made.
|
||||||
*/
|
*/
|
||||||
@ -572,33 +599,58 @@ function attachDeviceEvents() {
|
|||||||
var deviceType = $(this).data("devicetype");
|
var deviceType = $(this).data("devicetype");
|
||||||
$(modalPopupContent).html($('#group-device-modal-content').html());
|
$(modalPopupContent).html($('#group-device-modal-content').html());
|
||||||
$('#user-groups').html(
|
$('#user-groups').html(
|
||||||
'<div style="height:100px" data-state="loading" data-loading-text="Loading..." data-loading-style="icon-only" data-loading-inverse="true"></div>');
|
'<div style="height:100px" data-state="loading" data-loading-text="Loading..." data-loading-style="icon-only" data-loading-inverse="true"></div>');
|
||||||
$("a#group-device-yes-link").hide();
|
$("a#group-device-yes-link").hide();
|
||||||
showPopup();
|
showPopup();
|
||||||
|
|
||||||
var serviceURL;
|
var serviceURL;
|
||||||
if ($.hasPermission("LIST_ALL_GROUPS")) {
|
if ($.hasPermission("LIST_ALL_GROUPS")) {
|
||||||
serviceURL = "/api/device-mgt/v1.0/groups";
|
serviceURL = "/api/device-mgt/v1.0/admin/groups?limit=100";
|
||||||
} else if ($.hasPermission("LIST_GROUPS")) {
|
} else if ($.hasPermission("LIST_GROUPS")) {
|
||||||
//Get authenticated users groups
|
//Get authenticated users groups
|
||||||
serviceURL = "/api/device-mgt/v1.0/groups/user/" + currentUser + "/all";
|
serviceURL = "/api/device-mgt/v1.0/groups?limit=100";
|
||||||
}
|
}
|
||||||
|
|
||||||
invokerUtil.get(serviceURL, function (data) {
|
invokerUtil.get(serviceURL, function (data) {
|
||||||
var groups = JSON.parse(data);
|
var groups = JSON.parse(data);
|
||||||
var str = '<br /><select id="assign-group-selector" style="color:#3f3f3f;padding:5px;width:250px;">';
|
var html = '';
|
||||||
|
var hasGroups = false;
|
||||||
for (var i = 0; i < groups.deviceGroups.length; i++) {
|
for (var i = 0; i < groups.deviceGroups.length; i++) {
|
||||||
str += '<option value="' + groups.deviceGroups[i].id + '">' +
|
if (groups.deviceGroups[i].owner != "wso2.system.user") {
|
||||||
groups.deviceGroups[i].name + '</option>';
|
html += '<div class="wr-input-control"><label class="wr-input-control checkbox">' +
|
||||||
|
'<input class="groupCheckBoxes" type="checkbox" data-groupid="' + groups.deviceGroups[i].id + '" />' +
|
||||||
|
'<span class="helper" title="' + groups.deviceGroups[i].name + '">' + groups.deviceGroups[i].name +
|
||||||
|
'</span></label></div>';
|
||||||
|
hasGroups = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
str += '</select>';
|
if (hasGroups) {
|
||||||
$('#user-groups').html(str);
|
html = '<br/><h4>Please select device group(s)</h4><br/>' + html;
|
||||||
$("a#group-device-yes-link").show();
|
markAlreadyAssignedGroups(deviceId, deviceType);
|
||||||
|
$("a#group-device-yes-link").show();
|
||||||
|
$("a#group-add-link").hide();
|
||||||
|
} else {
|
||||||
|
$("a#group-device-yes-link").hide();
|
||||||
|
$("a#group-add-link").show();
|
||||||
|
html += '<br/><h4>You don\'t have any existing device groups. Please add new device group first.</h4>'
|
||||||
|
}
|
||||||
|
$('#user-groups').html(html);
|
||||||
$("a#group-device-yes-link").click(function () {
|
$("a#group-device-yes-link").click(function () {
|
||||||
var selectedGroup = $('#assign-group-selector').val();
|
var deviceIdentifier = {"id": deviceId, "type": deviceType};
|
||||||
serviceURL = "/api/device-mgt/v1.0/groups/id/" + selectedGroup + "/devices/add";
|
var deviceGroupIds = [];
|
||||||
var deviceIdentifiers = [{"id": deviceId, "type": deviceType}];
|
$('.modal .groupCheckBoxes').each(
|
||||||
invokerUtil.post(serviceURL, deviceIdentifiers, function (data) {
|
function () {
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
deviceGroupIds.push($(this).data('groupid'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
var deviceToGroupsAssignment = {
|
||||||
|
deviceIdentifier: deviceIdentifier,
|
||||||
|
deviceGroupIds: deviceGroupIds
|
||||||
|
};
|
||||||
|
serviceURL = "/api/device-mgt/v1.0/groups/device/assign";
|
||||||
|
invokerUtil.post(serviceURL, deviceToGroupsAssignment, function (data) {
|
||||||
$(modalPopupContent).html($('#group-associate-device-200-content').html());
|
$(modalPopupContent).html($('#group-associate-device-200-content').html());
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
hidePopup();
|
hidePopup();
|
||||||
@ -640,8 +692,8 @@ function attachDeviceEvents() {
|
|||||||
showPopup();
|
showPopup();
|
||||||
|
|
||||||
$("a#remove-device-yes-link").click(function () {
|
$("a#remove-device-yes-link").click(function () {
|
||||||
if(groupId && groupName) {
|
if (groupId) {
|
||||||
var deviceIdentifiers = [{"id": deviceId,"type": deviceType}];
|
var deviceIdentifiers = [{"id": deviceId, "type": deviceType}];
|
||||||
serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices/remove";
|
serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices/remove";
|
||||||
invokerUtil.post(serviceURL, deviceIdentifiers, function (message) {
|
invokerUtil.post(serviceURL, deviceIdentifiers, function (message) {
|
||||||
$(modalPopupContent).html($('#remove-device-from-group-200-content').html());
|
$(modalPopupContent).html($('#remove-device-from-group-200-content').html());
|
||||||
@ -733,6 +785,6 @@ function displayDeviceErrors(jqXHR) {
|
|||||||
function getParameterByName(name) {
|
function getParameterByName(name) {
|
||||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||||
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
||||||
results = regex.exec(location.search);
|
results = regex.exec(location.search);
|
||||||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{@app.context}}/devices?groupOwner={{groupOwner}}&groupName={{groupName}}">
|
<a href="{{@app.context}}/devices?groupId={{groupId}}&groupName={{groupName}}">
|
||||||
{{groupName}}
|
{{groupName}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -19,8 +19,8 @@
|
|||||||
function onRequest(context) {
|
function onRequest(context) {
|
||||||
var utility = require("/app/modules/utility.js").utility;
|
var utility = require("/app/modules/utility.js").utility;
|
||||||
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
|
var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
|
||||||
var groupName = context.uriParams.name;
|
|
||||||
var groupId = context.uriParams.id;
|
var groupId = context.uriParams.id;
|
||||||
|
var group = groupModule.getGroup(groupId);
|
||||||
var devices = [];
|
var devices = [];
|
||||||
var deviceResponse = groupModule.getGroupDevices(groupId).responseText;
|
var deviceResponse = groupModule.getGroupDevices(groupId).responseText;
|
||||||
|
|
||||||
@ -29,8 +29,9 @@ function onRequest(context) {
|
|||||||
devices = deviceResponseObj.devices;
|
devices = deviceResponseObj.devices;
|
||||||
}
|
}
|
||||||
var page = {
|
var page = {
|
||||||
"groupName": groupName,
|
"groupId": groupId,
|
||||||
"title": groupName + " Analytics"
|
"groupName": group.name,
|
||||||
|
"title": group.name + " Analytics"
|
||||||
};
|
};
|
||||||
if (devices) {
|
if (devices) {
|
||||||
var deviceTypes = [];
|
var deviceTypes = [];
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"uri": "/group/{name}/{id}/analytics",
|
"uri": "/group/{id}/analytics",
|
||||||
"layout": "cdmf.layout.default"
|
"layout": "cdmf.layout.default"
|
||||||
}
|
}
|
||||||
@ -16,18 +16,41 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Following function would execute
|
||||||
|
* when a user clicks on the list item
|
||||||
|
* initial mode and with out select mode.
|
||||||
|
*/
|
||||||
|
function InitiateViewOption(url) {
|
||||||
|
if ($(".select-enable-btn").text() == "Select") {
|
||||||
|
$(location).attr('href', url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var cache = {};
|
||||||
|
var validateAndReturn = function (value) {
|
||||||
|
return (value == undefined || value == null) ? "Unspecified" : value;
|
||||||
|
};
|
||||||
|
Handlebars.registerHelper("deviceMap", function (device) {
|
||||||
|
device.owner = validateAndReturn(device.owner);
|
||||||
|
device.ownership = validateAndReturn(device.ownership);
|
||||||
|
var arr = device.properties;
|
||||||
|
if (arr) {
|
||||||
|
device.properties = arr.reduce(function (total, current) {
|
||||||
|
total[current.name] = validateAndReturn(current.value);
|
||||||
|
return total;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setting-up global variables.
|
* Setting-up global variables.
|
||||||
*/
|
*/
|
||||||
var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
|
||||||
var assetContainer = "#ast-container";
|
var assetContainer = "#ast-container";
|
||||||
|
|
||||||
function InitiateViewOption() {
|
|
||||||
if ($(".select-enable-btn").text() == "Select") {
|
|
||||||
$(location).attr('href', $(this).data("url"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On Select All Groups button click function.
|
* On Select All Groups button click function.
|
||||||
*
|
*
|
||||||
@ -118,9 +141,9 @@ function loadGroups() {
|
|||||||
});
|
});
|
||||||
var json = {
|
var json = {
|
||||||
"recordsTotal": data.count,
|
"recordsTotal": data.count,
|
||||||
|
"recordsFiltered": data.count,
|
||||||
"data": objects
|
"data": objects
|
||||||
}
|
};
|
||||||
|
|
||||||
return JSON.stringify(json);
|
return JSON.stringify(json);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -129,7 +152,14 @@ function loadGroups() {
|
|||||||
data: 'id',
|
data: 'id',
|
||||||
class: 'remove-padding icon-only content-fill',
|
class: 'remove-padding icon-only content-fill',
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return '<div class="thumbnail icon"><img class="square-element text fw " src="public/cdmf.page.groups/images/group-icon.png"/></div>';
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
||||||
|
return '<a href="devices?groupId=' + row.groupId + '&groupName=' + row.name
|
||||||
|
+ '"><div class="thumbnail icon"><img class="square-element text fw " '
|
||||||
|
+ 'src="public/cdmf.page.groups/images/group-icon.png"/></div></a>';
|
||||||
|
} else {
|
||||||
|
return '<div class="thumbnail icon"><img class="square-element text fw " ' +
|
||||||
|
'src="public/cdmf.page.groups/images/group-icon.png"/></div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -154,13 +184,7 @@ function loadGroups() {
|
|||||||
render: function (id, type, row, meta) {
|
render: function (id, type, row, meta) {
|
||||||
var html = '';
|
var html = '';
|
||||||
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
if ($.hasPermission("VIEW_GROUP_DEVICES")) {
|
||||||
html = '<a href="devices?groupId=' + row.groupId + '&groupName=' + row.name
|
html += '<a href="group/' + row.groupId
|
||||||
+ '" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
|
|
||||||
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-view fw-stack-1x"></i></span>'
|
|
||||||
+
|
|
||||||
'<span class="hidden-xs hidden-on-grid-view">View Devices</span></a>';
|
|
||||||
|
|
||||||
html += '<a href="group/' + row.name + '/' + row.groupId
|
|
||||||
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
|
+ '/analytics" data-click-event="remove-form" class="btn padding-reduce-on-grid-view">' +
|
||||||
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
|
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
|
||||||
+
|
+
|
||||||
@ -224,21 +248,23 @@ function loadGroups() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$('#group-grid').datatables_extended_serverside_paging(
|
$('#group-grid').datatables_extended_serverside_paging(
|
||||||
null,
|
null,
|
||||||
serviceURL,
|
serviceURL,
|
||||||
dataFilter,
|
dataFilter,
|
||||||
columns,
|
columns,
|
||||||
fnCreatedRow,
|
fnCreatedRow,
|
||||||
function (oSettings) {
|
function (oSettings) {
|
||||||
$(".icon .text").res_text(0.2);
|
$(".icon .text").res_text(0.2);
|
||||||
attachEvents();
|
attachEvents();
|
||||||
},
|
var thisTable = $(this).closest('.dataTables_wrapper').find('.dataTable').dataTable();
|
||||||
{
|
thisTable.removeClass("table-selectable");
|
||||||
"placeholder": "Search By Group Name",
|
},
|
||||||
"searchKey": "name"
|
{
|
||||||
});
|
"placeholder": "Search By Group Name",
|
||||||
|
"searchKey": "name"
|
||||||
|
}
|
||||||
|
);
|
||||||
$(groupCheckbox).click(function () {
|
$(groupCheckbox).click(function () {
|
||||||
addGroupSelectedClass(this);
|
addGroupSelectedClass(this);
|
||||||
});
|
});
|
||||||
@ -257,6 +283,11 @@ function openCollapsedNav() {
|
|||||||
* DOM ready functions.
|
* DOM ready functions.
|
||||||
*/
|
*/
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
/* Adding selected class for selected devices */
|
||||||
|
$(groupCheckbox).each(function () {
|
||||||
|
addGroupSelectedClass(this);
|
||||||
|
});
|
||||||
|
|
||||||
var permissionSet = {};
|
var permissionSet = {};
|
||||||
|
|
||||||
//This method is used to setup permission for device listing
|
//This method is used to setup permission for device listing
|
||||||
@ -278,11 +309,6 @@ $(document).ready(function () {
|
|||||||
loadGroups();
|
loadGroups();
|
||||||
//$('#device-grid').datatables_extended();
|
//$('#device-grid').datatables_extended();
|
||||||
|
|
||||||
/* Adding selected class for selected devices */
|
|
||||||
$(groupCheckbox).each(function () {
|
|
||||||
addGroupSelectedClass(this);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* for device list sorting drop down */
|
/* for device list sorting drop down */
|
||||||
$(".ctrl-filter-type-switcher").popover(
|
$(".ctrl-filter-type-switcher").popover(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@ function onRequest() {
|
|||||||
}
|
}
|
||||||
var userStores = userModule.getSecondaryUserStores();
|
var userStores = userModule.getSecondaryUserStores();
|
||||||
page["userStores"] = userStores;
|
page["userStores"] = userStores;
|
||||||
page["charLimit"] = devicemgtProps["usernameLength"];
|
page["charLimit"] = devicemgtProps["userValidationConfig"]["usernameLength"];
|
||||||
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
|
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
|
||||||
page["usernameHelpMsg"] = devicemgtProps["userValidationConfig"]["usernameHelpMsg"];
|
page["usernameHelpMsg"] = devicemgtProps["userValidationConfig"]["usernameHelpMsg"];
|
||||||
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];
|
||||||
|
|||||||
@ -16,26 +16,44 @@
|
|||||||
under the License.
|
under the License.
|
||||||
}}
|
}}
|
||||||
|
|
||||||
<div class="row wr-device-board">
|
{{#if virtualDeviceTypesList}}
|
||||||
<div class="col-lg-12 wr-secondary-bar">
|
<div class="row wr-device-board">
|
||||||
<span class="page-sub-title">Device Types</span>
|
<div class="col-lg-12 wr-secondary-bar">
|
||||||
|
<span class="page-sub-title">Device Types</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="container-fluid">
|
||||||
<span id="device-listing-status-msg"></span>
|
<table class="table table-striped table-hover list-table no-operations display responsive nowrap data-table grid-view no-toolbar"
|
||||||
<div class="container-fluid">
|
id="device-type-grid">
|
||||||
<table class="table table-striped table-hover list-table no-operations display responsive nowrap data-table grid-view no-toolbar"
|
<thead>
|
||||||
id="device-type-grid">
|
<tr class="sort-row">
|
||||||
<thead>
|
<th class="no-sort"></th>
|
||||||
<tr class="sort-row">
|
<th>By Device Type</th>
|
||||||
<th class="no-sort"></th>
|
<th class="no-sort"></th>
|
||||||
<th>By Device Type</th>
|
</tr>
|
||||||
<th class="no-sort"></th>
|
</thead>
|
||||||
</tr>
|
<tbody id="ast-container">
|
||||||
</thead>
|
</tbody>
|
||||||
<tbody id="ast-container">
|
</table>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
{{else}}
|
||||||
</div>
|
<div class="ast-container list-view">
|
||||||
|
<div class="ctrl-info-panel col-centered text-center wr-login">
|
||||||
|
<h3 class="text-muted">
|
||||||
|
<i class="fw fw-mobile fw-3x"></i>
|
||||||
|
</h3>
|
||||||
|
<h3 class="text-muted">No device type is available to be displayed.</h3>
|
||||||
|
<a href="https://docs.wso2.com/display/IoTS100/Quick+Start+Guide" target="_blank"
|
||||||
|
class="btn-operations btn-default">
|
||||||
|
<span class="fw-stack">
|
||||||
|
<i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
<i class="fw fw-document fw-stack-1x"></i>
|
||||||
|
</span>
|
||||||
|
Quick Startup Guide
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
<br class="c-both"/>
|
<br class="c-both"/>
|
||||||
|
|
||||||
{{#if virtualDeviceTypesList}}
|
{{#if virtualDeviceTypesList}}
|
||||||
|
|||||||
@ -29,6 +29,9 @@ function onRequest(context) {
|
|||||||
if (typesListResponse["status"] == "success") {
|
if (typesListResponse["status"] == "success") {
|
||||||
var deviceTypes = typesListResponse.content.deviceTypes;
|
var deviceTypes = typesListResponse.content.deviceTypes;
|
||||||
if (deviceTypes) {
|
if (deviceTypes) {
|
||||||
|
if (deviceTypes.length > 0){
|
||||||
|
viewModel.hasDeviceTypes = true;
|
||||||
|
}
|
||||||
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 deviceType = deviceTypes[i];
|
||||||
|
|||||||
@ -142,13 +142,6 @@ function loadDevices(searchType, searchParam){
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#device-type-grid').addClass('hidden');
|
$('#device-type-grid').addClass('hidden');
|
||||||
$('#device-listing-status-msg').html(
|
|
||||||
'<div class="col-centered text-center"><h3 class="text-muted"><i class="fw fw-mobile fw-3x"></i>' +
|
|
||||||
'</h3><h3 class="text-muted">No device type is available to be displayed.</h3>' +
|
|
||||||
'<a href="https://docs.wso2.com/display/IoTS100/Quick+Start+Guide" target="_blank" ' +
|
|
||||||
'class="btn-operations btn-default"><span class="fw-stack">' +
|
|
||||||
'<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-document fw-stack-1x"></i></span>' +
|
|
||||||
'Quick Startup Guide</a></div>');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".icon .text").res_text(0.2);
|
$(".icon .text").res_text(0.2);
|
||||||
|
|||||||
@ -15,4 +15,5 @@
|
|||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
}}
|
}}
|
||||||
{{#zone "productName"}}WSO2 IoT{{/zone}}
|
{{#zone "productName"}}WSO2 IoT Server{{/zone}}
|
||||||
|
{{#zone "productNameResponsive"}}WSO2 IoT Server{{/zone}}
|
||||||
@ -90,6 +90,9 @@ public class JWTAuthenticator implements WebappAuthenticator {
|
|||||||
if (requestUri == null || "".equals(requestUri)) {
|
if (requestUri == null || "".equals(requestUri)) {
|
||||||
authenticationInfo.setStatus(Status.CONTINUE);
|
authenticationInfo.setStatus(Status.CONTINUE);
|
||||||
}
|
}
|
||||||
|
if (requestUri == null) {
|
||||||
|
requestUri = "";
|
||||||
|
}
|
||||||
StringTokenizer tokenizer = new StringTokenizer(requestUri, "/");
|
StringTokenizer tokenizer = new StringTokenizer(requestUri, "/");
|
||||||
String context = tokenizer.nextToken();
|
String context = tokenizer.nextToken();
|
||||||
if (context == null || "".equals(context)) {
|
if (context == null || "".equals(context)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user