Mercurial > code > home > repos > homeauto
changeset 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 |
files | service/wifi/src/index.ts |
diffstat | 1 files changed, 9 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/service/wifi/src/index.ts Sun Jan 05 23:52:26 2020 -0800 +++ b/service/wifi/src/index.ts Mon Jan 06 00:04:18 2020 -0800 @@ -18,7 +18,7 @@ } interface Dev { agoMin: number | undefined; - ipAddress: Literal; + ipAddress: Literal; // todo no one wants this literal. just make it string. dhcpHostname: string; macAddress: Literal; packetsPerSec: number; @@ -28,11 +28,12 @@ } const room = "http://projects.bigasterisk.com/room/"; +////////////////// funcs that could move out ////////////////////////////// // workaround for uris that don't have good labels in the graph function labelFromUri( uri: NamedNode, prefix: string, - tailsToLabels: any, + tailsToLabels: {[key: string]: string}, defaultLabel: string ) { let label = defaultLabel === undefined ? uri.value : defaultLabel; @@ -113,6 +114,7 @@ } throw new Error("found multiple matches for pred"); } +////////////////////////////////////////////////////////////////////////////////// @customElement("wifi-display") class WifiDisplay extends LitElement { @@ -120,10 +122,7 @@ return [style]; } - @property({ - type: Object, - // observer: WifiDisplay.prototype.onGraphChanged, - }) + @property({ type: Object }) graph!: VersionedGraph; connectedCallback() { @@ -173,10 +172,10 @@ const glow = ""; //todo return html` <div class="dev" style="background: rgba(185, 5, 138, ${glow});"> - <span class="mac">${dev.macAddress && dev.macAddress.value}</span> + <span class="mac">${dev.macAddress.value}</span> <span class="ip" - ><a href="http://${dev.ipAddress && dev.ipAddress.value}/" - >${dev.ipAddress && dev.ipAddress.value}</a + ><a href="http://${dev.ipAddress.value}/" + >${dev.ipAddress.value}</a ></span > <span class="packets">${dev.packetsPerSecDisplay}</span> @@ -185,8 +184,7 @@ <span class="ago">${agoReport}</span> <span class="links"> <a - href="https://bigasterisk.com/ntop/lua/host_details.lua?ifid=17&host=${dev.ipAddress && - dev.ipAddress.value}&page=flows" + href="https://bigasterisk.com/ntop/lua/host_details.lua?ifid=17&host=${dev.ipAddress.value}&page=flows" >[flows]</a > </span>