comparison service/arduinoNode/static/index.html @ 187:fc5fdcc3ed4a

board control ui: output-rgb, fix ajax protocol, display output uris Ignore-this: f3d3e6739851232d2177eacdd833c16
author drewp@bigasterisk.com
date Wed, 08 Jul 2015 01:22:37 -0700
parents 0daa8cbbd8f6
children 960b3b4cdd29
comparison
equal deleted inserted replaced
186:57e6d328d45b 187:fc5fdcc3ed4a
19 <script> 19 <script>
20 window.NS = { 20 window.NS = {
21 dev: 'http://projects.bigasterisk.com/device/', 21 dev: 'http://projects.bigasterisk.com/device/',
22 room: 'http://projects.bigasterisk.com/room/', 22 room: 'http://projects.bigasterisk.com/room/',
23 rdfs: 'http://www.w3.org/2000/01/rdf-schema#', 23 rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
24 sensor: 'http://bigasterisk.com/homeauto/sensor/'
24 }; 25 };
25 </script> 26 </script>
26 27
27 <script> 28 <script>
28 PolymerExpressions.prototype.tojson = function(input) { 29 PolymerExpressions.prototype.tojson = function(input) {
44 }; 45 };
45 </script> 46 </script>
46 47
47 <polymer-element name="linked-uri" noscript attributes="href"> 48 <polymer-element name="linked-uri" noscript attributes="href">
48 <template> 49 <template>
49 <a href="{{href}}">{{href}}</a> 50 <a href="{{href}}">{{href | compactUri}}</a>
50 </template> 51 </template>
51 </polymer-element> 52 </polymer-element>
52 53
53 <!-- subj/pred are compact uris --> 54 <!-- subj/pred are compact uris -->
54 <polymer-element name="watched-subgraph" noscript attributes="subj pred"> 55 <polymer-element name="watched-subgraph" attributes="graph subj pred">
55 <template> 56 <template>
56 <style> 57 <style>
57 .read { font-weight: bold; } 58 .read { font-weight: bold; }
58 </style> 59 </style>
59 60
60 <rdf-observe 61 <rdf-observe
61 graph="http://dash:9059/graph" xtodo="get host here" 62 graph="{{graph}}"
62 subject="{{subj}}" 63 subject="{{subj}}"
63 predicate="{{pred}}" 64 predicate="{{pred}}"
64 out="{{out}}"> 65 out="{{out}}">
65 </rdf-observe> 66 </rdf-observe>
66 67
67 <div>{{subj}}, {{pred}}, 68 <div>{{subj | compactUri}}, {{pred | compactUri}},
68 <span class="read">{{out[pred]['@value']}}</span> 69 <span class="read">{{formattedOut}}</span>
69 </div> 70 </div>
70 71
71 </template> 72 </template>
73 <script>
74 Polymer({
75 outChanged: function() {
76 var obj = this.out[this.pred];
77 if (typeof(obj) == 'string') {
78 this.formattedOut = PolymerExpressions.prototype.compactUri(obj);
79 } else {
80 this.formattedOut = obj['@value'];
81 }
82 }
83 });
84 </script>
85
72 </polymer-element> 86 </polymer-element>
73 87
74 <polymer-element name="arduinonode-boards" noscript> 88 <polymer-element name="arduinonode-boards" noscript>
75 <template> 89 <template>
76 <style> 90 <style>
115 <template if="{{dev.watchPrefixes.length}}"> 129 <template if="{{dev.watchPrefixes.length}}">
116 <div>watching:</div> 130 <div>watching:</div>
117 <ul> 131 <ul>
118 <template repeat="{{prefix in dev.watchPrefixes}}"> 132 <template repeat="{{prefix in dev.watchPrefixes}}">
119 <watched-subgraph 133 <watched-subgraph
134 graph="{{board.graph}}"
120 subj="{{prefix[0] | compactUri}}" 135 subj="{{prefix[0] | compactUri}}"
121 pred="{{prefix[1] | compactUri}}"></watched-subgraph> 136 pred="{{prefix[1] | compactUri}}"></watched-subgraph>
122 </template> 137 </template>
123 </ul> 138 </ul>
124 </template> 139 </template>