annotate web/ResourceDisplay.ts @ 2404:9cbc93f80b05

cleanup
author drewp@bigasterisk.com
date Fri, 17 May 2024 17:41:22 -0700
parents 4556eebe5d73
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
1 import { TextField } from "@material/mwc-textfield";
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
2 import debug from "debug";
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
3 import { css, html, LitElement, PropertyValues } from "lit";
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
4 import { customElement, property, state } from "lit/decorators.js";
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
5 import { NamedNode } from "n3";
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
6 import { getTopGraph } from "./RdfdbSyncedGraph";
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
7 import { SyncedGraph } from "./SyncedGraph";
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
8 export { Button } from "@material/mwc-button";
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
9 export { Dialog } from "@material/mwc-dialog";
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
10 export { TextField } from "@material/mwc-textfield";
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
11
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
12 const log = debug("rdisplay");
1589
21a52ce16954 new effects2.html polymer port
Drew Perttula <drewp@bigasterisk.com>
parents:
diff changeset
13
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
14 @customElement("resource-display")
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
15 export class ResourceDisplay extends LitElement {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
16 graph!: SyncedGraph;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
17 static styles = [
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
18 css`
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
19 :host {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
20 display: inline-block;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
21 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
22
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
23 a.resource {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
24 color: inherit;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
25 text-decoration: none;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
26 }
1714
f2265601ead6 edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents: 1710
diff changeset
27
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
28 .resource {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
29 border: 1px solid #545454;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
30 border-radius: 5px;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
31 padding: 1px;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
32 margin: 2px;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
33 background: rgb(49, 49, 49);
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
34 display: inline-block;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
35 text-shadow: 1px 1px 2px black;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
36 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
37 .resource.minor {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
38 background: none;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
39 border: none;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
40 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
41 .resource a {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
42 color: rgb(150, 150, 255);
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
43 padding: 1px;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
44 display: inline-block;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
45 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
46 .resource.minor a {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
47 text-decoration: none;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
48 color: rgb(155, 155, 193);
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
49 padding: 0;
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
50 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
51 `,
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
52 ];
1714
f2265601ead6 edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents: 1710
diff changeset
53
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
54 render() {
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
55 let renameDialog = html``;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
56 if (this.renameDialogOpen) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
57 renameDialog = html` <mwc-dialog id="renameDialog" open @closing=${this.onRenameClosing} @closed=${this.onRenameClosed}>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
58 <p>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
59 New label:
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
60 <mwc-textfield id="renameField" dialogInitialFocus .value=${this.renameTo}></mwc-textfield>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
61 </p>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
62 <mwc-button dialogAction="cancel" slot="secondaryAction">Cancel</mwc-button>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
63 <mwc-button dialogAction="ok" slot="primaryAction">OK</mwc-button>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
64 </mwc-dialog>`;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
65 }
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
66
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
67 return html` <span class="${this.resClasses()}">
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
68 <a href="${this.href()}" id="uri"> <!-- type icon goes here -->${this.label}</a>
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
69 ${this.rename ? html`<button @click=${this.onRename}>Rename</button>` : ""} </span
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
70 >${renameDialog}`;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
71 //
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
72 }
2294
4031e511bca9 resource-display uri can no longer be a string
drewp@bigasterisk.com
parents: 2292
diff changeset
73 @property() uri?: NamedNode;
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
74
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
75 @state() label: string = "";
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
76 @state() renameDialogOpen = false;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
77 @state() renameTo = "";
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
78
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
79 @property({ type: Boolean }) rename: boolean = false;
2312
3f0b889c8fa9 don't let phone users click on song uris by mistake
drewp@bigasterisk.com
parents: 2295
diff changeset
80 @property({ type: Boolean }) noclick: boolean = false;
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
81 @property({ type: Boolean }) minor: boolean = false;
1591
2713d2f7a0fc resource-display can have a rename button for editing rdfs:label
Drew Perttula <drewp@bigasterisk.com>
parents: 1589
diff changeset
82
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
83 constructor() {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
84 super();
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
85 getTopGraph().then((g) => {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
86 this.graph = g;
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
87 this.onUri();
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
88 });
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
89 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
90
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
91 updated(changedProperties: PropertyValues) {
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
92 if (changedProperties.has("uri")) {
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
93 this.onUri();
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
94 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
95 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
96
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
97 private onUri() {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
98 if (!this.graph) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
99 return; /*too soon, but getTopGraph will call us again*/
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
100 }
2321
ed0db55f604c use undefined for 'nothing selected' insetad of null
drewp@bigasterisk.com
parents: 2312
diff changeset
101
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
102 if (this.uri === undefined) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
103 this.label = "(unset)";
2321
ed0db55f604c use undefined for 'nothing selected' insetad of null
drewp@bigasterisk.com
parents: 2312
diff changeset
104 } else if (this.uri === null) {
ed0db55f604c use undefined for 'nothing selected' insetad of null
drewp@bigasterisk.com
parents: 2312
diff changeset
105 throw 'use undefined please'
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
106 } else {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
107 this.graph.runHandler(this.compile.bind(this, this.graph), `label for ${this.uri.id}`);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
108 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
109 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
110 private compile(graph: SyncedGraph) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
111 if (this.uri === undefined) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
112 return;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
113 } else {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
114 this.label = this.graph.labelOrTail(this.uri);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
115 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
116 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
117
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
118 private href(): string {
2312
3f0b889c8fa9 don't let phone users click on song uris by mistake
drewp@bigasterisk.com
parents: 2295
diff changeset
119 if (!this.uri || this.noclick) {
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
120 return "javascript:;";
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
121 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
122 return this.uri.value;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
123 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
124
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
125 private resClasses() {
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
126 return this.minor ? "resource minor" : "resource";
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
127 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
128
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
129 private onRename() {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
130 this.renameTo = this.label;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
131 this.renameDialogOpen = true;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
132 setTimeout(() => {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
133 // I! 👏 know! 👏 the! 👏 element! 👏 I! 👏 want!
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
134 const inputEl = this.shadowRoot!.querySelector("#renameField")!.shadowRoot!.querySelector("input")! as HTMLInputElement;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
135 inputEl.setSelectionRange(0, -1);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
136 }, 100);
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
137 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
138
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
139 // move to SyncedGraph
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
140 private whatCtxHeldTheObj(subj: NamedNode, pred: NamedNode): NamedNode {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
141 var ctxs = this.graph.contextsWithPattern(subj, pred, null);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
142 if (ctxs.length != 1) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
143 throw new Error(`${ctxs.length} ${pred.id} stmts for ${subj.id}`);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
144 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
145 return ctxs[0];
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
146 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
147
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
148 private onRenameClosing(ev: CustomEvent) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
149 this.renameTo = (this.shadowRoot!.querySelector("#renameField")! as TextField).value;
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
150 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
151
2295
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
152 private onRenameClosed(ev: CustomEvent) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
153 this.renameDialogOpen = false;
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
154 if (ev.detail.action == "ok") {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
155 var label = this.graph.Uri("rdfs:label");
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
156 if (this.uri === undefined) {
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
157 throw "lost uri";
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
158 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
159 const ctx = this.whatCtxHeldTheObj(this.uri, label);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
160 this.graph.patchObject(this.uri, label, this.graph.Literal(this.renameTo), ctx);
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
161 }
d18586476827 redo resource-display, fixing the rename button
drewp@bigasterisk.com
parents: 2294
diff changeset
162 this.renameTo = "";
2074
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
163 }
1a96f8647126 big graph & autodep porting to make collector display labels from a syncedgraph
drewp@bigasterisk.com
parents: 1796
diff changeset
164 }