Skip to content

Commit fd07061

Browse files
committed
Propagate from main IPC into window manager
1 parent 8d75161 commit fd07061

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

packages/compass/src/main/window-manager.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type { CompassApplication } from './application';
2020
import {
2121
getWindowAutoConnectPreferences,
2222
registerMongoDbUrlForBrowserWindow,
23+
registerConnectionIdForBrowserWindow,
2324
} from './auto-connect';
2425

2526
const { debug } = createLogger('COMPASS-WINDOW-MANAGER');
@@ -95,16 +96,19 @@ async function showWindowWhenReady(bw: BrowserWindow) {
9596
*/
9697
function showConnectWindow(
9798
compassApp: typeof CompassApplication,
98-
opts: Partial<
99+
{
100+
rendererUrl = DEFAULT_URL,
101+
mongodbUrl,
102+
connectionId,
103+
...opts
104+
}: Partial<
99105
BrowserWindowConstructorOptions & {
100106
rendererUrl: string;
101107
mongodbUrl: string;
108+
connectionId: string;
102109
}
103110
> = {}
104111
): BrowserWindow {
105-
const rendererUrl = opts.rendererUrl ?? DEFAULT_URL;
106-
const mongodbUrl = opts.mongodbUrl;
107-
108112
const windowOpts = {
109113
width: Number(DEFAULT_WIDTH),
110114
height: Number(DEFAULT_HEIGHT),
@@ -143,6 +147,9 @@ function showConnectWindow(
143147
if (mongodbUrl) {
144148
registerMongoDbUrlForBrowserWindow(window, mongodbUrl);
145149
}
150+
if (connectionId) {
151+
registerConnectionIdForBrowserWindow(window, connectionId);
152+
}
146153
if (networkTraffic !== true) {
147154
// https://github.com/electron/electron/issues/22995
148155
window.webContents.session.setSpellCheckerDictionaryDownloadURL(
@@ -265,6 +272,8 @@ class CompassWindowManager {
265272
return getWindowAutoConnectPreferences(bw, compassApp.preferences);
266273
},
267274
'test:show-connect-window': () => showConnectWindow(compassApp),
275+
'app:connect-in-new-window': (event, connectionId: string) =>
276+
showConnectWindow(compassApp, { connectionId }),
268277
});
269278

270279
ipcMain?.on('show-file', (evt, filename: string) => {

0 commit comments

Comments
 (0)