Skip to content

Commit

Permalink
Add description field to on-canvas-generated node
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Oct 23, 2023
1 parent c25b0e8 commit a51f63c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
7 changes: 7 additions & 0 deletions e2e_tests/integration/viz.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ describe('Viz rendering', () => {
'Undefined'
)

cy.get('[data-testid="nodeGroups"]')
.contains('New Node')
.trigger('mouseover')
.get('[data-testid="viz-details-pane-properties-table"]')
.find('td:nth-child(4)')
.should('have.text', 'description')

cy.executeCommand('MATCH (n) DETACH DELETE n')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,19 @@ LIMIT ${maxNewNeighbours}`

const id = properties['id']
const name = properties['name']
const description = properties['description']
const variableName = `node${id}`
const labels = (properties['labels'] as string[])
.map(label => `\`${label}\``)
.join(':')

const query = `CREATE (${variableName}:${labels} { id: ${id}, name: "${name}" });`
const query = `CREATE (${variableName}:${labels} { id: ${id}, name: "${name}", description: "${description}" });`

this.props.bus.self(
CYPHER_REQUEST,
{
query,
params: { labels, id, name },
params: { labels, id, name, description },
queryType: NEO4J_BROWSER_USER_ACTION_QUERY
},
(response: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,14 @@ export class GraphEventHandlerModel {
new NodeModel(
newId.toString(),
['Undefined'],
{ name: 'New Node' },
{ name: 'string' }
{
name: 'New Node',
description: 'New Node'
},
{
name: 'string',
description: 'string'
}
)
])
this.visualization.update({ updateNodes: true, updateRelationships: true })
Expand All @@ -249,6 +255,7 @@ export class GraphEventHandlerModel {
this.onGraphInteraction(NODE_ON_CANVAS_CREATE, {
id: newId,
name: 'New Node',
description: 'New Node',
labels: ['Undefined']
})
}
Expand Down

0 comments on commit a51f63c

Please sign in to comment.