Skip to content

Commit 26194d7

Browse files
authored
Merge pull request #627 from neo4j-labs/pr/VULCAN-231-source-target
Vulcan 231 source target
2 parents 314ad0b + d3bab80 commit 26194d7

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/chart/graph/component/GraphChartInspectModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export const NeoGraphChartInspectModal = (props: GraphChartVisualizationProps) =
1717
aria-labelledby='form-dialog-title'
1818
>
1919
<Dialog.Header id='form-dialog-title'>
20-
{props.interactivity.selectedEntity ? getEntityHeader(props.interactivity.selectedEntity) : ''}
20+
{props.interactivity.selectedEntity
21+
? getEntityHeader(props.interactivity.selectedEntity, props.engine.selection)
22+
: ''}
2123
</Dialog.Header>
2224
<Dialog.Content>
2325
<GraphEntityInspectionTable entity={props.interactivity.selectedEntity}></GraphEntityInspectionTable>

src/chart/graph/util/NodeUtils.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,26 @@ export const parseNodeIconConfig = (iconStyle) => {
2424
}
2525
};
2626

27-
export const getEntityHeader = (entity) => {
28-
return (entity.labels && entity.labels.join(', ')) || entity.type;
27+
const getSelectedNodeProperty = (entity: any, sourceOrTarget: string, propertySelections: any) => {
28+
const selection = propertySelections[entity[sourceOrTarget]?.mainLabel];
29+
switch (selection) {
30+
case '(label)':
31+
return entity[sourceOrTarget]?.mainLabel;
32+
case '(id)':
33+
return entity[sourceOrTarget]?.id;
34+
default:
35+
return entity[sourceOrTarget]?.properties[selection];
36+
}
37+
};
38+
39+
const getRelPatternString = (entity: any, selection: any) => {
40+
const sourceTitle = getSelectedNodeProperty(entity, 'source', selection);
41+
const targetTitle = getSelectedNodeProperty(entity, 'target', selection);
42+
return `(${sourceTitle ? sourceTitle : '[no value]'} --> ${targetTitle ? targetTitle : '[no value]'})`;
43+
};
44+
45+
export const getEntityHeader = (entity: any, selection: any) => {
46+
return entity.labels?.join(', ') || `${entity.type} ${getRelPatternString(entity, selection)}`;
2947
};
3048

3149
export const drawDataURIOnCanvas = (node, strDataURI, canvas, defaultNodeSize) => {

0 commit comments

Comments
 (0)