From 13ebc9d3f82f686ca2bc8388095feeb9067e2e40 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 31 Oct 2015 21:26:13 +0100 Subject: web: o Showning device name and description. o Trying out cards for the property list. --- src/DillerDao.js | 2 +- web/static/app/app.js | 2 ++ web/static/app/templates/device.html | 66 +++++++++++++++++++++++++++++++--- web/static/app/templates/property.html | 17 ++++++--- 4 files changed, 76 insertions(+), 11 deletions(-) diff --git a/src/DillerDao.js b/src/DillerDao.js index e372841..e7f6b54 100644 --- a/src/DillerDao.js +++ b/src/DillerDao.js @@ -3,7 +3,7 @@ var _ = require('lodash'); function DillerDao(tx) { var deviceColumns = 'id, created_timestamp, key, name, description'; - var propertyColumns = 'id, created_timestamp, device, key, last_value, last_timestamp'; + var propertyColumns = 'id, created_timestamp, device, key, name, description, last_value, last_timestamp'; var valueColumns = 'property, timestamp, value_text, value_numeric'; // ------------------------------------------------------------------------------------------------------------------- diff --git a/web/static/app/app.js b/web/static/app/app.js index a76aa33..fa4c4cc 100644 --- a/web/static/app/app.js +++ b/web/static/app/app.js @@ -10,6 +10,8 @@ ctrl.device = device.data.device; + ctrl.propertyChunks = _.chunk(ctrl.device.properties, 3); + ctrl.editDeviceAttribute = function (attributeName) { var outer = ctrl; $uibModal.open({ diff --git a/web/static/app/templates/device.html b/web/static/app/templates/device.html index 66b5e4d..fbda67f 100644 --- a/web/static/app/templates/device.html +++ b/web/static/app/templates/device.html @@ -1,10 +1,13 @@

- {{ctrl.device.key}} - device + {{(ctrl.device.name || ctrl.device.key)}}

+

+ {{ctrl.device.description}} +

+ -
+
+
Key
+
+ {{ctrl.device.key}} +   +
+
Created
{{ctrl.device.created_timestamp | date}} @@ -81,14 +90,60 @@

Properties

-
+
-

+

No properties registered...

+
+ +
+
+ +
+

{{p.name}}

+

{{p.key}}

+
+ {{p.key}} +
+
+
+ Last value: + + {{p.last_value}}
+ {{p.last_timestamp | date:'medium'}} +
+ + No values received yet. + +
+ +
+ Details +
+
+
+
+ +
diff --git a/web/static/app/templates/property.html b/web/static/app/templates/property.html index 5e8199d..8cff1f0 100644 --- a/web/static/app/templates/property.html +++ b/web/static/app/templates/property.html @@ -1,15 +1,19 @@

- {{ctrl.device.key}} - device + + {{(ctrl.device.name || ctrl.device.key)}} +

- {{ctrl.property.key}} - property + {{(ctrl.property.name || ctrl.property.key)}}

+

+ {{ctrl.property.description}} +

+
  • Created: {{ctrl.property.created_timestamp | date}}
  • Name: {{ctrl.property.name}}
  • @@ -42,7 +46,10 @@ - + + {{v.timestamp | date:'medium'}}, + + {{v.value}} -- cgit v1.2.3