annotate service/wifi/src/index.ts @ 676:4bd77a9548d6

now roughly works. shows updates. only some workarounds. Ignore-this: e591abe547e508c0e56102c124cf940b
author drewp@bigasterisk.com
date Sun, 05 Jan 2020 23:52:26 -0800
parents 9ae34280218b
children 008718fc336a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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;
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
21 ipAddress: Literal;
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
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
31 // 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
32 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
33 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
34 prefix: 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
35 tailsToLabels: any,
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
36 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
37 ) {
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 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
39 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
40 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
41 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
42 }
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 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
45 }
676
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
46 function asString(x: Literal | undefined): string {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
47 if (x && x.value) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
48 return x.value;
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
49 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
50 return "(unknown)";
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
51 }
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 function graphLiteral(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
54 store: N3Store,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
55 subj: NamedNode,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
56 pred: string,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
57 notFoundResult?: string
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
58 ): Literal {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
59 const keep: Array<Literal> = [];
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
60 store.forEach(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
61 q => {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
62 if (!Util.isLiteral(q.object)) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
63 throw new Error("non literal found");
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
64 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
65 let seen = false;
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
66 for (let other of keep) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
67 if (other.equals(q.object)) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
68 seen = true;
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
69 }
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 if (!seen) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
72 keep.push(q.object as Literal);
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
73 }
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 subj,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
76 namedNode(pred),
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
77 null,
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 );
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
80 if (keep.length == 0) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
81 return literal(notFoundResult || "(missing)");
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
82 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
83 if (keep.length == 1) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
84 return keep[0];
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
85 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
86 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
87 return keep[0];
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
88 }
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 function graphUriValue(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
91 store: N3Store,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
92 subj: NamedNode,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
93 pred: string
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
94 ): NamedNode | undefined {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
95 const keep: Array<NamedNode> = [];
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
96 store.forEach(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
97 q => {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
98 if (!Util.isNamedNode(q.object)) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
99 throw new Error("non uri found");
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
100 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
101 keep.push(q.object as NamedNode);
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
102 },
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
103 subj,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
104 namedNode(pred),
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
105 null,
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 );
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
108 if (keep.length == 0) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
109 return undefined;
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
110 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
111 if (keep.length == 1) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
112 return keep[0];
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
113 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
114 throw new Error("found multiple matches for pred");
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
115 }
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
116
2b9865bf1737 streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents: 673
diff changeset
117 @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
118 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
119 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
120 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
121 }
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
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 @property({
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 type: Object,
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
125 // observer: WifiDisplay.prototype.onGraphChanged,
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
126 })
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
127 graph!: VersionedGraph;
673
f2215949c0c9 build adjustments. now seems to read streamedgraph correctly.
drewp@bigasterisk.com
parents:
diff changeset
128
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
129 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 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
131 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
132 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
133 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
134 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
135 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
136 }) 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
137 }
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
138
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
139 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
140 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
141 }
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
142
676
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
143 @property({ type: Boolean })
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
144 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
145
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
146 render() {
676
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
147 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
148
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 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
150 <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
151 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
152 ${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
153 <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
154 ${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
155 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
156 })}
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 </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
158 </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
159 `;
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
160 }
673
f2215949c0c9 build adjustments. now seems to read streamedgraph correctly.
drewp@bigasterisk.com
parents:
diff changeset
161
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
162 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
163 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
164 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
165 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
166 } 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
167 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
168 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
169 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
170 ? ` (${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
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 }
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 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
174 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
175 <div class="dev" style="background: rgba(185, 5, 138, ${glow});">
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="mac">${dev.macAddress && dev.macAddress.value}</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
177 <span class="ip"
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
178 ><a href="http://${dev.ipAddress && dev.ipAddress.value}/"
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 >${dev.ipAddress && dev.ipAddress.value}</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
180 ></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
181 >
676
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
182 <span class="packets">${dev.packetsPerSecDisplay}</span>
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
183 <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
184 <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
185 <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
186 <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
187 <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
188 href="https://bigasterisk.com/ntop/lua/host_details.lua?ifid=17&amp;host=${dev.ipAddress &&
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 dev.ipAddress.value}&amp;page=flows"
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 >[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
191 >
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 </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
193 </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
194 `;
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
195 }
2b9865bf1737 streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents: 673
diff changeset
196
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
197 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
198 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
199 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
200 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
201 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
202 "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
203 {
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: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
205 "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
206 "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
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 "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
209 );
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
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 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
212 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
213 "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
214 {
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 "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
216 "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
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 "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
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 }
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
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 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
223 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
224 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
225 }
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 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
227 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
228 });
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
229 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
230 <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
231 <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
232 <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
233 <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
234 ${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
235 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
236 })}
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
237 </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
238 </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
239 `;
2b9865bf1737 streamed-graph finally imports and builds. polymer bindings don't work in a <dom-bind> though
drewp@bigasterisk.com
parents: 673
diff changeset
240 }
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
241
676
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
242 addGroupedDev(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
243 store: N3Store,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
244 grouped: Map<string, DevGroup>,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
245 devUri: NamedNode
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
246 ) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
247 const getAgoMin = (connected: Literal | undefined): number | undefined => {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
248 if (connected) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
249 const t = new Date(connected.value);
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
250 const agoMs = Date.now() - t.valueOf();
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
251 return agoMs / 1000 / 60;
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 return undefined;
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
254 };
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
255
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
256 const packetsPerSec = parseFloat(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
257 graphLiteral(store, devUri, room + "packetsPerSec", "0").value
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
258 );
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
259 const bytesPerSec = parseFloat(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
260 graphLiteral(store, devUri, room + "bytesPerSec", "0").value
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
261 );
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
262
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
263 const row: Dev = {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
264 agoMin: getAgoMin(graphLiteral(store, devUri, room + "connected")),
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
265 ipAddress: graphLiteral(store, devUri, room + "ipAddress", "(unknown)"),
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
266 dhcpHostname: asString(
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
267 graphLiteral(store, devUri, room + "dhcpHostname")
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
268 ),
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
269 macAddress: graphLiteral(store, devUri, room + "macAddress"),
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
270 packetsPerSec: packetsPerSec,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
271 packetsPerSecDisplay: packetsPerSec + " P/s",
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
272 bytesPerSec: bytesPerSec,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
273 bytesPerSecDisplay: bytesPerSec + " B/s",
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
274 };
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
275
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
276 const wifiBand = graphUriValue(store, devUri, room + "wifiBand");
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
277 const connectedToAp = graphUriValue(store, devUri, room + "connectedToAp");
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
278 if (!this.showGroups || connectedToAp) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
279 const key = this.showGroups
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
280 ? `${connectedToAp!.value}-${wifiBand!.value}`
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
281 : "all";
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
282 if (!grouped.has(key)) {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
283 grouped.set(key, {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
284 connectedToAp: connectedToAp!,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
285 wifiBand: wifiBand!,
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
286 devs: [],
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
287 });
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
288 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
289 grouped.get(key)!.devs.push(row);
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
290 } else {
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
291 console.log("lost row", row);
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 }
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
294
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
295 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
296 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
297 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
298 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
299 const devUri: NamedNode = q.subject as NamedNode;
676
4bd77a9548d6 now roughly works. shows updates. only some workarounds.
drewp@bigasterisk.com
parents: 675
diff changeset
300 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
301 },
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 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
303 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
304 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
305 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
306 );
9ae34280218b kind of running with lit-element and polymer together. lots of data missing from table still
drewp@bigasterisk.com
parents: 674
diff changeset
307 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
308 }
673
f2215949c0c9 build adjustments. now seems to read streamedgraph correctly.
drewp@bigasterisk.com
parents:
diff changeset
309 }