annotate service/wifi/index.html @ 1231:996a00d72979

use :connectedToNetwork on index table Ignore-this: c48bd43f2b18291ec1df2b70591a74d8 darcs-hash:d05cad1f18b8421a443bc6cd7c144368048bf203
author drewp <drewp@bigasterisk.com>
date Thu, 04 Apr 2019 02:22:04 -0700
parents 34de6cfa0b6b
children 4afb1830bb5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1223
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
1 <!doctype html>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
2 <html>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
3 <head>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
4 <title>wifi</title>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
5 <meta charset="utf-8" />
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
6 <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents-lite.min.js"></script>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
7 <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html">
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
8 <script src="/lib/underscore-1.5.2.min.js"></script>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
9 <link rel="import" href="/lib/polymer/1.0.9/iron-ajax/iron-ajax.html">
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
10 <link rel="import" href="/rdf/n3+polymer/trig-store.html">
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
11 </head>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
12 <body>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
13 <h1>Devices on wifi</h1>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
14 <p><a href="../dhcpleases">go to dhcpleases</a></p>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
15 <dom-module id="wifi-table">
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
16 <template>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
17 <iron-ajax auto url="graph"
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
18 handle-as="text"
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
19 last-response="{{ajaxResponse}}"></iron-ajax>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
20 <trig-store id="ts" trig-input="{{ajaxResponse}}"></trig-store>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
21
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
22 <table>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
23 <tr>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
24 <th>name</th>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
25 <th>MAC</th>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
26 <th>Connected</th>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
27 </tr>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
28 <template is="dom-repeat" items="{{devices}}">
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
29 <tr>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
30 <td>{{item.deviceName}}</td>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
31 <td>{{item.mac}}</td>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
32 <td>{{item.connectedAgo}}</td>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
33 </tr>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
34 </template>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
35 </table>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
36 </template>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
37
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
38 <script>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
39 HTMLImports.whenReady(function () {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
40 Polymer({
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
41 is: "wifi-table",
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
42 ready: function() {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
43 this.$.ts.addEventListener('store-changed', this.storeChanged.bind(this));
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
44 this.devices = [];
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
45 },
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
46 storeChanged: function(ev) {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
47 var store = ev.detail.value;
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
48 var find = function(s, p, o) { return store.findAllGraphs(s, p, o); };
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
49 var findOne = function(s, p, o) {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
50 var rows = find(s, p, o);
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
51 return rows[0];
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
52 };
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
53
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
54 this.devices = [];
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
55
1231
996a00d72979 use :connectedToNetwork on index table
drewp <drewp@bigasterisk.com>
parents: 1223
diff changeset
56 find(null, "room:connectedToNetwork", "http://bigasterisk.com/wifiAccessPoints"
1223
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
57 ).forEach(function(row) {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
58 var out = {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
59 mac: N3.Util.getLiteralValue(
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
60 findOne(row.subject, "room:macAddress", null).object),
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
61 connectedAgo: N3.Util.getLiteralValue(
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
62 findOne(row.subject, "room:connectedAgo", null).object)
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
63
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
64 };
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
65 try {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
66 var dev = findOne(row.subject, "room:deviceName", null).object;
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
67 out.deviceName = N3.Util.getLiteralValue(dev);
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
68 } catch(e) {
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
69
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
70 }
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
71
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
72 this.devices.push(out);
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
73 }.bind(this));
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
74 this.devices = _.sortBy(this.devices, 'deviceName');
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
75 }
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
76 });
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
77 });
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
78 </script>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
79 </dom-module>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
80 <wifi-table></wifi-table>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
81 </body>
34de6cfa0b6b rename historical 'tomatoWifi'
drewp <drewp@bigasterisk.com>
parents:
diff changeset
82 </html>