Skip to content

Commit 1e58696

Browse files
committed
feat: nicer rendering of array data
1 parent a2424b0 commit 1e58696

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

APIServer/public/js/GraphRedex.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,22 @@ export default class GraphRedex<N extends GRND, E extends GRED> {
221221
return await nd.term;
222222
}
223223

224+
private sidebarCellHTML(v: any): string {
225+
if (Array.isArray(v)) {
226+
return (
227+
"<table>" +
228+
v
229+
.map(
230+
(cv) => `<tr><td>${this.sidebarCellHTML(cv)}</td></tr>`,
231+
)
232+
.join("") +
233+
"</table>"
234+
);
235+
}
236+
237+
return v.toString();
238+
}
239+
224240
private prevPictSVGURL: string = null;
225241
private async fillSidebar(nd: N) {
226242
d3.select("#statusSection").html("loading");
@@ -257,7 +273,12 @@ export default class GraphRedex<N extends GRND, E extends GRED> {
257273
x === "term"
258274
),
259275
)
260-
.map((x) => `<tr><td>${x}</td><td>${nd[x]}</td></tr>`)
276+
.map(
277+
(x) =>
278+
`<tr><td>${x}</td><td>${this.sidebarCellHTML(
279+
nd[x],
280+
)}</td></tr>`,
281+
)
261282
.join("")}
262283
${[...this.highlighted]
263284
.filter((h) => h.nodes.has(nd._id))

0 commit comments

Comments
 (0)