From a00381c45480c47d49a1136f5fef2430cef65f57 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 7 Dec 2023 19:59:15 +0800 Subject: [PATCH] Unify node and rel prop editing --- .../PropertiesPanelContent/DetailsPane.tsx | 1 + .../VisualizationView/VisualizationView.tsx | 26 ++++++++++++++----- .../PropertiesTable/PropertiesTable.tsx | 21 ++++++++++----- .../DefaultDetailsPane.tsx | 1 + .../Graph/GraphEventHandlerModel.ts | 4 +-- src/neo4j-arc/graph-visualization/index.ts | 2 +- src/neo4j-arc/package.json | 2 +- 7 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/browser/modules/Stream/CypherFrame/VisualizationView/PropertiesPanelContent/DetailsPane.tsx b/src/browser/modules/Stream/CypherFrame/VisualizationView/PropertiesPanelContent/DetailsPane.tsx index c21a7df8583..95bd59b8d53 100644 --- a/src/browser/modules/Stream/CypherFrame/VisualizationView/PropertiesPanelContent/DetailsPane.tsx +++ b/src/browser/modules/Stream/CypherFrame/VisualizationView/PropertiesPanelContent/DetailsPane.tsx @@ -131,6 +131,7 @@ export function DetailsPane({ { @@ -372,6 +382,10 @@ LIMIT ${maxNewNeighbours}` } } ) + + const cmd = 'MATCH (n) RETURN n;' + const action = executeCommand(cmd, { source: commandSources.rerunFrame }) + this.props.bus.send(action.type, action) } if (event == REL_ON_CANVAS_CREATE) { diff --git a/src/neo4j-arc/common/components/PropertiesTable/PropertiesTable.tsx b/src/neo4j-arc/common/components/PropertiesTable/PropertiesTable.tsx index c93d298371f..960fec73593 100644 --- a/src/neo4j-arc/common/components/PropertiesTable/PropertiesTable.tsx +++ b/src/neo4j-arc/common/components/PropertiesTable/PropertiesTable.tsx @@ -33,23 +33,27 @@ import { ShowMoreOrAll } from '../ShowMoreOrAll/ShowMoreOrAll' import { VizItemProperty } from 'neo4j-arc/common' import { GraphInteractionCallBack, - NODE_PROP_UPDATE + PROP_UPDATE } from '../../../graph-visualization' export const ELLIPSIS = '\u2026' export const WIDE_VIEW_THRESHOLD = 900 export const MAX_LENGTH_NARROW = 150 export const MAX_LENGTH_WIDE = 300 + type ExpandableValueProps = { - nodeId: string + isNode: boolean + nodeOrRelId: string propKey: string value: string width: number type: string onGraphInteraction: GraphInteractionCallBack } + function ExpandableValue({ - nodeId, + isNode, + nodeOrRelId, propKey, value, width, @@ -76,8 +80,9 @@ function ExpandableValue({ onKeyUp={(event: any) => { if (event.keyCode === 13) { event.preventDefault() - onGraphInteraction(NODE_PROP_UPDATE, { - nodeId: nodeId, + onGraphInteraction(PROP_UPDATE, { + isNode: isNode, + nodeOrRelId: nodeOrRelId, propKey: propKey, propVal: event.currentTarget.textContent }) @@ -97,6 +102,7 @@ function ExpandableValue({ } type PropertiesViewProps = { + isNode: boolean visibleProperties: VizItemProperty[] onMoreClick: (numMore: number) => void totalNumItems: number @@ -104,7 +110,9 @@ type PropertiesViewProps = { nodeInspectorWidth: number onGraphInteraction?: GraphInteractionCallBack } + export const PropertiesTable = ({ + isNode, visibleProperties, totalNumItems, onMoreClick, @@ -131,7 +139,8 @@ export const PropertiesTable = ({