diff --git a/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.hbs b/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.hbs index 86d5fac3..8e3cdc7d 100644 --- a/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.hbs @@ -9,12 +9,6 @@ - - {{#each devices.devices}} - {{name}}
- {{id}}

- {{/each}} -
@@ -25,76 +19,26 @@ - - - - - - - - - - - - - - - - - - - - - - + + {{#each devices.device}} + + + + + + {{/each}} +
001RaspberryPi -
- - - -
-
002ArduinoUno -
- - - -
-
003BeagleBone -
- - - -
-
003Fire Alarm -
- - - -
-
{{deviceIdentifier}}{{name}} + + + +
diff --git a/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.js b/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.js index 6cde4b35..1f225215 100644 --- a/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.js +++ b/modules/distribution/src/repository/jaggeryapps/iot/units/alldevices/alldevices.js @@ -1,5 +1,5 @@ function onRequest(context) { - context.myDevicePath = "mydevice"; + context.myDevicePath = "/iot/mydevice"; var constants = require("/modules/constants.js"); var httpReq = new XMLHttpRequest(); @@ -7,28 +7,29 @@ function onRequest(context) { var endPoint = "http://localhost:9763/iotdevices/DevicesManager/getDevices?username=" + user.username; // httpReq.open("GET", endPoint, false); - log.info("%%%%"); - log.info(httpReq.response); - - context.devices = { - "devices": [ - {"name":"device1", - "id" : 1234 - }, - {"name":"device2", - "id" : 5678} - ] - }; + httpReq.setRequestHeader("Content-type","application/json"); + httpReq.send(); + // + context.devices = JSON.parse(httpReq.responseText); return context; } -// //{ -// "devices": [ -// {"name":"device1", -// "id" : 1234 -// }, -// {"name":"device2", -// "id" : 5678} +// "device": [ +// { +// "dateOfEnrolment": 1432978481443, +// "dateOfLastUpdate": 1432978481443, +// "deviceIdentifier": "qhnva32dy2ck", +// "deviceTypeId": 1, +// "id": 1, +// "name": "rasikas_firealarm_qhn", +// "owner": "rasika", +// "properties": { +// "name": "DEVICE_NAME", +// "value": "rasikas_firealarm_qhn" +// }, +// "status": "ACTIVE", +// "type": "firealarm" +// } //] //} diff --git a/modules/distribution/src/repository/jaggeryapps/iot/units/appbar/appbar.hbs b/modules/distribution/src/repository/jaggeryapps/iot/units/appbar/appbar.hbs index 2f33f8c3..c7279a1f 100644 --- a/modules/distribution/src/repository/jaggeryapps/iot/units/appbar/appbar.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iot/units/appbar/appbar.hbs @@ -25,6 +25,9 @@
  • GUIDE
  • SUPPORT
  • COMMUNITY
  • + {{#if user}} +
  • MY DEVICES
  • + {{/if}}