annotate service/arduinoNode/static/index.html @ 173:0daa8cbbd8f6

handle compact/full uris better, but still not always right Ignore-this: 10d98f16a659f899528eb86411473b18
author drewp@bigasterisk.com
date Fri, 17 Apr 2015 02:00:15 -0700
parents 4d2df276baae
children fc5fdcc3ed4a
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>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
5 <meta charset="utf-8" />
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
6 <link rel="import" href="/lib/polymer/0.5.2/polymer/polymer.html">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
7 <link rel="import" href="/lib/polymer/0.5.2/core-ajax/core-ajax.html">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
8 <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
9 <link rel="import" href="/room/ari/static/rdf-oneshot.html">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
10 <link rel="import" href="static/output-widgets.html">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
11
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
12 <style>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
13 body {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
14 font-family: monospace;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
15 }
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
16 </style>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
17 </head>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
18 <body layout vertical fullbleed>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
19 <script>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
20 window.NS = {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
21 dev: 'http://projects.bigasterisk.com/device/',
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
22 room: 'http://projects.bigasterisk.com/room/',
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
23 rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
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 </script>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
26
173
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
27 <script>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
28 PolymerExpressions.prototype.tojson = function(input) {
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
29 return JSON.stringify(input);
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
30 };
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
31
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
32 // not well defined for uri prefixes that are string prefixes of each other
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
33 PolymerExpressions.prototype.compactUri = function(uri) {
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
34 if (uri === undefined) {
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
35 return uri;
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
36 }
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
37 for (var short of Object.keys(window.NS)) {
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
38 var prefix = window.NS[short];
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
39 if (uri.indexOf(prefix) == 0) {
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
40 return short + ':' + uri.substr(prefix.length);
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
41 }
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
42 }
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
43 return uri;
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
44 };
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
45 </script>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
46
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
47 <polymer-element name="linked-uri" noscript attributes="href">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
48 <template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
49 <a href="{{href}}">{{href}}</a>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
50 </template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
51 </polymer-element>
173
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
52
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
53 <!-- subj/pred are compact uris -->
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
54 <polymer-element name="watched-subgraph" noscript attributes="subj pred">
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
55 <template>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
56 <style>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
57 .read { font-weight: bold; }
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
58 </style>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
59
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
60 <rdf-observe
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
61 graph="http://dash:9059/graph" xtodo="get host here"
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
62 subject="{{subj}}"
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
63 predicate="{{pred}}"
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
64 out="{{out}}">
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
65 </rdf-observe>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
66
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
67 <div>{{subj}}, {{pred}},
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
68 <span class="read">{{out[pred]['@value']}}</span>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
69 </div>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
70
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
71 </template>
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
72 </polymer-element>
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
73
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
74 <polymer-element name="arduinonode-boards" noscript>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
75 <template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
76 <style>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
77 h1 {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
78 margin: 0;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
79 font-size: 130%;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
80 }
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
81 ul {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
82 padding-left: 5px;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
83 }
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
84 .board, .device {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
85 border: 1px solid gray;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
86 border-radius: 10px;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
87 margin: 13px;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
88 padding: 7px;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
89 box-shadow: 2px 5px 5px rgba(0, 0, 0, 0.14);
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
90 }
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
91 .board {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
92 background: rgb(244, 244, 244);
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
93 }
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
94 .device {
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
95 background: #fff;
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
96 }
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
97 </style>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
98 <core-ajax
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
99 url="boards"
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
100 auto="true"
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
101 handleAs="json"
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
102 response="{{ret}}"></core-ajax>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
103 <template repeat="{{board in ret.boards}}">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
104 <div class="board">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
105 <h1>Board <linked-uri href="{{board.uri}}"></linked-uri></h1>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
106 <h2>Devices</h2>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
107 <ul>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
108 <template repeat="{{dev in board.devices}}">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
109 <div class="device">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
110 <h1>
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
111 {{dev.className}}
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
112 <linked-uri href="{{dev.uri}}"></linked-uri>
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
113 </h1>
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
114
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
115 <template if="{{dev.watchPrefixes.length}}">
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
116 <div>watching:</div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
117 <ul>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
118 <template repeat="{{prefix in dev.watchPrefixes}}">
173
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
119 <watched-subgraph
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
120 subj="{{prefix[0] | compactUri}}"
0daa8cbbd8f6 handle compact/full uris better, but still not always right
drewp@bigasterisk.com
parents: 171
diff changeset
121 pred="{{prefix[1] | compactUri}}"></watched-subgraph>
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
122 </template>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
123 </ul>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
124 </template>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
125
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
126 <template if="{{dev.outputWidgets.length}}">
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
127 <div>send output:</div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
128 <ul>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
129 <template repeat="{{out in dev.outputWidgets}}">
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
130 <div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
131 <output-widget-any desc="{{out}}"></output-widget-any>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
132 </div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
133 </template>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
134 </ul>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
135 </template>
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
136 </div>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
137 </template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
138 </ul>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
139 </div>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
140 </template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
141 </template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
142 </polymer-element>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
143 <arduinonode-boards></arduinonode-boards>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
144
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
145 <polymer-element name="data-dump" noscript>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
146 <template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
147 <rdf-observe
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
148 graph="http://dash:9059/graph"
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
149 subject="http://bigasterisk.com/homeauto/board1/oneWire/"
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
150 predicate="room:temperatureF"
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
151 out="{{out}}">
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
152 </rdf-observe>
171
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
153 <div>sees: {{out['room:temperatureF']['@value']}}</div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
154
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
155
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
156 <rdf-observe
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
157 graph="http://dash:9059/graph"
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
158 subject="http://bigasterisk.com/homeauto/board1/oneWire/"
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
159 predicate="http://projects.bigasterisk.com/room/temperatureRetries"
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
160 out="{{out2}}">
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
161 </rdf-observe>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
162 <div>sees2: {{out2['room:temperatureRetries']['@value']}}</div>
4d2df276baae clean up rdf-observe demo ui
drewp@bigasterisk.com
parents: 170
diff changeset
163
170
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
164 </template>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
165 </polymer-element>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
166 <!-- <data-dump></data-dump> -->
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
167 </body>
376599552a4c polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff changeset
168 </html>