@@ -20,6 +20,7 @@ import type { CompassApplication } from './application';
2020import {
2121 getWindowAutoConnectPreferences ,
2222 registerMongoDbUrlForBrowserWindow ,
23+ registerConnectionIdForBrowserWindow ,
2324} from './auto-connect' ;
2425
2526const { debug } = createLogger ( 'COMPASS-WINDOW-MANAGER' ) ;
@@ -95,16 +96,19 @@ async function showWindowWhenReady(bw: BrowserWindow) {
9596 */
9697function 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