Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/static/index.html @ 1038:ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
Ignore-this: cf7d20d54e134e8ff33a9ee405610846
darcs-hash:b4350a6308480857b2846a8518190b956981eef4
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 30 Jan 2016 06:40:00 -0800 |
parents | bf03f5185e8f |
children | d4a602576170 |
rev | line source |
---|---|
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 <!doctype html> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 <html> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 <head> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
4 <title>ha - </title> |
999 | 5 <meta name=viewport content="width=device-width, initial-scale=1"> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 <meta charset="utf-8" /> |
998 | 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"> | |
1003
58c939e2e121
arduinoNode config. missing import
drewp <drewp@bigasterisk.com>
parents:
999
diff
changeset
|
11 <link rel="import" href="/lib/polymer/1.0.9/paper-button/paper-button.html"> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
12 <link rel="import" href="/rdf/rdf-oneshot.html"> |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
13 <link rel="import" href="/rdf/rdf-uri.html"> |
1033
bf03f5185e8f
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp <drewp@bigasterisk.com>
parents:
1027
diff
changeset
|
14 <link rel="import" href="/rdf/streamed-graph.html"> |
bf03f5185e8f
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp <drewp@bigasterisk.com>
parents:
1027
diff
changeset
|
15 <link rel="import" href="/rdf/graph-view.html"> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
16 <link rel="import" href="static/output-widgets.html"> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 <style> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
18 body { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 font-family: monospace; |
998 | 20 display: flex; |
21 flex-direction: column; | |
22 margin: 0; | |
23 height: 100vh; | |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
24 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
25 </style> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
26 </head> |
998 | 27 <body> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
28 <script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
29 window.NS = { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
30 dev: 'http://projects.bigasterisk.com/device/', |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
31 room: 'http://projects.bigasterisk.com/room/', |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
32 rdfs: 'http://www.w3.org/2000/01/rdf-schema#', |
1023
3e6fac8569cd
multi-boards on one service, new devices, devices return their current
drewp <drewp@bigasterisk.com>
parents:
1003
diff
changeset
|
33 sensor: 'http://bigasterisk.com/homeauto/sensor/', |
3e6fac8569cd
multi-boards on one service, new devices, devices return their current
drewp <drewp@bigasterisk.com>
parents:
1003
diff
changeset
|
34 b0: 'http://bigasterisk.com/homeauto/board0/', |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
35 }; |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
36 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
37 |
998 | 38 <dom-module id="linked-uri"> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
39 <template> |
998 | 40 <a href$="{{href}}">{{compactUri(href)}}</a> |
978
e9ed6159b5fa
handle compact/full uris better, but still not always right
drewp <drewp@bigasterisk.com>
parents:
976
diff
changeset
|
41 </template> |
992
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
42 <script> |
999 | 43 HTMLImports.whenReady(function () { |
44 Polymer({ | |
45 is: 'linked-uri', | |
46 properties: { href: { notify: true } }, | |
47 behaviors: [BigastUri] | |
48 }); | |
998 | 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> | |
999 | 64 HTMLImports.whenReady(function () { |
65 Polymer({ | |
66 is: 'watched-subgraph', | |
67 properties: { | |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
68 streamedGraph: { notify: true, observer: 'onGraphChange' }, // streamed-graph output |
999 | 69 out: { notify: true }, |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
70 pred: { notify: true }, // uri |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
71 subj: { notify: true } // uri |
999 | 72 }, |
73 behaviors: [BigastUri], | |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
74 onGraphChange: function(streamedGraph) { |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
75 if (!streamedGraph.graph) { |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
76 return; |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
77 } |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
78 var env = streamedGraph.graph.store.rdf; |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
79 streamedGraph.graph.quadStore.quads({subject: env.createNamedNode(this.subj), |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
80 predicate: env.createNamedNode(this.pred)}, |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
81 function(quad) { |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
82 this.out = quad.object.valueOf(); |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
83 }.bind(this)); |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
84 }, |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
85 formatted: function (obj) { |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
86 if (typeof(obj) == 'string') { |
999 | 87 return this.compactUri(obj); |
88 } else { | |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
89 return obj; |
999 | 90 } |
992
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
91 } |
999 | 92 }); |
992
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
93 }); |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
94 </script> |
998 | 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 } | |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
119 .devs { |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
120 -webkit-column-width: 440px; |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
121 } |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
122 .devs .device { |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
123 -webkit-column-break-inside: avoid; |
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
124 } |
998 | 125 </style> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
126 <template> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
127 <streamed-graph url="graph/events" graph="{{graph}}"></streamed-graph> |
998 | 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"> | |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
131 <div class="board"> |
998 | 132 <h1>Board <linked-uri href$="{{board.uri}}"></linked-uri></h1> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
133 <h2>Devices</h2> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
134 <ul class="devs"> |
998 | 135 <template is="dom-repeat" items="{{board.devices}}" as="dev"> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
136 <div class="device"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
137 <h1> |
998 | 138 <span>{{dev.className}}</span> |
139 <linked-uri href$="{{dev.uri}}"></linked-uri> | |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
140 </h1> |
998 | 141 <template is="dom-if" if="{{dev.watchPrefixes.length}}"> |
976 | 142 <div>watching:</div> |
143 <ul> | |
998 | 144 <template is="dom-repeat" items="{{dev.watchPrefixes}}" as="prefix"> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
145 <watched-subgraph streamed-graph="{{graph}}" subj="{{prefix.0}}" pred="{{prefix.1}}"></watched-subgraph> |
976 | 146 </template> |
147 </ul> | |
148 </template> | |
149 | |
998 | 150 <template is="dom-if" if="{{dev.outputWidgets.length}}"> |
976 | 151 <div>send output:</div> |
152 <ul> | |
998 | 153 <template is="dom-repeat" items="{{dev.outputWidgets}}" as="out"> |
976 | 154 <div> |
1038
ffe6a00c6cef
server/browser graph sync. cut dependency on the WS version. merge some changes between arduino/pi code.
drewp <drewp@bigasterisk.com>
parents:
1033
diff
changeset
|
155 <output-widget-any streamed-graph="{{graph}}" desc="{{out}}"></output-widget-any> |
976 | 156 </div> |
157 </template> | |
158 </ul> | |
159 </template> | |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
160 </div> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
161 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
162 </ul> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
163 </div> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
164 </template> |
1033
bf03f5185e8f
add synced graph-view to the bottom of arduinoNode/piNode tester page
drewp <drewp@bigasterisk.com>
parents:
1027
diff
changeset
|
165 <graph-view graph="{{graph}}"></graph-view> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
166 </template> |
998 | 167 <script> |
999 | 168 HTMLImports.whenReady(function () { |
169 Polymer({ | |
170 is: 'arduinonode-boards', | |
1027 | 171 properties: { |
172 ret: { type: Object, notify: true, observer: 'onBoards' } | |
173 }, | |
174 onBoards: function() { | |
175 document.title = document.title + ' ' + this.ret.host; | |
176 }, | |
999 | 177 behaviors: [BigastUri] |
178 }); | |
998 | 179 }); |
180 </script> | |
181 </dom-module> | |
999 | 182 <arduinonode-boards></arduinonode-boards> |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
183 </body> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
184 </html> |