Mercurial > code > home > repos > homeauto
view service/wifi/index.html @ 1433:be9b456717bd
round numbers. py3 updates. ws
Ignore-this: d1191987ce8070c9700a26b89436478a
darcs-hash:284883b8403f0563572a154cca19d5e96a5e5654
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 11 Aug 2019 03:25:20 -0700 |
parents | 996a00d72979 |
children | 4afb1830bb5e |
line wrap: on
line source
<!doctype html> <html> <head> <title>wifi</title> <meta charset="utf-8" /> <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html"> <script src="/lib/underscore-1.5.2.min.js"></script> <link rel="import" href="/lib/polymer/1.0.9/iron-ajax/iron-ajax.html"> <link rel="import" href="/rdf/n3+polymer/trig-store.html"> </head> <body> <h1>Devices on wifi</h1> <p><a href="../dhcpleases">go to dhcpleases</a></p> <dom-module id="wifi-table"> <template> <iron-ajax auto url="graph" handle-as="text" last-response="{{ajaxResponse}}"></iron-ajax> <trig-store id="ts" trig-input="{{ajaxResponse}}"></trig-store> <table> <tr> <th>name</th> <th>MAC</th> <th>Connected</th> </tr> <template is="dom-repeat" items="{{devices}}"> <tr> <td>{{item.deviceName}}</td> <td>{{item.mac}}</td> <td>{{item.connectedAgo}}</td> </tr> </template> </table> </template> <script> HTMLImports.whenReady(function () { Polymer({ is: "wifi-table", ready: function() { this.$.ts.addEventListener('store-changed', this.storeChanged.bind(this)); this.devices = []; }, storeChanged: function(ev) { var store = ev.detail.value; var find = function(s, p, o) { return store.findAllGraphs(s, p, o); }; var findOne = function(s, p, o) { var rows = find(s, p, o); return rows[0]; }; this.devices = []; find(null, "room:connectedToNetwork", "http://bigasterisk.com/wifiAccessPoints" ).forEach(function(row) { var out = { mac: N3.Util.getLiteralValue( findOne(row.subject, "room:macAddress", null).object), connectedAgo: N3.Util.getLiteralValue( findOne(row.subject, "room:connectedAgo", null).object) }; try { var dev = findOne(row.subject, "room:deviceName", null).object; out.deviceName = N3.Util.getLiteralValue(dev); } catch(e) { } this.devices.push(out); }.bind(this)); this.devices = _.sortBy(this.devices, 'deviceName'); } }); }); </script> </dom-module> <wifi-table></wifi-table> </body> </html>