Fix issue in IoT device type loading

revert-70aa11f8
Charitha Goonetilleke 5 years ago
parent f434fafbe1
commit bb82eb7236

@ -137,7 +137,8 @@ public class DeviceTypeManagementAdminServiceImpl implements DeviceTypeManagemen
@Override
@PUT
public Response updateDeviceType(String type, DeviceType deviceType) {
@Path("/{type}")
public Response updateDeviceType(@PathParam("type") String type, DeviceType deviceType) {
if (deviceType != null && deviceType.getDeviceTypeMetaDefinition() != null) {
if (deviceType.getName() == null || !deviceType.getName().equals(type)) {
return Response.status(Response.Status.BAD_REQUEST).entity("Type name mismatch. Expected: '" + type +
@ -163,7 +164,10 @@ public class DeviceTypeManagementAdminServiceImpl implements DeviceTypeManagemen
}
@Override
public Response addDeviceTypePlatformConfig(String type, PlatformConfiguration platformConfiguration) {
@POST
@Path("/{type}/configs")
public Response addDeviceTypePlatformConfig(@PathParam("type") String type,
PlatformConfiguration platformConfiguration) {
boolean isSaved;
if (platformConfiguration.getType() == null || !platformConfiguration.getType().equals(type)) {
return Response.status(Response.Status.BAD_REQUEST).entity("Type name mismatch. Expected: '" + type +

@ -327,15 +327,6 @@ deviceModule = function () {
return response;
};
publicMethods.getDeviceTypesConfig = function () {
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types/config";
var response = privateMethods.callBackend(url, constants["HTTP_GET"]);
if (response.status == "success") {
response.content = parse(response.content);
}
return response;
};
/*
@Updated
*/

@ -35,7 +35,7 @@ function onRequest(context) {
var deviceType = request.getParameter("type");
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var restAPIEndpoint = deviceMgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"]
+ "/device-types/config/" + deviceType;
+ "/device-types/" + deviceType;
displayData.name = deviceType;
serviceInvokers.XMLHttp.get(
restAPIEndpoint,

@ -210,7 +210,7 @@ $(document).ready(function () {
});
deviceType.deviceTypeMetaDefinition.features = features;
var addRoleAPI = apiBasePath + "/admin/device-types";
var addRoleAPI = apiBasePath + "/admin/device-types/" + deviceType.name;
invokerUtil.put(
addRoleAPI,

@ -42,7 +42,7 @@ function onRequest(context) {
var displayData = {};
var restAPIEndpoint = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"]
+ "/device-types/config/" + deviceType;
+ "/device-types/" + deviceType;
displayData.deviceType = deviceType;
displayData.tenantDomain = tenantDomain;
serviceInvokers.XMLHttp.get(

@ -32,7 +32,7 @@ function onRequest(context) {
return opts.inverse(this);
});
var restAPIEndpoint = deviceMgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"]
+ "/device-types/config/" + deviceType;
+ "/device-types/" + deviceType;
displayData.deviceType = deviceType;
displayData.tenantDomain = tenantDomain;
serviceInvokers.XMLHttp.get(

Loading…
Cancel
Save