Skip to content

Commit

Permalink
Update node & edge ids to alway be valid CSS selectors
Browse files Browse the repository at this point in the history
Also improve rendering of missing recordIds in tooltips
  • Loading branch information
codemacabre committed Sep 9, 2024
1 parent 5f74316 commit a01cb9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/render/renderGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const setupGraph = (rankDir) => {
export const setNodes = (nodes, g) => {
nodes.forEach((node) => {
g.setNode(node.recordId || node.id, {
id: node.recordId || node.id,
id: `node_${node.recordId || node.id}`,
label: node.label,
class: node.class || '',
labelType: node.labelType || 'string',
Expand All @@ -37,7 +37,7 @@ export const setNodes = (nodes, g) => {
export const setEdges = (edges, g) => {
edges.forEach((edge) => {
g.setEdge(edge.source, edge.target, {
id: edge.recordId || edge.id,
id: `edge_${edge.recordId || edge.id}`,
class: edge.class || '',
edgeType: edge.interestRelationship,
description: edge.description,
Expand Down
6 changes: 3 additions & 3 deletions src/render/renderUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ const getDescription = (description) => {
}

// Output the descriptions subset as key value pairs on new lines
return `Statement date: ${description.statementDate}\nRecord ID: ${description.recordId}\n${
identifiers.length > 0 ? identifiersOutput : ''
}${interests.length > 0 ? interestsOutput : ''}`;
return `Statement date: ${description.statementDate}\n${
description.recordId !== null ? 'Record ID: ' + description.recordId + '\n' : ''
}${identifiers.length > 0 ? identifiersOutput : ''}${interests.length > 0 ? interestsOutput : ''}`;
};

// Configure tippy.js
Expand Down

0 comments on commit a01cb9c

Please sign in to comment.