Mercurial > code > home > repos > homeauto
annotate service/wifi/src/index.ts @ 677:008718fc336a
some type notes and cleanups
Ignore-this: 93fd167cf1951c6fb20aa45ff0a28f24
author | drewp@bigasterisk.com |
---|---|
date | Mon, 06 Jan 2020 00:04:18 -0800 |
parents | 4bd77a9548d6 |
children | edbce8aa7107 |
rev | line source |
---|---|
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
1 // for the web page |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
2 export { DomBind } from "@polymer/polymer/lib/elements/dom-bind.js"; |
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
3 |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
4 import { LitElement, property, html, customElement } from "lit-element"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
5 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
6 import { Literal, Term, N3Store, Util } from "n3"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
7 import { NamedNode, DataFactory } from "n3"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
8 const { literal, quad, namedNode } = DataFactory; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
9 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
10 import { VersionedGraph } from "streamed-graph"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
11 export { StreamedGraph } from "streamed-graph"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
12 import { style } from "./style"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
13 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
14 interface DevGroup { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
15 connectedToAp: NamedNode; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
16 wifiBand: NamedNode; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
17 devs: Array<Dev>; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
18 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
19 interface Dev { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
20 agoMin: number | undefined; |
677 | 21 ipAddress: Literal; // todo no one wants this literal. just make it string. |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
22 dhcpHostname: string; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
23 macAddress: Literal; |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
24 packetsPerSec: number; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
25 packetsPerSecDisplay: string; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
26 bytesPerSec: number; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
27 bytesPerSecDisplay: string; |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
28 } |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
29 const room = "http://projects.bigasterisk.com/room/"; |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
30 |
677 | 31 ////////////////// funcs that could move out ////////////////////////////// |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
32 // workaround for uris that don't have good labels in the graph |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
33 function labelFromUri( |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
34 uri: NamedNode, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
35 prefix: string, |
677 | 36 tailsToLabels: {[key: string]: string}, |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
37 defaultLabel: string |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
38 ) { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
39 let label = defaultLabel === undefined ? uri.value : defaultLabel; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
40 Object.entries(tailsToLabels).forEach(([tail, useLabel]) => { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
41 if (uri.equals(namedNode(prefix + tail))) { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
42 label = useLabel as string; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
43 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
44 }); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
45 return label; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
46 } |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
47 function asString(x: Literal | undefined): string { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
48 if (x && x.value) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
49 return x.value; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
50 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
51 return "(unknown)"; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
52 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
53 |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
54 function graphLiteral( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
55 store: N3Store, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
56 subj: NamedNode, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
57 pred: string, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
58 notFoundResult?: string |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
59 ): Literal { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
60 const keep: Array<Literal> = []; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
61 store.forEach( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
62 q => { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
63 if (!Util.isLiteral(q.object)) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
64 throw new Error("non literal found"); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
65 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
66 let seen = false; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
67 for (let other of keep) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
68 if (other.equals(q.object)) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
69 seen = true; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
70 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
71 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
72 if (!seen) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
73 keep.push(q.object as Literal); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
74 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
75 }, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
76 subj, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
77 namedNode(pred), |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
78 null, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
79 null |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
80 ); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
81 if (keep.length == 0) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
82 return literal(notFoundResult || "(missing)"); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
83 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
84 if (keep.length == 1) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
85 return keep[0]; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
86 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
87 console.log(`${subj.value} ${pred} had ${keep.length} objects:`, keep); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
88 return keep[0]; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
89 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
90 |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
91 function graphUriValue( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
92 store: N3Store, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
93 subj: NamedNode, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
94 pred: string |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
95 ): NamedNode | undefined { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
96 const keep: Array<NamedNode> = []; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
97 store.forEach( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
98 q => { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
99 if (!Util.isNamedNode(q.object)) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
100 throw new Error("non uri found"); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
101 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
102 keep.push(q.object as NamedNode); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
103 }, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
104 subj, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
105 namedNode(pred), |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
106 null, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
107 null |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
108 ); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
109 if (keep.length == 0) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
110 return undefined; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
111 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
112 if (keep.length == 1) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
113 return keep[0]; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
114 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
115 throw new Error("found multiple matches for pred"); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
116 } |
677 | 117 ////////////////////////////////////////////////////////////////////////////////// |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
118 |
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
119 @customElement("wifi-display") |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
120 class WifiDisplay extends LitElement { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
121 static get styles() { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
122 return [style]; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
123 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
124 |
677 | 125 @property({ type: Object }) |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
126 graph!: VersionedGraph; |
673
f2215949c0c9
build adjustments. now seems to read streamedgraph correctly.
drewp@bigasterisk.com
parents:
diff
changeset
|
127 |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
128 connectedCallback() { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
129 super.connectedCallback(); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
130 console.log("wifidisplay connected"); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
131 const sg = this.ownerDocument!.querySelector("streamed-graph"); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
132 sg?.addEventListener("graph-changed", ((ev: CustomEvent) => { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
133 this.graph = ev.detail!.value as VersionedGraph; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
134 console.log("wifidisplay got new graph", this.graph); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
135 }) as EventListener); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
136 } |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
137 |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
138 static get observers() { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
139 return ["onGraphChanged(graph)"]; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
140 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
141 |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
142 @property({ type: Boolean }) |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
143 showGroups = false; |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
144 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
145 render() { |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
146 const grouped = this.graphView(this.graph.store!); |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
147 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
148 return html` |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
149 <div class="report"> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
150 report at graph version ${this.graph.version} grouped: |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
151 ${Array.from(grouped.entries()).length} |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
152 <table> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
153 ${Array.from(grouped.entries()).map((row: [string, DevGroup]) => { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
154 return this.renderGroup(row[0], row[1]); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
155 })} |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
156 </table> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
157 </div> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
158 `; |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
159 } |
673
f2215949c0c9
build adjustments. now seems to read streamedgraph correctly.
drewp@bigasterisk.com
parents:
diff
changeset
|
160 |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
161 renderDevice(dev: Dev) { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
162 let agoReport = ""; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
163 if (dev.agoMin === undefined) { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
164 agoReport = "unknown"; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
165 } else { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
166 const glow = Math.max(0, 1 - dev.agoMin! / 60); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
167 agoReport = |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
168 dev.agoMin! < 360 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
169 ? ` (${Math.ceil(dev.agoMin! * 10) / 10} minutes ago)` |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
170 : ""; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
171 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
172 const glow = ""; //todo |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
173 return html` |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
174 <div class="dev" style="background: rgba(185, 5, 138, ${glow});"> |
677 | 175 <span class="mac">${dev.macAddress.value}</span> |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
176 <span class="ip" |
677 | 177 ><a href="http://${dev.ipAddress.value}/" |
178 >${dev.ipAddress.value}</a | |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
179 ></span |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
180 > |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
181 <span class="packets">${dev.packetsPerSecDisplay}</span> |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
182 <span class="bytes">${dev.bytesPerSecDisplay}</span> |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
183 <span class="hostname">${dev.dhcpHostname}</span> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
184 <span class="ago">${agoReport}</span> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
185 <span class="links"> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
186 <a |
677 | 187 href="https://bigasterisk.com/ntop/lua/host_details.lua?ifid=17&host=${dev.ipAddress.value}&page=flows" |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
188 >[flows]</a |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
189 > |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
190 </span> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
191 </div> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
192 `; |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
193 } |
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
194 |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
195 renderGroup(key: string, group: DevGroup) { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
196 let label; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
197 if (key != "all") { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
198 label = labelFromUri( |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
199 group.connectedToAp, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
200 "http://bigasterisk.com/mac/", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
201 { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
202 "a0:40:a0:6f:96:d5": "Main router (d5)", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
203 "8c:3b:ad:c4:8d:ce": "Downstairs satellite (ce)", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
204 "a0:40:a0:6f:aa:f8": "Upstairs satellite (f8)", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
205 }, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
206 "unknown" |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
207 ); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
208 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
209 label += labelFromUri( |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
210 group.wifiBand, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
211 "http://projects.bigasterisk.com/room/wifiBand/", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
212 { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
213 "5G": " 5G", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
214 "2.4G": " 2.4G", |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
215 }, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
216 "unknown" |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
217 ); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
218 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
219 |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
220 const devs = group.devs; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
221 function padIp(ip: string) { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
222 return ip.replace(/(\d+)/g, m => ("00" + m).slice(-3)); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
223 } |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
224 devs.sort((a, b) => { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
225 return padIp(a.ipAddress.value) > padIp(b.ipAddress.value) ? 1 : -1; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
226 }); |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
227 return html` |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
228 <tr> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
229 <th>${label}</th> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
230 <td> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
231 <div>Devices:</div> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
232 ${devs.map(d => { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
233 return this.renderDevice(d); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
234 })} |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
235 </td> |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
236 </tr> |
674
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
237 `; |
2b9865bf1737
streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents:
673
diff
changeset
|
238 } |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
239 |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
240 addGroupedDev( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
241 store: N3Store, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
242 grouped: Map<string, DevGroup>, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
243 devUri: NamedNode |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
244 ) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
245 const getAgoMin = (connected: Literal | undefined): number | undefined => { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
246 if (connected) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
247 const t = new Date(connected.value); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
248 const agoMs = Date.now() - t.valueOf(); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
249 return agoMs / 1000 / 60; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
250 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
251 return undefined; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
252 }; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
253 |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
254 const packetsPerSec = parseFloat( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
255 graphLiteral(store, devUri, room + "packetsPerSec", "0").value |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
256 ); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
257 const bytesPerSec = parseFloat( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
258 graphLiteral(store, devUri, room + "bytesPerSec", "0").value |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
259 ); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
260 |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
261 const row: Dev = { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
262 agoMin: getAgoMin(graphLiteral(store, devUri, room + "connected")), |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
263 ipAddress: graphLiteral(store, devUri, room + "ipAddress", "(unknown)"), |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
264 dhcpHostname: asString( |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
265 graphLiteral(store, devUri, room + "dhcpHostname") |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
266 ), |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
267 macAddress: graphLiteral(store, devUri, room + "macAddress"), |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
268 packetsPerSec: packetsPerSec, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
269 packetsPerSecDisplay: packetsPerSec + " P/s", |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
270 bytesPerSec: bytesPerSec, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
271 bytesPerSecDisplay: bytesPerSec + " B/s", |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
272 }; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
273 |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
274 const wifiBand = graphUriValue(store, devUri, room + "wifiBand"); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
275 const connectedToAp = graphUriValue(store, devUri, room + "connectedToAp"); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
276 if (!this.showGroups || connectedToAp) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
277 const key = this.showGroups |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
278 ? `${connectedToAp!.value}-${wifiBand!.value}` |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
279 : "all"; |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
280 if (!grouped.has(key)) { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
281 grouped.set(key, { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
282 connectedToAp: connectedToAp!, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
283 wifiBand: wifiBand!, |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
284 devs: [], |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
285 }); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
286 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
287 grouped.get(key)!.devs.push(row); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
288 } else { |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
289 console.log("lost row", row); |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
290 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
291 } |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
292 |
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
293 graphView(store: N3Store): Map<string, DevGroup> { |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
294 const grouped: Map<string, DevGroup> = new Map(); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
295 store.forEach( |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
296 q => { |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
297 const devUri: NamedNode = q.subject as NamedNode; |
676
4bd77a9548d6
now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents:
675
diff
changeset
|
298 this.addGroupedDev(store, grouped, devUri); |
675
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
299 }, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
300 null, |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
301 namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
302 namedNode(room + "NetworkedDevice"), |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
303 null |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
304 ); |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
305 return grouped; |
9ae34280218b
kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents:
674
diff
changeset
|
306 } |
673
f2215949c0c9
build adjustments. now seems to read streamedgraph correctly.
drewp@bigasterisk.com
parents:
diff
changeset
|
307 } |