@@ -21,13 +21,13 @@ const debug = createDebug('mongodb-compass:menu');
2121
2222const COMPASS_HELP = 'https://docs.mongodb.com/compass/' ;
2323
24- function separator ( ) {
24+ function separator ( ) : MenuItemConstructorOptions {
2525 return {
2626 type : 'separator' as const ,
2727 } ;
2828}
2929
30- function quitItem ( label : string ) {
30+ function quitItem ( label : string ) : MenuItemConstructorOptions {
3131 return {
3232 label : label ,
3333 accelerator : 'CmdOrCtrl+Q' ,
@@ -37,7 +37,7 @@ function quitItem(label: string) {
3737 } ;
3838}
3939
40- function compassOverviewItem ( ) {
40+ function compassOverviewItem ( ) : MenuItemConstructorOptions {
4141 return {
4242 label : `${ app . getName ( ) } &Overview` ,
4343 click ( ) {
@@ -46,7 +46,7 @@ function compassOverviewItem() {
4646 } ;
4747}
4848
49- function networkOptInDialogItem ( ) {
49+ function networkOptInDialogItem ( ) : MenuItemConstructorOptions {
5050 return {
5151 label : '&Privacy Settings' ,
5252 click ( ) {
@@ -55,36 +55,36 @@ function networkOptInDialogItem() {
5555 } ;
5656}
5757
58- function darwinCompassSubMenu ( ) {
58+ function darwinCompassSubMenu ( ) : MenuItemConstructorOptions {
5959 return {
6060 label : app . getName ( ) ,
6161 submenu : [
6262 {
6363 label : `About ${ app . getName ( ) } ` ,
64- selector : 'orderFrontStandardAboutPanel: ' ,
64+ role : 'about ' ,
6565 } ,
6666 separator ( ) ,
6767 {
6868 label : 'Hide' ,
6969 accelerator : 'Command+H' ,
70- selector : 'hide: ' ,
70+ role : 'hide' ,
7171 } ,
7272 {
7373 label : 'Hide Others' ,
7474 accelerator : 'Command+Shift+H' ,
75- selector : 'hideOtherApplications: ' ,
75+ role : 'hideOthers ' ,
7676 } ,
7777 {
7878 label : 'Show All' ,
79- selector : 'unhideAllApplications: ' ,
79+ role : 'unhide ' ,
8080 } ,
8181 separator ( ) ,
8282 quitItem ( 'Quit' ) ,
8383 ] ,
8484 } ;
8585}
8686
87- function connectItem ( app : typeof CompassApplication ) {
87+ function connectItem ( app : typeof CompassApplication ) : MenuItemConstructorOptions {
8888 return {
8989 label : 'New &Connection' ,
9090 accelerator : 'CmdOrCtrl+N' ,
@@ -94,7 +94,7 @@ function connectItem(app: typeof CompassApplication) {
9494 } ;
9595}
9696
97- function disconnectItem ( ) {
97+ function disconnectItem ( ) : MenuItemConstructorOptions {
9898 return {
9999 label : '&Disconnect' ,
100100 click ( ) {
@@ -103,7 +103,7 @@ function disconnectItem() {
103103 } ;
104104}
105105
106- function connectSubMenu ( nonDarwin : boolean , app : typeof CompassApplication ) {
106+ function connectSubMenu ( nonDarwin : boolean , app : typeof CompassApplication ) : MenuItemConstructorOptions {
107107 const subMenu : MenuTemplate = [ connectItem ( app ) , disconnectItem ( ) ] ;
108108
109109 if ( nonDarwin ) {
@@ -117,7 +117,7 @@ function connectSubMenu(nonDarwin: boolean, app: typeof CompassApplication) {
117117 } ;
118118}
119119
120- function editSubMenu ( ) {
120+ function editSubMenu ( ) : MenuItemConstructorOptions {
121121 return {
122122 label : 'Edit' ,
123123 submenu : [
@@ -164,7 +164,7 @@ function editSubMenu() {
164164 } ;
165165}
166166
167- function nonDarwinAboutItem ( ) {
167+ function nonDarwinAboutItem ( ) : MenuItemConstructorOptions {
168168 return {
169169 label : `&About ${ app . getName ( ) } ` ,
170170 click ( ) {
@@ -180,7 +180,7 @@ function nonDarwinAboutItem() {
180180 } ;
181181}
182182
183- function helpWindowItem ( ) {
183+ function helpWindowItem ( ) : MenuItemConstructorOptions {
184184 return {
185185 label : `&Online ${ app . getName ( ) } Help` ,
186186 accelerator : 'F1' ,
@@ -190,7 +190,7 @@ function helpWindowItem() {
190190 } ;
191191}
192192
193- function securityItem ( ) {
193+ function securityItem ( ) : MenuItemConstructorOptions {
194194 return {
195195 label : '&Plugins' ,
196196 click ( ) {
@@ -199,7 +199,7 @@ function securityItem() {
199199 } ;
200200}
201201
202- function license ( ) {
202+ function license ( ) : MenuItemConstructorOptions {
203203 return {
204204 label : '&License' ,
205205 async click ( ) {
@@ -214,7 +214,7 @@ function license() {
214214 } ;
215215}
216216
217- function logFile ( app : typeof CompassApplication ) {
217+ function logFile ( app : typeof CompassApplication ) : MenuItemConstructorOptions {
218218 return {
219219 label : '&Open Log File' ,
220220 click ( ) {
@@ -223,7 +223,7 @@ function logFile(app: typeof CompassApplication) {
223223 } ;
224224}
225225
226- function helpSubMenu ( app : typeof CompassApplication ) {
226+ function helpSubMenu ( app : typeof CompassApplication ) : MenuItemConstructorOptions {
227227 const subMenu = [ ] ;
228228 subMenu . push ( helpWindowItem ( ) ) ;
229229
@@ -248,7 +248,7 @@ function helpSubMenu(app: typeof CompassApplication) {
248248 } ;
249249}
250250
251- function collectionSubMenu ( ) {
251+ function collectionSubMenu ( ) : MenuItemConstructorOptions {
252252 const subMenu = [ ] ;
253253 subMenu . push ( {
254254 label : '&Share Schema as JSON' ,
@@ -278,7 +278,7 @@ function collectionSubMenu() {
278278 } ;
279279}
280280
281- function viewSubMenu ( ) {
281+ function viewSubMenu ( ) : MenuItemConstructorOptions {
282282 return {
283283 label : '&View' ,
284284 submenu : [
@@ -330,7 +330,7 @@ function viewSubMenu() {
330330 } ;
331331}
332332
333- function windowSubMenu ( ) {
333+ function windowSubMenu ( ) : MenuItemConstructorOptions {
334334 return {
335335 label : 'Window' ,
336336 submenu : [
@@ -347,7 +347,7 @@ function windowSubMenu() {
347347 separator ( ) ,
348348 {
349349 label : 'Bring All to Front' ,
350- selector : 'arrangeInFront: ' ,
350+ role : 'front ' ,
351351 } ,
352352 ] ,
353353 } ;
@@ -357,7 +357,7 @@ function windowSubMenu() {
357357function darwinMenu (
358358 menuState : WindowMenuState ,
359359 app : typeof CompassApplication
360- ) {
360+ ) : MenuTemplate {
361361 const menu : MenuTemplate = [ darwinCompassSubMenu ( ) ] ;
362362
363363 menu . push ( connectSubMenu ( false , app ) ) ;
@@ -377,7 +377,7 @@ function darwinMenu(
377377function nonDarwinMenu (
378378 menuState : WindowMenuState ,
379379 app : typeof CompassApplication
380- ) {
380+ ) : MenuTemplate {
381381 const menu = [ connectSubMenu ( true , app ) , viewSubMenu ( ) ] ;
382382
383383 if ( menuState . showCollection ) {
@@ -434,7 +434,7 @@ class CompassMenu {
434434 debug ( `WINDOW ${ bw . id } load()` ) ;
435435
436436 if ( bw . id !== this . currentWindowMenuLoaded ) {
437- if ( this . windowState . has ( bw . id ) ) {
437+ if ( ! this . windowState . has ( bw . id ) ) {
438438 this . addWindow ( bw ) ;
439439
440440 debug ( `create menu state for new WINDOW ${ bw . id } ` ) ;
0 commit comments