diff --git a/components/device-mgt-iot-digitaldisplay/org.wso2.carbon.device.mgt.iot.digitaldisplay.api/src/main/java/org/wso2/carbon/device/mgt/iot/digitaldisplay/api/DigitalDisplayControllerService.java b/components/device-mgt-iot-digitaldisplay/org.wso2.carbon.device.mgt.iot.digitaldisplay.api/src/main/java/org/wso2/carbon/device/mgt/iot/digitaldisplay/api/DigitalDisplayControllerService.java index db5f68aeb1..eecd691a72 100644 --- a/components/device-mgt-iot-digitaldisplay/org.wso2.carbon.device.mgt.iot.digitaldisplay.api/src/main/java/org/wso2/carbon/device/mgt/iot/digitaldisplay/api/DigitalDisplayControllerService.java +++ b/components/device-mgt-iot-digitaldisplay/org.wso2.carbon.device.mgt.iot.digitaldisplay.api/src/main/java/org/wso2/carbon/device/mgt/iot/digitaldisplay/api/DigitalDisplayControllerService.java @@ -43,20 +43,20 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method */ @Path("/restart-browser") @POST public void restartBrowser(@QueryParam("deviceId") String deviceId , @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Restrat Browser : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId +":" + DigitalDisplayConstants.RESTART_BROWSER_CONSTANT,""); + sendCommandViaMQTT(owner,deviceId,sessionId +":" + DigitalDisplayConstants.RESTART_BROWSER_CONSTANT,""); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -74,20 +74,20 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method */ @Path("/close-browser") @POST public void closeBrowser(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Close Browser : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId +":" + DigitalDisplayConstants.CLOSE_BROWSER_CONSTANT ,""); + sendCommandViaMQTT(owner,deviceId,sessionId +":" + DigitalDisplayConstants.CLOSE_BROWSER_CONSTANT ,""); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -104,20 +104,20 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method */ @Path("/terminate-display") @POST public void terminateDisplay(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Terminate Display : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId +":" + DigitalDisplayConstants.TERMINATE_DISPLAY_CONSTANT,""); + sendCommandViaMQTT(owner,deviceId,sessionId +":" + DigitalDisplayConstants.TERMINATE_DISPLAY_CONSTANT,""); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -134,20 +134,20 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method */ @Path("/restart-display") @POST public void restartDisplay(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Restrat Display : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId +":" + DigitalDisplayConstants.RESTART_DISPLAY_CONSTANT ,""); + sendCommandViaMQTT(owner,deviceId,sessionId +":" + DigitalDisplayConstants.RESTART_DISPLAY_CONSTANT ,""); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -164,7 +164,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method * @param path page no need to change * @param attribute this can be path,time or type @@ -178,14 +178,14 @@ public class DigitalDisplayControllerService { @PathParam("path") String path, @PathParam("attribute") String attribute, @PathParam("new-value") String newValue, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Edit Content Display Id - " + deviceId + " by " + owner); try { String params = path + File.separator + attribute + File.separator + newValue; - sendCommandViaMQTT(owner,deviceId,randomId + ":" + DigitalDisplayConstants.EDIT_SEQUENCE_CONSTANT,params); + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.EDIT_SEQUENCE_CONSTANT,params); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -202,7 +202,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method * @param type type of new resource * @param time new resource visible time @@ -215,14 +215,14 @@ public class DigitalDisplayControllerService { @PathParam("type") String type, @PathParam("time") String time, @PathParam("path") String path, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Add Sequence : " + deviceId); try { String params = type + File.separator + time + File.separator + path; - sendCommandViaMQTT(owner,deviceId,randomId + ":" + + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.ADD_NEW_RESOURCE_CONSTANT,params); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { @@ -239,7 +239,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method * @param type type of the new resource * @param time new resource visible time @@ -250,7 +250,7 @@ public class DigitalDisplayControllerService { @POST public void addNewResourceBefore(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @PathParam("type") String type, @PathParam("time") String time, @PathParam("path") String path, @@ -262,7 +262,7 @@ public class DigitalDisplayControllerService { try { String params = type + File.separator + time + File.separator + path + File.separator + "before=" + nextPage; - sendCommandViaMQTT(owner,deviceId,randomId + ":" + + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.ADD_NEW_RESOURCE_CONSTANT,params); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { @@ -280,7 +280,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method * @param type type of the new resource * @param time new resource visible time @@ -295,7 +295,7 @@ public class DigitalDisplayControllerService { @PathParam("time") String time, @PathParam("path") String path, @PathParam("before-page") String beforePage, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Add Sequence : " + deviceId); @@ -303,7 +303,7 @@ public class DigitalDisplayControllerService { try { String params = type + File.separator + time + File.separator + path + File.separator + "after=" + beforePage; - sendCommandViaMQTT(owner,deviceId,randomId + ":" + + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.ADD_NEW_RESOURCE_CONSTANT,params); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { @@ -320,7 +320,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method * @param path path of the page no need to delete */ @@ -330,13 +330,13 @@ public class DigitalDisplayControllerService { public void removeResource(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, @PathParam("path") String path, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Remove Resource : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId + ":" + + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.REMOVE_RESOURCE_CONSTANT,path); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { @@ -354,7 +354,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method * @param directoryName path of the folder need to delete */ @@ -364,12 +364,12 @@ public class DigitalDisplayControllerService { public void removeDirectory(@PathParam("directory-name") String directoryName, @QueryParam("deviceId") String deviceId , @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Remove Directory : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId + ":" + + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.REMOVE_DIRECTORY_CONSTANT,directoryName); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { @@ -387,7 +387,7 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param directoryName path of directory of request file contain * @param content file name of need to delete * @param response response type of the method @@ -399,13 +399,13 @@ public class DigitalDisplayControllerService { @PathParam("content") String content, @QueryParam("deviceId") String deviceId , @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Remove Content : " + deviceId); try { String param = directoryName + File.separator + content; - sendCommandViaMQTT(owner,deviceId,randomId + ":" + DigitalDisplayConstants.REMOVE_CONTENT_CONSTANT,param); + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.REMOVE_CONTENT_CONSTANT,param); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -422,20 +422,20 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method */ @Path("/shutdown-display") @POST public void shutDownDisplay(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Shut down display : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId + ":" + DigitalDisplayConstants.SHUTDOWN_DISPLAY_CONSTANT,""); + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.SHUTDOWN_DISPLAY_CONSTANT,""); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); @@ -452,20 +452,20 @@ public class DigitalDisplayControllerService { * * @param deviceId id of the controlling digital display * @param owner owner of the digital display - * @param randomId web socket id of the method invoke client + * @param sessionId web socket id of the method invoke client * @param response response type of the method */ @Path("/get-status") @GET public void getStatus(@QueryParam("deviceId") String deviceId, @QueryParam("owner") String owner, - @QueryParam("randomId") String randomId, + @QueryParam("sessionId") String sessionId, @Context HttpServletResponse response){ log.info("Status : " + deviceId); try { - sendCommandViaMQTT(owner,deviceId,randomId + ":" + DigitalDisplayConstants.GET_STATUS_CONSTANT,""); + sendCommandViaMQTT(owner,deviceId,sessionId + ":" + DigitalDisplayConstants.GET_STATUS_CONSTANT,""); response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); 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.device-view/device-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.device-view/device-view.hbs index 622beab059..6dbc983b7d 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.device-view/device-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.device-view/device-view.hbs @@ -5,9 +5,6 @@
@@ -30,24 +27,15 @@ {{#defineZone "device-detail-properties"}} - - - - {{#if device.viewModel.udid}} - - {{/if}} - {{#if device.viewModel.phoneNumber}} - - {{/if}} - - - - + + + +
Device{{device.viewModel.vendor}} {{device.properties.model}}
Model{{device.viewModel.model}}
IMEI{{device.viewModel.imei}}
UDID{{device.viewModel.udid}}
Phone Number{{device.viewModel.phoneNumber}}
Status - {{#equal device.status "ACTIVE"}} Active{{/equal}} - {{#equal device.status "INACTIVE"}} Inactive{{/equal}} - {{#equal device.status "BLOCKED"}} Blocked{{/equal}} - {{#equal device.status "REMOVED"}} Removed{{/equal}} -
Status + {{#equal device.status "ACTIVE"}} Active{{/equal}} + {{#equal device.status "INACTIVE"}} Inactive{{/equal}} + {{#equal device.status "BLOCKED"}} Blocked{{/equal}} + {{#equal device.status "REMOVED"}} Removed{{/equal}} +
{{/defineZone}} @@ -58,7 +46,84 @@ +
+
+ +
+ {{#defineZone "device-detail-properties"}} +
+
+ +
+
Device Details
+
+ +
+
Policy Compliance
+
+ +
+
+ Not available yet +
+
+
+
+
+
+
Device Location
+
+
+
+ Not available yet +
+
+
+
+
+
Operations Log
+
+ +
+
+ Not available yet +
+
+
+
+
+
+
+ {{/defineZone}} - + + + +{{#zone "bottomJs"}} + + + +{{/zone}} \ No newline at end of file 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.device-view/device-view.js 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.device-view/device-view.js index f180e7e4ec..df879ddf0f 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.device-view/device-view.js +++ 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.device-view/device-view.js @@ -7,19 +7,9 @@ function onRequest(context) { var deviceModule = require("/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); - if (device) { - var viewModel = {}; - var deviceInfo = device.properties.DEVICE_INFO; - if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) { - deviceInfo = parse(stringify(deviceInfo)); - viewModel.system = device.properties.IMEI; - viewModel.machine = "digital_display"; - viewModel.vendor = device.properties.VENDOR; - } - device.viewModel = viewModel; + if (device && device.status != "error") { + log.info(device); + return {"device": device}; } - context.device = device; - - return context; } } \ No newline at end of file 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.operation/operation.hbs b/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation/operation.hbs index df59f16412..03359b2afa 100644 --- a/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation/operation.hbs +++ b/features/device-mgt-iot-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation/operation.hbs @@ -17,7 +17,7 @@
{{#if control_operations}} {{#each control_operations}} -
+