= [];
- store.forEach(
- q => {
- if (!Util.isNamedNode(q.object)) {
- throw new Error("non uri found");
- }
- keep.push(q.object as NamedNode);
- },
- subj,
- namedNode(pred),
- null,
- null
- );
- if (keep.length == 0) {
- return undefined;
- }
- if (keep.length == 1) {
- return keep[0];
- }
- throw new Error("found multiple matches for pred");
-}
diff -r 7c785c0dd605 -r b267511ec4fc service/wifi/src/index.ts
--- a/service/wifi/src/index.ts Thu Feb 13 10:17:36 2020 -0800
+++ b/service/wifi/src/index.ts Thu Feb 13 10:17:54 2020 -0800
@@ -8,9 +8,8 @@
import { NamedNode, DataFactory } from "n3";
const { namedNode, literal } = DataFactory;
-import { VersionedGraph } from "streamed-graph";
+import { VersionedGraph, labelFromUri, graphLiteral, graphUriValue } from "streamed-graph";
import { style } from "./style";
-import { labelFromUri, graphLiteral, graphUriValue } from "./graph_access";
interface DevGroup {
connectedToAp: NamedNode;
@@ -49,19 +48,21 @@
super.connectedCallback();
const sg = this.ownerDocument!.querySelector("streamed-graph");
sg?.addEventListener("graph-changed", ((ev: CustomEvent) => {
- this.graph = ev.detail!.value as VersionedGraph;
+ if (ev.detail!.value) {
+ // todo: sometimes i get ev.detail.graph instead of ev.detail.value
+ this.graph = ev.detail!.value as VersionedGraph;
+ }
}) as EventListener);
}
- static get observers() {
- return ["onGraphChanged(graph)"];
- }
-
@property({ type: Boolean })
showGroups = false;
render() {
- const grouped = this.graphView(this.graph.store!);
+ if (!this.graph) {
+ return html`loading...`;
+ }
+ const grouped = this.graphView(this.graph.store);
return html`
@@ -190,7 +191,7 @@
} catch (e) {
wifiBand = namedNode("multi"); // some have 5G and 2G?
}
-
+
const connectedToAp = graphUriValue(store, devUri, room + "connectedToAp");
if (!this.showGroups || connectedToAp) {
const key = this.showGroups
diff -r 7c785c0dd605 -r b267511ec4fc service/wifi/tsconfig.json
--- a/service/wifi/tsconfig.json Thu Feb 13 10:17:36 2020 -0800
+++ b/service/wifi/tsconfig.json Thu Feb 13 10:17:54 2020 -0800
@@ -23,9 +23,9 @@
// "allowSyntheticDefaultImports": true,
// "rootDir": ".",
// "outDir": "./build",
- "baseUrl": "."
+ "baseUrl": ".",
// "emitDecoratorMetadata": true,
- // "lib": [ "dom" ],
+ "lib": [ "DOM","ES6","DOM.Iterable","ScriptHost", "ES2017.object" ],
// "diagnostics": true,
// "traceResolution": true