Skip to content

Commit 1573dac

Browse files
author
Emil Andersson
committed
Merge branch 'master' into monaco-integration
2 parents 244e77d + f170c5d commit 1573dac

File tree

11 files changed

+129
-64
lines changed

11 files changed

+129
-64
lines changed

e2e_tests/integration/connect-form.spec.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@ describe('Connect form', () => {
4444
cy.wait(3000)
4545
})
4646

47-
it('extracts the scheme from the bolt url entered', () => {
48-
const scheme = schemeWithEncryptionFlag('bolt')
49-
const host = 'localhost:1212'
50-
getBoltUrlField()
51-
.clear()
52-
.type(scheme + host)
53-
54-
getBoltUrlField().should('have.value', host)
55-
getBoltSchemeSelect().should('have.value', scheme)
56-
})
47+
if (!isAura()) {
48+
it('extracts the scheme from the bolt url entered', () => {
49+
// Bolt is not pickable on aura
50+
const scheme = schemeWithEncryptionFlag('bolt')
51+
const host = 'localhost:1212'
52+
getBoltUrlField()
53+
.clear()
54+
.type(scheme + host)
55+
56+
getBoltUrlField().should('have.value', host)
57+
getBoltSchemeSelect().should('have.value', scheme)
58+
})
59+
}
5760
it('extracts the scheme from the bolt url entered with encryption flag', () => {
5861
const input = schemeWithInvertedEncryptionFlag('neo4j')
5962
const output = schemeWithEncryptionFlag('neo4j')

e2e_tests/integration/user.spec.ts

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020

21-
import { isEnterpriseEdition } from '../support/utils'
21+
import { isAura, isEnterpriseEdition } from '../support/utils'
2222

2323
/* global Cypress, cy, before */
2424

@@ -29,36 +29,39 @@ describe('User: ', () => {
2929
const password = Cypress.config('password')
3030
cy.connect('neo4j', password)
3131
})
32-
it("Doesn't throw when listing users", () => {
33-
cy.executeCommand(':clear')
34-
cy.executeCommand(':server user list')
35-
cy.get('[data-testid="frame"]', { timeout: 10000 }).should(
36-
'contain',
37-
isEnterpriseEdition() ? 'Username' : 'Unable to display'
38-
)
39-
})
40-
// Only on enterprise
41-
if (isEnterpriseEdition()) {
42-
it('Add User', () => {
43-
cy.executeCommand(':clear')
44-
cy.executeCommand(':server user add')
45-
cy.addUser('Bob', 'hi', 'editor', false)
32+
if (!isAura()) {
33+
// usermanagement in frames disabled on aura
34+
it("Doesn't throw when listing users", () => {
4635
cy.executeCommand(':clear')
4736
cy.executeCommand(':server user list')
48-
cy.get('.user-info > .username').should('have.length', 2)
49-
cy.get('.user-info > .username').contains('Bob')
37+
cy.get('[data-testid="frame"]', { timeout: 10000 }).should(
38+
'contain',
39+
isEnterpriseEdition() ? 'Username' : 'Unable to display'
40+
)
5041
})
42+
// Only on enterprise
43+
if (isEnterpriseEdition()) {
44+
it('Add User', () => {
45+
cy.executeCommand(':clear')
46+
cy.executeCommand(':server user add')
47+
cy.addUser('Bob', 'hi', 'editor', false)
48+
cy.executeCommand(':clear')
49+
cy.executeCommand(':server user list')
50+
cy.get('.user-info > .username').should('have.length', 2)
51+
cy.get('.user-info > .username').contains('Bob')
52+
})
5153

52-
it('Add User with forced pw change', () => {
53-
cy.executeCommand(':clear')
54-
cy.executeCommand(':server user add')
55-
cy.addUser('Rob', 'hi', 'editor', true)
56-
cy.executeCommand(':clear')
57-
cy.executeCommand(':server user list')
58-
cy.get('.user-info > .username').should('have.length', 3)
59-
cy.get('.user-info > .username').contains('Rob')
60-
cy.dropUser('Bob')
61-
cy.dropUser('Rob')
62-
})
54+
it('Add User with forced pw change', () => {
55+
cy.executeCommand(':clear')
56+
cy.executeCommand(':server user add')
57+
cy.addUser('Rob', 'hi', 'editor', true)
58+
cy.executeCommand(':clear')
59+
cy.executeCommand(':server user list')
60+
cy.get('.user-info > .username').should('have.length', 3)
61+
cy.get('.user-info > .username').contains('Rob')
62+
cy.dropUser('Bob')
63+
cy.dropUser('Rob')
64+
})
65+
}
6366
}
6467
})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "neo4j-browser",
3-
"version": "4.2.1",
3+
"version": "4.2.2",
44
"description": "Neo4j Browser is the general purpose user interface for working with Neo4j. Query, visualize, administrate and monitor the database.",
55
"neo4jDesktop": {
66
"apiVersion": "^1.4.0"
@@ -180,7 +180,7 @@
180180
"jszip": "^3.2.2",
181181
"lodash-es": "^4.17.15",
182182
"monaco-editor": "^0.20.0",
183-
"neo4j-driver": "^4.1.0",
183+
"neo4j-driver": "^4.2.2",
184184
"prop-types": "^15.7.2",
185185
"react": "^16.9.0",
186186
"react-dnd": "9.3.2",

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.neo4j.client</groupId>
55
<artifactId>neo4j-browser</artifactId>
6-
<version>4.2.1</version>
6+
<version>4.2.2</version>
77
<name>Neo4j - Browser</name>
88
<description>Graph database client.</description>
99
<url>https://github.com/neo4j/neo4j</url>

src/browser/modules/Stream/Auth/ConnectionForm.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ import ConnectedView from './ConnectedView'
4444
import ChangePasswordForm from './ChangePasswordForm'
4545
import {
4646
getAllowedAuthSchemes,
47-
getAllowedBoltSchemes,
48-
inCloudEnv
47+
getAllowedBoltSchemes
4948
} from 'shared/modules/app/appDuck'
5049
import { FOCUS } from 'shared/modules/editor/editorDuck'
5150
import {

src/browser/modules/User/UserAdd.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'
5656
import { driverDatabaseSelection } from 'shared/modules/features/versionedFeatures'
5757
import { isEnterprise } from 'shared/modules/dbMeta/dbMetaDuck'
5858
import { EnterpriseOnlyFrame } from 'browser-components/EditionView'
59+
import { inCloudEnv } from 'shared/modules/app/appDuck'
5960

6061
type UserAddState = any
6162

@@ -290,7 +291,33 @@ export class UserAdd extends Component<any, UserAddState> {
290291
const passwordConfirmId = `password-confirm-${formId}`
291292
const rolesSelectorId = `roles-selector-${formId}`
292293

293-
if (!this.props.isEnterpriseEdition) {
294+
if (this.props.isAura) {
295+
errors = null
296+
aside = (
297+
<FrameAside
298+
title="Frame unavailable"
299+
subtitle="Frame not currently available on aura."
300+
/>
301+
)
302+
frameContents = (
303+
<div>
304+
<p>
305+
User management is currently only available through cypher commands
306+
on Neo4j Aura Enterprise.
307+
</p>
308+
<p>
309+
Read more on user and role management with cypher on{' '}
310+
<a
311+
href="https://neo4j.com/docs/cypher-manual/current/administration/security/users-and-roles"
312+
target="_blank"
313+
rel="noreferrer"
314+
>
315+
the Neo4j Cypher docs.
316+
</a>
317+
</p>
318+
</div>
319+
)
320+
} else if (!this.props.isEnterpriseEdition) {
294321
errors = null
295322
aside = (
296323
<FrameAside
@@ -405,11 +432,13 @@ export class UserAdd extends Component<any, UserAddState> {
405432
const mapStateToProps = (state: any) => {
406433
const { database } = driverDatabaseSelection(state, 'system') || {}
407434
const isEnterpriseEdition = isEnterprise(state)
435+
const isAura = inCloudEnv(state)
408436

409437
return {
410438
canAssignRolesToUser: canAssignRolesToUser(state),
411439
useSystemDb: database,
412-
isEnterpriseEdition
440+
isEnterpriseEdition,
441+
isAura
413442
}
414443
}
415444

src/browser/modules/User/UserList.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { connect } from 'react-redux'
4545
import { isEnterprise } from 'shared/modules/dbMeta/dbMetaDuck'
4646
import FrameAside from '../Frame/FrameAside'
4747
import { EnterpriseOnlyFrame } from 'browser-components/EditionView'
48+
import { inCloudEnv } from 'shared/modules/app/appDuck'
4849

4950
type UserListState = any
5051

@@ -203,7 +204,32 @@ export class UserList extends Component<any, UserListState> {
203204
render() {
204205
let aside = null
205206
let frameContents
206-
if (!this.props.isEnterpriseEdition) {
207+
if (this.props.isAura) {
208+
aside = (
209+
<FrameAside
210+
title="Frame unavailable"
211+
subtitle="Frame not currently available on aura."
212+
/>
213+
)
214+
frameContents = (
215+
<div>
216+
<p>
217+
User management is currently only available through cypher commands
218+
on Neo4j Aura Enterprise.
219+
</p>
220+
<p>
221+
Read more on user and role management with cypher on{' '}
222+
<a
223+
href="https://neo4j.com/docs/cypher-manual/current/administration/security/users-and-roles"
224+
target="_blank"
225+
rel="noreferrer"
226+
>
227+
the Neo4j Cypher docs.
228+
</a>
229+
</p>
230+
</div>
231+
)
232+
} else if (!this.props.isEnterpriseEdition) {
207233
aside = (
208234
<FrameAside
209235
title="Frame unavailable"
@@ -229,10 +255,12 @@ export class UserList extends Component<any, UserListState> {
229255
const mapStateToProps = (state: any) => {
230256
const { database } = driverDatabaseSelection(state, 'system') || {}
231257
const isEnterpriseEdition = isEnterprise(state)
258+
const isAura = inCloudEnv(state)
232259

233260
return {
234261
useSystemDb: database,
235-
isEnterpriseEdition
262+
isEnterpriseEdition,
263+
isAura
236264
}
237265
}
238266

src/shared/modules/app/appDuck.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const inWebEnv = (state: any) => getEnv(state) === WEB
4545
export const inCloudEnv = (state: any) => getEnv(state) === CLOUD
4646
export const inWebBrowser = (state: any) => [WEB, CLOUD].includes(getEnv(state))
4747
export const getAllowedAuthSchemes = (state: any) =>
48-
inCloudEnv(state) ? [] : [NATIVE, NO_AUTH]
48+
inCloudEnv(state) ? [NATIVE] : [NATIVE, NO_AUTH]
4949

5050
export const getAllowedBoltSchemes = (state: any, encryptionFlag?: any) => {
5151
if (inCloudEnv(state) /* Aura only allows neo4j+s */) {

src/shared/modules/dbMeta/dbMeta.utils.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020

21+
import { guessSemverVersion } from '../features/featureDuck.utils'
22+
2123
export function extractServerInfo(res: any) {
2224
const serverInfo = {
2325
version: 'unknown',
@@ -42,14 +44,8 @@ export function extractServerInfo(res: any) {
4244
serverInfo.edition = res.records[0].get('edition')
4345
}
4446

45-
// Temporarily hardcoded solutions for Aura
46-
if (['4.0-aura', '4.0-AuraProfessional'].includes(serverInfo.version)) {
47-
serverInfo.version = '4.0.0'
48-
serverInfo.edition = 'aura'
49-
}
50-
if (serverInfo.version === '4.0-AuraEnterprise') {
51-
serverInfo.version = '4.0.0'
52-
serverInfo.edition = 'auraenterprise'
47+
if (serverInfo.version.includes('-aura')) {
48+
serverInfo.version = guessSemverVersion(serverInfo.version)
5349
}
5450

5551
return serverInfo

src/shared/modules/dbMeta/dbMetaDuck.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const getEdition = (state: any) => state[NAME].server.edition
9898
export const getStoreSize = (state: any) => state[NAME].server.storeSize
9999
export const getClusterRole = (state: any) => state[NAME].role
100100
export const isEnterprise = (state: any) =>
101-
['enterprise', 'auraenterprise'].includes(state[NAME].server.edition)
101+
['enterprise'].includes(state[NAME].server.edition)
102102
export const isBeta = (state: any) => /-/.test(state[NAME].server.version)
103103
export const getStoreId = (state: any) =>
104104
state[NAME] && state[NAME].server ? state[NAME].server.storeId : null

0 commit comments

Comments
 (0)