From e0d6cf25547e6c1d9d05267e1b88f9cd75cc50bd Mon Sep 17 00:00:00 2001 From: Rasika Date: Sat, 30 May 2015 16:21:57 +0530 Subject: [PATCH] fixing jaggery errors --- .../iot/units/alldevices/alldevices.hbs | 96 ++++--------------- .../iot/units/alldevices/alldevices.js | 41 ++++---- .../jaggeryapps/iot/units/appbar/appbar.hbs | 3 + .../iot/units/firealarm/firealarm.hbs | 4 - .../iot/units/mydevice/mydevice.hbs | 4 +- .../units/mydevice/public/js/graph_util.js | 6 -- 6 files changed, 46 insertions(+), 108 deletions(-) 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}}