Mercurial > code > home > repos > homeauto
annotate lib/homeauto_anynode/static/index.html @ 535:bb43ad96da8c
start homeauto_anynode for files shared between arduino and pi
Ignore-this: 607e3e6e8d43f339caf6758f14619576
author | drewp@bigasterisk.com |
---|---|
date | Thu, 25 Apr 2019 17:34:53 -0700 |
parents | service/arduinoNode/static/index.html@d4a602576170 |
children | 62b52bb862f7 |
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> |
319
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
8 <script src="/lib/require/require-2.3.3.js"></script> |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
9 <script> |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
10 requirejs.config({ |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
11 paths: { |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
12 "streamed-graph": "/rdf/streamed-graph", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
13 "quadstore": "/rdf/quadstore", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
14 "async-module": "/lib/async/80f1793/async", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
15 "async": "/lib/async/80f1793/async", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
16 "jsonld-module": "/lib/jsonld.js/0.4.11/js/jsonld", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
17 "jsonld": "/lib/jsonld.js/0.4.11/js/jsonld", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
18 "rdfstore": "/lib/rdf_store/0.9.7/dist/rdfstore", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
19 "moment": "/lib/moment.min", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
20 "underscore": "/lib/underscore-1.5.2.min", |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
21 } |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
22 }); |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
23 </script> |
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
24 |
193 | 25 <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html"> |
26 <link rel="import" href="/lib/polymer/1.0.9/iron-ajax/iron-ajax.html"> | |
27 <link rel="import" href="/lib/polymer/1.0.9/iron-flex-layout/iron-flex-layout.html"> | |
198 | 28 <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
|
29 <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
|
30 <link rel="import" href="/rdf/rdf-uri.html"> |
319
d4a602576170
requirejs config for streamed-graph to use
drewp@bigasterisk.com
parents:
233
diff
changeset
|
31 <link rel="import" href="/rdf/graph-view.html"> |
228
f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp@bigasterisk.com
parents:
222
diff
changeset
|
32 <link rel="import" href="/rdf/streamed-graph.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
|
33 <link rel="import" href="static/output-widgets.html"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
34 <style> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
35 body { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
36 font-family: monospace; |
193 | 37 display: flex; |
38 flex-direction: column; | |
39 margin: 0; | |
40 height: 100vh; | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
41 } |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
42 </style> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
43 </head> |
193 | 44 <body> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
45 <script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
46 window.NS = { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
47 dev: 'http://projects.bigasterisk.com/device/', |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
48 room: 'http://projects.bigasterisk.com/room/', |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
49 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
|
50 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
|
51 b0: 'http://bigasterisk.com/homeauto/board0/', |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
52 }; |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
53 </script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
54 |
193 | 55 <dom-module id="linked-uri"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
56 <template> |
193 | 57 <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
|
58 </template> |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
59 <script> |
194 | 60 HTMLImports.whenReady(function () { |
61 Polymer({ | |
62 is: 'linked-uri', | |
63 properties: { href: { notify: true } }, | |
64 behaviors: [BigastUri] | |
65 }); | |
193 | 66 }); |
67 </script> | |
68 </dom-module> | |
69 | |
70 <dom-module id="watched-subgraph"> | |
71 <style> | |
72 .read { font-weight: bold; } | |
73 </style> | |
74 <template> | |
75 <div><span>{{compactUri(subj)}}</span>, <span>{{compactUri(pred)}}</span>, | |
76 <span class="read">{{formatted(out)}}</span> | |
77 </div> | |
78 | |
79 </template> | |
80 <script> | |
194 | 81 HTMLImports.whenReady(function () { |
82 Polymer({ | |
83 is: 'watched-subgraph', | |
84 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
|
85 streamedGraph: { notify: true, observer: 'onGraphChange' }, // streamed-graph output |
194 | 86 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
|
87 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
|
88 subj: { notify: true } // uri |
194 | 89 }, |
90 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
|
91 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
|
92 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
|
93 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
|
94 } |
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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 }.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
|
101 }, |
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
|
102 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
|
103 if (typeof(obj) == 'string') { |
194 | 104 return this.compactUri(obj); |
105 } 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
|
106 return obj; |
194 | 107 } |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
108 } |
194 | 109 }); |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
110 }); |
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
111 </script> |
193 | 112 </dom-module> |
113 | |
114 <dom-module id="arduinonode-boards"> | |
115 <style> | |
116 h1 { | |
117 margin: 0; | |
118 font-size: 130%; | |
119 } | |
120 ul { | |
121 padding-left: 5px; | |
122 } | |
123 .board, .device { | |
124 border: 1px solid gray; | |
125 border-radius: 10px; | |
126 margin: 13px; | |
127 padding: 7px; | |
128 box-shadow: 2px 5px 5px rgba(0, 0, 0, 0.14); | |
129 } | |
130 .board { | |
131 background: rgb(244, 244, 244); | |
132 } | |
133 .device { | |
134 background: #fff; | |
135 } | |
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
|
136 .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
|
137 -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
|
138 } |
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
|
139 .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
|
140 -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
|
141 } |
193 | 142 </style> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
143 <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
|
144 <streamed-graph url="graph/events" graph="{{graph}}"></streamed-graph> |
193 | 145 <iron-ajax url="boards" auto="true" handle-as="json" |
146 last-response="{{ret}}"></iron-ajax> | |
147 <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
|
148 <div class="board"> |
193 | 149 <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
|
150 <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
|
151 <ul class="devs"> |
193 | 152 <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
|
153 <div class="device"> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
154 <h1> |
193 | 155 <span>{{dev.className}}</span> |
156 <linked-uri href$="{{dev.uri}}"></linked-uri> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
157 </h1> |
193 | 158 <template is="dom-if" if="{{dev.watchPrefixes.length}}"> |
171 | 159 <div>watching:</div> |
160 <ul> | |
193 | 161 <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
|
162 <watched-subgraph streamed-graph="{{graph}}" subj="{{prefix.0}}" pred="{{prefix.1}}"></watched-subgraph> |
171 | 163 </template> |
164 </ul> | |
165 </template> | |
166 | |
193 | 167 <template is="dom-if" if="{{dev.outputWidgets.length}}"> |
171 | 168 <div>send output:</div> |
169 <ul> | |
193 | 170 <template is="dom-repeat" items="{{dev.outputWidgets}}" as="out"> |
171 | 171 <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
|
172 <output-widget-any streamed-graph="{{graph}}" desc="{{out}}"></output-widget-any> |
171 | 173 </div> |
174 </template> | |
175 </ul> | |
176 </template> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
177 </div> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
178 </template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
179 </ul> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
180 </div> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
181 </template> |
228
f609e1eee4db
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp@bigasterisk.com
parents:
222
diff
changeset
|
182 <graph-view graph="{{graph}}"></graph-view> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
183 </template> |
193 | 184 <script> |
194 | 185 HTMLImports.whenReady(function () { |
186 Polymer({ | |
187 is: 'arduinonode-boards', | |
222 | 188 properties: { |
189 ret: { type: Object, notify: true, observer: 'onBoards' } | |
190 }, | |
191 onBoards: function() { | |
192 document.title = document.title + ' ' + this.ret.host; | |
193 }, | |
194 | 194 behaviors: [BigastUri] |
195 }); | |
193 | 196 }); |
197 </script> | |
198 </dom-module> | |
194 | 199 <arduinonode-boards></arduinonode-boards> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
200 </body> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
201 </html> |