# HG changeset patch # User drewp@bigasterisk.com # Date 1684377272 25200 # Node ID a7a46291901fa4611454dbb13b60b3e37f8a4f7f # Parent e13b62bfdaff5f3d96739c09c65737451b7b2bd1 move diff -r e13b62bfdaff -r a7a46291901f light9/collector/web/Light9CollectorDevice.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/collector/web/Light9CollectorDevice.ts Wed May 17 19:34:32 2023 -0700 @@ -0,0 +1,75 @@ +import debug from "debug"; +import { css, html, LitElement } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { NamedNode } from "n3"; +export { ResourceDisplay } from "../../web/ResourceDisplay"; + +const log = debug("device-el"); + +@customElement("light9-collector-device") +export class Light9CollectorDevice extends LitElement { + static styles = [ + css` + :host { + display: block; + break-inside: avoid-column; + font-size: 80%; + } + h3 { + margin-top: 12px; + margin-bottom: 0; + } + td { + white-space: nowrap; + } + + td.nonzero { + background: #310202; + color: #e25757; + } + td.full { + background: #2b0000; + color: red; + font-weight: bold; + } + `, + ]; + + render() { + return html` +

+ + + + + + + ${this.attrs.map( + (item) => html` + + + + + + ` + )} +
out attrvaluechan
${item.attr}${item.val} →${item.chan}
+ `; + } + @property({ + converter: acceptStringOrUri(), + }) + uri: NamedNode = new NamedNode(""); + @property() attrs: Array<{ attr: string; valClass: string; val: string; chan: string }> = []; + + setAttrs(attrs: any) { + this.attrs = attrs; + this.attrs.forEach(function (row: any) { + row.valClass = row.val == 255 ? "full" : row.val ? "nonzero" : ""; + }); + } +} + +function acceptStringOrUri() { + return (s: string | null) => new NamedNode(s || ""); +} diff -r e13b62bfdaff -r a7a46291901f light9/collector/web/Light9CollectorUi.ts --- a/light9/collector/web/Light9CollectorUi.ts Wed May 17 19:34:12 2023 -0700 +++ b/light9/collector/web/Light9CollectorUi.ts Wed May 17 19:34:32 2023 -0700 @@ -4,7 +4,7 @@ import { NamedNode } from "n3"; import ReconnectingWebSocket from "reconnectingwebsocket"; import { sortBy, uniq } from "underscore"; -import { Light9CollectorDevice } from "../../web/collector/Light9CollectorDevice"; +import { Light9CollectorDevice } from "./Light9CollectorDevice"; import { Patch } from "../../web/patch"; import { getTopGraph } from "../../web/RdfdbSyncedGraph"; import { SyncedGraph } from "../../web/SyncedGraph"; diff -r e13b62bfdaff -r a7a46291901f light9/web/collector/Light9CollectorDevice.ts --- a/light9/web/collector/Light9CollectorDevice.ts Wed May 17 19:34:12 2023 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -import debug from "debug"; -import { css, html, LitElement } from "lit"; -import { customElement, property } from "lit/decorators.js"; -import { NamedNode } from "n3"; -export { ResourceDisplay } from "../ResourceDisplay"; - -const log = debug("device-el"); - -@customElement("light9-collector-device") -export class Light9CollectorDevice extends LitElement { - static styles = [ - css` - :host { - display: block; - break-inside: avoid-column; - font-size: 80%; - } - h3 { - margin-top: 12px; - margin-bottom: 0; - } - td { - white-space: nowrap; - } - - td.nonzero { - background: #310202; - color: #e25757; - } - td.full { - background: #2b0000; - color: red; - font-weight: bold; - } - `, - ]; - - render() { - return html` -

- - - - - - - ${this.attrs.map( - (item) => html` - - - - - - ` - )} -
out attrvaluechan
${item.attr}${item.val} →${item.chan}
- `; - } - @property({ - converter: acceptStringOrUri(), - }) - uri: NamedNode = new NamedNode(""); - @property() attrs: Array<{ attr: string; valClass: string; val: string; chan: string }> = []; - - setAttrs(attrs: any) { - this.attrs = attrs; - this.attrs.forEach(function (row: any) { - row.valClass = row.val == 255 ? "full" : row.val ? "nonzero" : ""; - }); - } -} - -function acceptStringOrUri() { - return (s: string | null) => new NamedNode(s || ""); -} diff -r e13b62bfdaff -r a7a46291901f light9/web/collector/README.md --- a/light9/web/collector/README.md Wed May 17 19:34:12 2023 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -this is meant to be at light9/collector/web but I couldn't figure out the vite paths \ No newline at end of file