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