Skip to content

Commit e2b3c5e

Browse files
Composite db didn't show result graph (#1841)
* fix composite db blank results * add e2e test for composite db * add 5.1 to e2e tests * fix e2e test
1 parent 3b7a643 commit e2b3c5e

File tree

3 files changed

+83
-8
lines changed

3 files changed

+83
-8
lines changed

.github/workflows/pr-e2e-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- 3.5
1818
- 4.3
1919
- 4.4
20+
- 5.1.0
2021
neo4j-edition:
2122
- community
2223
- enterprise
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) Neo4j
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
import { isAura, isEnterpriseEdition } from '../support/utils'
22+
23+
describe('composite database', () => {
24+
before(function () {
25+
cy.visit(Cypress.config('url')).title().should('include', 'Neo4j Browser')
26+
cy.wait(3000)
27+
cy.ensureConnection()
28+
})
29+
30+
if (
31+
Cypress.config('serverVersion') >= 5.0 &&
32+
!isAura() &&
33+
isEnterpriseEdition()
34+
) {
35+
it('can query composite db and show results', () => {
36+
cy.executeCommand(':clear')
37+
const query = `create database compdb1;create database compdb2;use compdb1 create (:Poke {{}name: "Treecko"{}})-[:EVOLVES_INTO]->(:Poke {{}name: "Grovyle"{}});CREATE COMPOSITE DATABASE both;CREATE ALIAS both.cd1 FOR DATABASE compdb1;CREATE ALIAS both.cd2 FOR DATABASE compdb2;`
38+
39+
cy.executeCommand(query)
40+
cy.get('[data-testid="multi-statement-list-icon"]')
41+
.last()
42+
.invoke('attr', 'title')
43+
.should('equal', 'Status: success')
44+
45+
cy.executeCommand('SHOW DATABASES')
46+
cy.contains('both')
47+
cy.resultContains('"both"')
48+
49+
cy.executeCommand(':use both')
50+
cy.executeCommand(':clear')
51+
cy.executeCommand(
52+
"CALL {{} USE both.cd1 MATCH path=(p:Poke)-[:EVOLVES_INTO]->(m) where p.name = 'Treecko' return path as p limit 10 {}} return p;"
53+
)
54+
cy.waitForCommandResult()
55+
56+
cy.get('[data-testid="vizInspector"]', { timeout: 5000 }).contains(
57+
'EVOLVES_INTO'
58+
)
59+
60+
cy.get('circle.b-outline', { timeout: 10000 }).eq(0).should('be.visible')
61+
62+
// cleanup
63+
cy.executeCommand(`
64+
drop alias both.cd1 for database;
65+
drop alias both.cd2 for database;
66+
drop database compdb1;
67+
drop database compdb2;
68+
drop database both;
69+
`)
70+
71+
cy.executeCommand(':use neo4j')
72+
cy.executeCommand(':clear')
73+
})
74+
}
75+
})

src/browser/modules/Stream/CypherFrame/VisualizationView/VisualizationView.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,10 @@ export class Visualization extends Component<
164164
const existingNodeIds = existingNodes.map(node => parseInt(node.id))
165165
const newNodeIds = newNodes.map(node => parseInt(node.id))
166166

167-
this.getInternalRelationships(existingNodeIds, newNodeIds)
168-
.then(graph => {
169-
this.autoCompleteCallback &&
170-
this.autoCompleteCallback(graph.relationships)
171-
})
172-
.catch(() => undefined)
167+
this.getInternalRelationships(existingNodeIds, newNodeIds).then(graph => {
168+
this.autoCompleteCallback &&
169+
this.autoCompleteCallback(graph.relationships)
170+
})
173171
} else {
174172
this.autoCompleteCallback && this.autoCompleteCallback([])
175173
}
@@ -234,7 +232,7 @@ LIMIT ${maxNewNeighbours}`
234232
const existingNodeIds = rawExistingNodeIds.map(neo4j.int).concat(newNodeIds)
235233
const query =
236234
'MATCH (a)-[r]->(b) WHERE id(a) IN $existingNodeIds AND id(b) IN $newNodeIds RETURN r;'
237-
return new Promise((resolve, reject) => {
235+
return new Promise(resolve => {
238236
this.props.bus &&
239237
this.props.bus.self(
240238
CYPHER_REQUEST,
@@ -245,7 +243,8 @@ LIMIT ${maxNewNeighbours}`
245243
},
246244
(response: any) => {
247245
if (!response.success) {
248-
reject(new Error())
246+
console.error(response.error)
247+
resolve({ nodes: [], relationships: [] })
249248
} else {
250249
resolve({
251250
...bolt.extractNodesAndRelationshipsFromRecordsForOldVis(

0 commit comments

Comments
 (0)