Mercurial > code > home > repos > homeauto
diff service/wifi/src/index.ts @ 744:b267511ec4fc
fixes to TS and page build. remove some unused attempts at binding to <streamed-graph>
Ignore-this: dc4cd74d21fef101b32da824bbf60a00
author | drewp@bigasterisk.com |
---|---|
date | Thu, 13 Feb 2020 10:17:54 -0800 |
parents | b39d24617a85 |
children |
line wrap: on
line diff
--- 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` <div class="report"> @@ -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