Mercurial > code > home > repos > light9
changeset 2244:0c6c590664ad
fix up effectListing
author | drewp@bigasterisk.com |
---|---|
date | Fri, 26 May 2023 17:00:26 -0700 |
parents | ba9aca728d65 |
children | a1f6f3139995 |
files | light9/effect/listing/web/Light9EffectListing.ts light9/effect/listing/web/index.html light9/effect/listing/web/vite.config.ts |
diffstat | 3 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/effect/listing/web/Light9EffectListing.ts Fri May 26 16:29:29 2023 -0700 +++ b/light9/effect/listing/web/Light9EffectListing.ts Fri May 26 17:00:26 2023 -0700 @@ -1,11 +1,12 @@ import debug from "debug"; import { css, html, LitElement } from "lit"; -import { customElement, property } from "lit/decorators.js"; +import { customElement } from "lit/decorators.js"; import { NamedNode } from "n3"; import { sortBy } from "underscore"; import { getTopGraph } from "../../../web/RdfdbSyncedGraph"; import { SyncedGraph } from "../../../web/SyncedGraph"; -export {ResourceDisplay} from "../../../web/ResourceDisplay" +export { ResourceDisplay } from "../../../web/ResourceDisplay"; + debug.enable("*"); const log = debug("listing"); @@ -16,11 +17,11 @@ <h1>Effects</h1> <rdfdb-synced-graph></rdfdb-synced-graph> - ${this.effectClasses.map((e: NamedNode) => html`<light9-effect-class .uri=${e}></light9-effect-class>`)} + ${this.effects.map((e: NamedNode) => html`<light9-effect-class .uri=${e}></light9-effect-class>`)} `; } graph!: SyncedGraph; - effectClasses: NamedNode[] = []; + effects: NamedNode[] = []; constructor() { super(); @@ -32,8 +33,14 @@ getClasses() { const U = this.graph.U(); - this.effectClasses = this.graph.subjects(U("rdf:type"), U(":Effect")) as NamedNode[]; - this.effectClasses = sortBy(this.effectClasses, (ec: any) => this.graph.stringValue(ec, U("rdfs:label"))); + this.effects = this.graph.subjects(U("rdf:type"), U(":Effect")) as NamedNode[]; + this.effects = sortBy(this.effects, (ec: NamedNode) => { + try { + return this.graph.stringValue(ec, U("rdfs:label")); + } catch (e) { + return ec.value; + } + }); this.requestUpdate(); } }
--- a/light9/effect/listing/web/index.html Fri May 26 16:29:29 2023 -0700 +++ b/light9/effect/listing/web/index.html Fri May 26 17:00:26 2023 -0700 @@ -3,7 +3,7 @@ <head> <title>effect listing</title> <meta charset="utf-8" /> - <link rel="stylesheet" href="./style.css"> + <link rel="stylesheet" href="../style.css"> <script type="module" src="../effectListing/Light9EffectListing"></script> </head> <body>
--- a/light9/effect/listing/web/vite.config.ts Fri May 26 16:29:29 2023 -0700 +++ b/light9/effect/listing/web/vite.config.ts Fri May 26 17:00:26 2023 -0700 @@ -4,9 +4,10 @@ export default defineConfig({ base: "/effectListing/", root: "./light9/effect/listing/web", - publicDir: "../web", + publicDir: "../../..", server: { host: "0.0.0.0", + base: 'effectListing', strictPort: true, port: servicePort + 100, hmr: {