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