Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/static/index.html @ 218:f8ffb9d8d982
multi-boards on one service, new devices, devices return their current
Ignore-this: e214852bca67519e79f9ddb3644576e1
values in the graph, jsonld support, multiple temp sensors on OW bus
author | drewp@bigasterisk.com |
---|---|
date | Sun, 03 Jan 2016 02:29:14 -0800 |
parents | 06795f84fe29 |
children | e606f1d89d89 |
rev | line source |
---|---|
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
1 <!doctype html> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
2 <html> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
3 <head> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
4 <title>arduinoNode</title> |
194 | 5 <meta name=viewport content="width=device-width, initial-scale=1"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
6 <meta charset="utf-8" /> |
193 | 7 <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents.min.js"></script> |
8 <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html"> | |
9 <link rel="import" href="/lib/polymer/1.0.9/iron-ajax/iron-ajax.html"> | |
10 <link rel="import" href="/lib/polymer/1.0.9/iron-flex-layout/iron-flex-layout.html"> | |
198 | 11 <link rel="import" href="/lib/polymer/1.0.9/paper-button/paper-button.html"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
12 <link rel="import" href="/room/ari/static/rdf-observe.html"> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
13 <link rel="import" href="/room/ari/static/rdf-oneshot.html"> |
193 | 14 <link rel="import" href="/room/ari/static/rdf-uri.html"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
15 <link rel="import" href="static/output-widgets.html"> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
16 <style> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
17 body { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
18 font-family: monospace; |
193 | 19 display: flex; |
20 flex-direction: column; | |
21 margin: 0; | |
22 height: 100vh; | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
23 } |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
24 </style> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
25 </head> |
193 | 26 <body> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
27 <script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
28 window.NS = { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
29 dev: 'http://projects.bigasterisk.com/device/', |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
30 room: 'http://projects.bigasterisk.com/room/', |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
31 rdfs: 'http://www.w3.org/2000/01/rdf-schema#', |
218
f8ffb9d8d982
multi-boards on one service, new devices, devices return their current
drewp@bigasterisk.com
parents:
198
diff
changeset
|
32 sensor: 'http://bigasterisk.com/homeauto/sensor/', |
f8ffb9d8d982
multi-boards on one service, new devices, devices return their current
drewp@bigasterisk.com
parents:
198
diff
changeset
|
33 b0: 'http://bigasterisk.com/homeauto/board0/', |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
34 }; |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
35 </script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
36 |
193 | 37 <dom-module id="linked-uri"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
38 <template> |
193 | 39 <a href$="{{href}}">{{compactUri(href)}}</a> |
173
0daa8cbbd8f6
handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents:
171
diff
changeset
|
40 </template> |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
41 <script> |
194 | 42 HTMLImports.whenReady(function () { |
43 Polymer({ | |
44 is: 'linked-uri', | |
45 properties: { href: { notify: true } }, | |
46 behaviors: [BigastUri] | |
47 }); | |
193 | 48 }); |
49 </script> | |
50 </dom-module> | |
51 | |
52 <!-- subj/pred are compact uris --> | |
53 <dom-module id="watched-subgraph"> | |
54 <style> | |
55 .read { font-weight: bold; } | |
56 </style> | |
57 <template> | |
58 <rdf-observe graph="{{graph}}" subject="{{subj}}" predicate="{{pred}}" out="{{out}}"> | |
59 </rdf-observe> | |
60 | |
61 <div><span>{{compactUri(subj)}}</span>, <span>{{compactUri(pred)}}</span>, | |
62 <span class="read">{{formatted(out)}}</span> | |
63 </div> | |
64 | |
65 </template> | |
66 <script> | |
194 | 67 HTMLImports.whenReady(function () { |
68 Polymer({ | |
69 is: 'watched-subgraph', | |
70 properties: { | |
71 graph: { notify: true }, | |
72 out: { notify: true }, | |
73 pred: { notify: true }, | |
74 subj: { notify: true } | |
75 }, | |
76 behaviors: [BigastUri], | |
77 formatted: function (out) { | |
78 var obj = out[this.compactUri(this.pred)]; | |
79 if (typeof obj == 'string') { | |
80 return this.compactUri(obj); | |
81 } else { | |
82 return obj['@value']; | |
83 } | |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
84 } |
194 | 85 }); |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
86 }); |
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
87 </script> |
193 | 88 </dom-module> |
89 | |
90 <dom-module id="arduinonode-boards"> | |
91 <style> | |
92 h1 { | |
93 margin: 0; | |
94 font-size: 130%; | |
95 } | |
96 ul { | |
97 padding-left: 5px; | |
98 } | |
99 .board, .device { | |
100 border: 1px solid gray; | |
101 border-radius: 10px; | |
102 margin: 13px; | |
103 padding: 7px; | |
104 box-shadow: 2px 5px 5px rgba(0, 0, 0, 0.14); | |
105 } | |
106 .board { | |
107 background: rgb(244, 244, 244); | |
108 } | |
109 .device { | |
110 background: #fff; | |
111 } | |
112 </style> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
113 <template> |
193 | 114 <iron-ajax url="boards" auto="true" handle-as="json" |
115 last-response="{{ret}}"></iron-ajax> | |
116 <template is="dom-repeat" items="{{ret.boards}}" as="board"> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
117 <div class="board"> |
193 | 118 <h1>Board <linked-uri href$="{{board.uri}}"></linked-uri></h1> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
119 <h2>Devices</h2> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
120 <ul> |
193 | 121 <template is="dom-repeat" items="{{board.devices}}" as="dev"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
122 <div class="device"> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
123 <h1> |
193 | 124 <span>{{dev.className}}</span> |
125 <linked-uri href$="{{dev.uri}}"></linked-uri> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
126 </h1> |
193 | 127 <template is="dom-if" if="{{dev.watchPrefixes.length}}"> |
171 | 128 <div>watching:</div> |
129 <ul> | |
193 | 130 <template is="dom-repeat" items="{{dev.watchPrefixes}}" as="prefix"> |
131 <watched-subgraph graph="{{board.graph}}" subj="{{prefix.0}}" pred="{{prefix.1}}"></watched-subgraph> | |
171 | 132 </template> |
133 </ul> | |
134 </template> | |
135 | |
193 | 136 <template is="dom-if" if="{{dev.outputWidgets.length}}"> |
171 | 137 <div>send output:</div> |
138 <ul> | |
193 | 139 <template is="dom-repeat" items="{{dev.outputWidgets}}" as="out"> |
171 | 140 <div> |
141 <output-widget-any desc="{{out}}"></output-widget-any> | |
142 </div> | |
143 </template> | |
144 </ul> | |
145 </template> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
146 </div> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
147 </template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
148 </ul> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
149 </div> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
150 </template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
151 </template> |
193 | 152 <script> |
194 | 153 HTMLImports.whenReady(function () { |
154 Polymer({ | |
155 is: 'arduinonode-boards', | |
156 behaviors: [BigastUri] | |
157 }); | |
193 | 158 }); |
159 </script> | |
160 </dom-module> | |
194 | 161 <arduinonode-boards></arduinonode-boards> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
162 </body> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
163 </html> |