From 7cc878873c7d26e78bf1205a24045a3bdbb90645 Mon Sep 17 00:00:00 2001 From: charithag Date: Tue, 15 Dec 2015 11:21:54 +0530 Subject: [PATCH 1/2] Fix links --- .../type-view.hbs | 53 +++++++++---------- .../app/units/iot.unit.device.stats/stats.hbs | 2 +- .../app/units/iot.unit.device.stats/stats.js | 2 +- 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs b/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs index f45e9d7842..3057bdd7f4 100644 --- a/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs +++ b/features/device-mgt-iot-digitaldisplay-feature/org.wso2.carbon.device.mgt.iot.digitaldisplay.feature/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.digital_display.type-view/type-view.hbs @@ -1,4 +1,4 @@ -
+

Digital Display


Connect your Digital Display @@ -37,35 +37,30 @@

Name your device and download the agent from following link.


-
-
- -
- - -
- +
+
+ +
+ +
-
-
- - - +
+ +
@@ -202,7 +197,7 @@

diff --git a/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.hbs b/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.hbs index 347cf1af21..1e307afadf 100644 --- a/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.hbs +++ b/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.hbs @@ -33,7 +33,7 @@ - + diff --git a/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.js b/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.js index 3f259272cf..95db4155c0 100644 --- a/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.js +++ b/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.stats/stats.js @@ -1,6 +1,6 @@ function onRequest(context) { var log = new Log("stats.js"); - var operationModule = require("/modules/operation.js").operationModule; + var operationModule = require("/app/modules/operation.js").operationModule; var device = context.unit.params.device; log.info(device); var monitor_operations = JSON.stringify(operationModule.getMonitorOperations(device.type)); From ea821f94f706984878d30732bbbd591915d09d86 Mon Sep 17 00:00:00 2001 From: charithag Date: Tue, 15 Dec 2015 16:40:50 +0530 Subject: [PATCH 2/2] Update group with pagination --- .../mgt/iot/api/DevicesManagerService.java | 16 -------- .../mgt/iot/api/GroupManagerService.java | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/DevicesManagerService.java b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/DevicesManagerService.java index cd126d6214..58841062b0 100644 --- a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/DevicesManagerService.java +++ b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/DevicesManagerService.java @@ -280,22 +280,6 @@ import java.util.List; } } - @Path("/device/group/{groupId}/{limit}") - @GET - @Consumes("application/json") - @Produces("application/json") - public Device[] getDevices(@PathParam("groupId") int groupId, @PathParam("limit") int limit){ - try{ - List devices = this.getServiceProvider().getDevices(groupId,limit); - return this.getActiveDevices(devices); - } catch (DeviceManagementException e) { - response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); - return null; - } finally { - this.endTenantFlow(); - } - } - @Path("/device/role/{role}/all") @GET @Consumes("application/json") diff --git a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/GroupManagerService.java b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/GroupManagerService.java index dddcd94027..2f3eec377d 100644 --- a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/GroupManagerService.java +++ b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot.api/src/main/java/org/wso2/carbon/device/mgt/iot/api/GroupManagerService.java @@ -24,6 +24,7 @@ import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.group.common.DeviceGroup; import org.wso2.carbon.device.mgt.group.common.GroupManagementException; import org.wso2.carbon.device.mgt.group.common.GroupUser; @@ -407,14 +408,14 @@ public class GroupManagerService { return usersArray; } - @Path("/group/id/{groupId}/device/{limit}") + @Path("/group/id/{groupId}/device/all") @GET @Consumes("application/json") @Produces("application/json") - public Device[] getDevices(@PathParam("groupId") int groupId,@PathParam("limit") int limit) { + public Device[] getDevices(@PathParam("groupId") int groupId) { Device[] deviceArray = null; try { - List devices = this.getServiceProvider().getDevices(groupId,limit); + List devices = this.getServiceProvider().getDevices(groupId); deviceArray = new Device[devices.size()]; response.setStatus(Response.Status.OK.getStatusCode()); devices.toArray(deviceArray); @@ -427,6 +428,40 @@ public class GroupManagerService { return deviceArray; } + @Path("/group/id/{groupId}/device/count") + @GET + @Consumes("application/json") + @Produces("application/json") + public int getDeviceCount(@PathParam("groupId") int groupId) { + try { + return this.getServiceProvider().getDeviceCount(groupId); + } catch (GroupManagementException e) { + response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + log.error(e.getErrorMessage(), e); + return -1; + } finally { + this.endTenantFlow(); + } + } + + @Path("/group/id/{groupId}/device") + @GET + @Consumes("application/json") + @Produces("application/json") + public PaginationResult getDevices(@PathParam("groupId") int groupId, + @QueryParam("index") int index, + @QueryParam("limit") int limit) { + try { + return this.getServiceProvider().getDevices(groupId, index, limit); + } catch (GroupManagementException e) { + response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + log.error(e.getErrorMessage(), e); + return null; + } finally { + this.endTenantFlow(); + } + } + @Path("/group/id/{groupId}/device/assign") @PUT @Consumes("application/json")