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