Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/static/index.html @ 228:f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
Ignore-this: 78a82a81ca80b3499d7bf13faf0e114b
author | drewp@bigasterisk.com |
---|---|
date | Tue, 26 Jan 2016 03:46:05 -0800 |
parents | e606f1d89d89 |
children | 4ebb5cc30002 |
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> |
222 | 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"> |
228
f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp@bigasterisk.com
parents:
222
diff
changeset
|
16 <link rel="import" href="/rdf/streamed-graph.html"> |
f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp@bigasterisk.com
parents:
222
diff
changeset
|
17 <link rel="import" href="/rdf/graph-view.html"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
18 <style> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
19 body { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
20 font-family: monospace; |
193 | 21 display: flex; |
22 flex-direction: column; | |
23 margin: 0; | |
24 height: 100vh; | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
25 } |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
26 </style> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
27 </head> |
193 | 28 <body> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
29 <script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
30 window.NS = { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
31 dev: 'http://projects.bigasterisk.com/device/', |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
32 room: 'http://projects.bigasterisk.com/room/', |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
33 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
|
34 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
|
35 b0: 'http://bigasterisk.com/homeauto/board0/', |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
36 }; |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
37 </script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
38 |
193 | 39 <dom-module id="linked-uri"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
40 <template> |
193 | 41 <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
|
42 </template> |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
43 <script> |
194 | 44 HTMLImports.whenReady(function () { |
45 Polymer({ | |
46 is: 'linked-uri', | |
47 properties: { href: { notify: true } }, | |
48 behaviors: [BigastUri] | |
49 }); | |
193 | 50 }); |
51 </script> | |
52 </dom-module> | |
53 | |
54 <!-- subj/pred are compact uris --> | |
55 <dom-module id="watched-subgraph"> | |
56 <style> | |
57 .read { font-weight: bold; } | |
58 </style> | |
59 <template> | |
60 <rdf-observe graph="{{graph}}" subject="{{subj}}" predicate="{{pred}}" out="{{out}}"> | |
61 </rdf-observe> | |
62 | |
63 <div><span>{{compactUri(subj)}}</span>, <span>{{compactUri(pred)}}</span>, | |
64 <span class="read">{{formatted(out)}}</span> | |
65 </div> | |
66 | |
67 </template> | |
68 <script> | |
194 | 69 HTMLImports.whenReady(function () { |
70 Polymer({ | |
71 is: 'watched-subgraph', | |
72 properties: { | |
73 graph: { notify: true }, | |
74 out: { notify: true }, | |
75 pred: { notify: true }, | |
76 subj: { notify: true } | |
77 }, | |
78 behaviors: [BigastUri], | |
79 formatted: function (out) { | |
80 var obj = out[this.compactUri(this.pred)]; | |
81 if (typeof obj == 'string') { | |
82 return this.compactUri(obj); | |
83 } else { | |
84 return obj['@value']; | |
85 } | |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
86 } |
194 | 87 }); |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
88 }); |
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
89 </script> |
193 | 90 </dom-module> |
91 | |
92 <dom-module id="arduinonode-boards"> | |
93 <style> | |
94 h1 { | |
95 margin: 0; | |
96 font-size: 130%; | |
97 } | |
98 ul { | |
99 padding-left: 5px; | |
100 } | |
101 .board, .device { | |
102 border: 1px solid gray; | |
103 border-radius: 10px; | |
104 margin: 13px; | |
105 padding: 7px; | |
106 box-shadow: 2px 5px 5px rgba(0, 0, 0, 0.14); | |
107 } | |
108 .board { | |
109 background: rgb(244, 244, 244); | |
110 } | |
111 .device { | |
112 background: #fff; | |
113 } | |
114 </style> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
115 <template> |
193 | 116 <iron-ajax url="boards" auto="true" handle-as="json" |
117 last-response="{{ret}}"></iron-ajax> | |
118 <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
|
119 <div class="board"> |
193 | 120 <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
|
121 <h2>Devices</h2> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
122 <ul> |
193 | 123 <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
|
124 <div class="device"> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
125 <h1> |
193 | 126 <span>{{dev.className}}</span> |
127 <linked-uri href$="{{dev.uri}}"></linked-uri> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
128 </h1> |
193 | 129 <template is="dom-if" if="{{dev.watchPrefixes.length}}"> |
171 | 130 <div>watching:</div> |
131 <ul> | |
193 | 132 <template is="dom-repeat" items="{{dev.watchPrefixes}}" as="prefix"> |
133 <watched-subgraph graph="{{board.graph}}" subj="{{prefix.0}}" pred="{{prefix.1}}"></watched-subgraph> | |
171 | 134 </template> |
135 </ul> | |
136 </template> | |
137 | |
193 | 138 <template is="dom-if" if="{{dev.outputWidgets.length}}"> |
171 | 139 <div>send output:</div> |
140 <ul> | |
193 | 141 <template is="dom-repeat" items="{{dev.outputWidgets}}" as="out"> |
171 | 142 <div> |
143 <output-widget-any desc="{{out}}"></output-widget-any> | |
144 </div> | |
145 </template> | |
146 </ul> | |
147 </template> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
148 </div> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
149 </template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
150 </ul> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
151 </div> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
152 </template> |
228
f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp@bigasterisk.com
parents:
222
diff
changeset
|
153 <streamed-graph url="graph/events" graph="{{graph}}"></streamed-graph> |
f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp@bigasterisk.com
parents:
222
diff
changeset
|
154 <graph-view graph="{{graph}}"></graph-view> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
155 </template> |
193 | 156 <script> |
194 | 157 HTMLImports.whenReady(function () { |
158 Polymer({ | |
159 is: 'arduinonode-boards', | |
222 | 160 properties: { |
161 ret: { type: Object, notify: true, observer: 'onBoards' } | |
162 }, | |
163 onBoards: function() { | |
164 document.title = document.title + ' ' + this.ret.host; | |
165 }, | |
194 | 166 behaviors: [BigastUri] |
167 }); | |
193 | 168 }); |
169 </script> | |
170 </dom-module> | |
194 | 171 <arduinonode-boards></arduinonode-boards> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
172 </body> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
173 </html> |