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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
7 <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents.min.js"></script>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
8 <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html">
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
9 <link rel="import" href="/lib/polymer/1.0.9/iron-ajax/iron-ajax.html">
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
18 display: flex;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
19 flex-direction: column;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
20 margin: 0;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
40 HTMLImports.whenReady(function () {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
41 Polymer({
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
42 is: 'linked-uri',
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
43 properties: { href: { notify: true } },
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
44 behaviors: [BigastUri]
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
45 });
193
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
46 });
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
47 </script>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
48 </dom-module>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
49
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
50 <!-- subj/pred are compact uris -->
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
51 <dom-module id="watched-subgraph">
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
52 <style>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
53 .read { font-weight: bold; }
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
54 </style>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
55 <template>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
56 <rdf-observe graph="{{graph}}" subject="{{subj}}" predicate="{{pred}}" out="{{out}}">
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
57 </rdf-observe>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
58
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
59 <div><span>{{compactUri(subj)}}</span>, <span>{{compactUri(pred)}}</span>,
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
60 <span class="read">{{formatted(out)}}</span>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
61 </div>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
62
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
63 </template>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
64 <script>
194
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
65 HTMLImports.whenReady(function () {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
66 Polymer({
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
67 is: 'watched-subgraph',
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
68 properties: {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
69 graph: { notify: true },
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
70 out: { notify: true },
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
71 pred: { notify: true },
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
72 subj: { notify: true }
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
73 },
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
74 behaviors: [BigastUri],
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
75 formatted: function (out) {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
76 var obj = out[this.compactUri(this.pred)];
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
77 if (typeof obj == 'string') {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
78 return this.compactUri(obj);
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
79 } else {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
80 return obj['@value'];
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
81 }
187
fc5fdcc3ed4a board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents: 173
diff changeset
82 }
194
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
86 </dom-module>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
87
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
88 <dom-module id="arduinonode-boards">
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
89 <style>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
90 h1 {
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
91 margin: 0;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
92 font-size: 130%;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
93 }
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
94 ul {
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
95 padding-left: 5px;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
96 }
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
97 .board, .device {
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
98 border: 1px solid gray;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
99 border-radius: 10px;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
100 margin: 13px;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
101 padding: 7px;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
102 box-shadow: 2px 5px 5px rgba(0, 0, 0, 0.14);
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
103 }
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
104 .board {
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
105 background: rgb(244, 244, 244);
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
106 }
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
107 .device {
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
108 background: #fff;
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
109 }
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
110 </style>
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
111 <template>
193
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
112 <iron-ajax url="boards" auto="true" handle-as="json"
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
113 last-response="{{ret}}"></iron-ajax>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
122 <span>{{dev.className}}</span>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
125 <template is="dom-if" if="{{dev.watchPrefixes.length}}">
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
126 <div>watching:</div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
127 <ul>
193
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
128 <template is="dom-repeat" items="{{dev.watchPrefixes}}" as="prefix">
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
129 <watched-subgraph graph="{{board.graph}}" subj="{{prefix.0}}" pred="{{prefix.1}}"></watched-subgraph>
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
130 </template>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
131 </ul>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
132 </template>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
133
193
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
134 <template is="dom-if" if="{{dev.outputWidgets.length}}">
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
135 <div>send output:</div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
136 <ul>
193
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
137 <template is="dom-repeat" items="{{dev.outputWidgets}}" as="out">
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
138 <div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
139 <output-widget-any desc="{{out}}"></output-widget-any>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
140 </div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
141 </template>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
142 </ul>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
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
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
150 <script>
194
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
151 HTMLImports.whenReady(function () {
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
152 Polymer({
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
153 is: 'arduinonode-boards',
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
154 behaviors: [BigastUri]
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
155 });
193
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
156 });
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
157 </script>
960b3b4cdd29 rewrite to polymer 1
drewp@bigasterisk.com
parents: 187
diff changeset
158 </dom-module>
194
35e07a9f3287 fix arduinoNode for safari
drewp@bigasterisk.com
parents: 193
diff changeset
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>