From cd00508fa0a48c5d5ee758edb23919f0a8f71ce3 Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Sat, 15 Oct 2016 20:43:07 -0400 Subject: [PATCH 1/2] COMPASS-160 fix connect window focus regression - the connect window used to check the clipboard for a mongodb:// connection string and offer to populate the connect form. This was broken recently. This fix brings back the feature. --- src/app/connect/index.js | 6 ++++-- src/main/window-manager.js | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/connect/index.js b/src/app/connect/index.js index 063fbf59964..338be31f6f9 100644 --- a/src/app/connect/index.js +++ b/src/app/connect/index.js @@ -274,7 +274,7 @@ var ConnectView = View.extend({ this.listenToAndRun(this, 'change:sshTunnelMethod', this.replaceSshTunnelMethodFields.bind(this)); - this.listenToAndRun(app, 'connect-window-focused', + ipc.on('app:connect-window-focused', this.onConnectWindowFocused.bind(this)); // always start in NEW_EMPTY state @@ -288,7 +288,9 @@ var ConnectView = View.extend({ * a MongoDB URI was detected. */ autofillFromClipboard: function() { - this.connection = MongoDBConnection.from(this.clipboardText); + this.connection = Connection.from(this.clipboardText); + // don't use "Local" as favorite name, keep field empty + this.connection.name = ''; this.updateForm(); }, diff --git a/src/main/window-manager.js b/src/main/window-manager.js index 13386cfa0d1..73cdf1b13ae 100644 --- a/src/main/window-manager.js +++ b/src/main/window-manager.js @@ -161,6 +161,9 @@ function showConnectWindow() { debug('connect window closed.'); connectWindow = null; }); + connectWindow.on('focus', function() { + connectWindow.webContents.send('app:connect-window-focused'); + }); } function closeConnectWindow() { From 90fae7d1ceb310dab9b487a965d77f01df89cae8 Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Sun, 16 Oct 2016 16:00:48 -0400 Subject: [PATCH 2/2] COMPASS-160 also check for URI in clipboard on launch --- src/app/connect/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/connect/index.js b/src/app/connect/index.js index 338be31f6f9..c8e2a84b432 100644 --- a/src/app/connect/index.js +++ b/src/app/connect/index.js @@ -274,8 +274,10 @@ var ConnectView = View.extend({ this.listenToAndRun(this, 'change:sshTunnelMethod', this.replaceSshTunnelMethodFields.bind(this)); + // add event listener to focus event and also check on app launch ipc.on('app:connect-window-focused', this.onConnectWindowFocused.bind(this)); + this.onConnectWindowFocused(); // always start in NEW_EMPTY state this.dispatch('new connection clicked');