From 270d800b4404061eb6d3c1fa28f776bd044cff02 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Tue, 17 Oct 2017 08:38:49 +0200 Subject: [PATCH] Use new desktop api Act on GRAPH_ACTIVE and GRAPH_INACTIVE rather than DATABASE_STARTED and DATABASE_STOPPED --- package.json | 2 +- src/browser/modules/App/App.jsx | 11 ++++---- .../modules/Stream/Auth/ConnectedView.jsx | 24 ++++++++++++----- .../modules/Stream/Auth/ServerSwitchFrame.jsx | 26 +++++++++++++------ 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index e01dea85635..40394e5fc04 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "homepage": "https://neo4j.com", "main": "dist/index.html", "neo4jDesktop": { - "apiVersion": "1.1.0" + "apiVersion": "^1.2.0" }, "scripts": { "start": diff --git a/src/browser/modules/App/App.jsx b/src/browser/modules/App/App.jsx index 704c6679ead..441f80bc4d0 100644 --- a/src/browser/modules/App/App.jsx +++ b/src/browser/modules/App/App.jsx @@ -113,8 +113,8 @@ class App extends Component { @@ -176,14 +176,13 @@ const mapDispatchToProps = dispatch => { } const mergeProps = (stateProps, dispatchProps, ownProps) => { - const changeConnectionMaybe = (event, newContext, oldContext) => { - const didChange = didChangeActiveGraph(newContext, oldContext) - if (!didChange) return + const switchConnection = (event, newContext, oldContext) => { const creds = getActiveCredentials('bolt', newContext) if (!creds) return // No conection. Ignore and let browser show connection lost msgs. const connectionCreds = { // Use current connections creds until we get new from API ...stateProps.defaultConnectionData, + ...creds, encrypted: creds.tlsLevel === 'REQUIRED', host: `bolt://${creds.host}:${creds.port}` } @@ -209,7 +208,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { ...stateProps, ...ownProps, ...dispatchProps, - changeConnectionMaybe, + switchConnection, setInitialConnectionData, closeConnectionMaybe } diff --git a/src/browser/modules/Stream/Auth/ConnectedView.jsx b/src/browser/modules/Stream/Auth/ConnectedView.jsx index e4834764a7c..a5023463701 100644 --- a/src/browser/modules/Stream/Auth/ConnectedView.jsx +++ b/src/browser/modules/Stream/Auth/ConnectedView.jsx @@ -29,22 +29,34 @@ const ConnectedView = ({ host, username, storeCredentials, + hideStoreCredentials = false, + additionalFooter = null, showHost = true }) => { return ( - You are connected as user {username} -
+ + + You are connected as user {username} +
+
+
+ You are connected to the server {host}
- - Connection credentials are {storeCredentials ? '' : 'not '}stored in - your web browser. - + + + Connection credentials are {storeCredentials ? '' : 'not '}stored in + your web browser. + + + + {additionalFooter} +
) } diff --git a/src/browser/modules/Stream/Auth/ServerSwitchFrame.jsx b/src/browser/modules/Stream/Auth/ServerSwitchFrame.jsx index 69924b263a7..57efe7a3a54 100644 --- a/src/browser/modules/Stream/Auth/ServerSwitchFrame.jsx +++ b/src/browser/modules/Stream/Auth/ServerSwitchFrame.jsx @@ -33,7 +33,10 @@ import ClickToCode from '../../ClickToCode' class ServerStatusFrame extends Component { render () { - const { frame } = this.props + const { + frame, + activeConnectionData: dynamicConnectionData = {} + } = this.props const { activeConnectionData, storeCredentials } = frame return ( - The updated credentials was not correct. + The connection credentials provided could not be used to + connect.
You are now disconnected.
@@ -61,7 +65,8 @@ class ServerStatusFrame extends Component { if={ frame.type === 'switch-success' && activeConnectionData && - activeConnectionData.authEnabled + dynamicConnectionData && + dynamicConnectionData.authEnabled } > - - You have a working connection with the Neo4j database and - server auth is disabled. - +
+ +