Skip to content

Commit 42e08c6

Browse files
rueckstiessimlucas
authored andcommitted
COMPASS-160 fix connect window focus regression (#521)
* 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. * COMPASS-160 also check for URI in clipboard on launch
1 parent 98bd37f commit 42e08c6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/app/connect/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,10 @@ var ConnectView = View.extend({
274274
this.listenToAndRun(this, 'change:sshTunnelMethod',
275275
this.replaceSshTunnelMethodFields.bind(this));
276276

277-
this.listenToAndRun(app, 'connect-window-focused',
277+
// add event listener to focus event and also check on app launch
278+
ipc.on('app:connect-window-focused',
278279
this.onConnectWindowFocused.bind(this));
280+
this.onConnectWindowFocused();
279281

280282
// always start in NEW_EMPTY state
281283
this.dispatch('new connection clicked');
@@ -288,7 +290,9 @@ var ConnectView = View.extend({
288290
* a MongoDB URI was detected.
289291
*/
290292
autofillFromClipboard: function() {
291-
this.connection = MongoDBConnection.from(this.clipboardText);
293+
this.connection = Connection.from(this.clipboardText);
294+
// don't use "Local" as favorite name, keep field empty
295+
this.connection.name = '';
292296
this.updateForm();
293297
},
294298

src/main/window-manager.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ function showConnectWindow() {
161161
debug('connect window closed.');
162162
connectWindow = null;
163163
});
164+
connectWindow.on('focus', function() {
165+
connectWindow.webContents.send('app:connect-window-focused');
166+
});
164167
}
165168

166169
function closeConnectWindow() {

0 commit comments

Comments
 (0)