From 33c88ceb6811d2c77ab606ffe64632310910fbc4 Mon Sep 17 00:00:00 2001 From: Rohit Bhati Date: Thu, 3 Oct 2024 16:29:11 +0530 Subject: [PATCH] - Move 'About pgAdmin 4' to app menu on macOS. #7289 - Add appropriate minimum width and height setting for desktop apps to avoid app accidentally going below visibility levels. #7988 --- runtime/src/js/menu.js | 14 ++++++++++++++ runtime/src/js/pgadmin.js | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/runtime/src/js/menu.js b/runtime/src/js/menu.js index 6609d3445..4bffc22ef 100644 --- a/runtime/src/js/menu.js +++ b/runtime/src/js/menu.js @@ -41,6 +41,20 @@ function buildMenu(pgadminMenus, pgAdminMainScreen, callbacks) { }); let menuFile = pgadminMenus.shift(); + + if (isMac) { + // Remove About pgAdmin 4 from help menu and add it to the top of menuFile submenu. + const helpMenu = pgadminMenus.find((menu) => menu.name == 'help'); + if (helpMenu) { + const aboutItem = helpMenu.submenu.find((item) => item.name === 'mnu_about'); + if (aboutItem) { + helpMenu.submenu = helpMenu.submenu.filter((item) => item.name !== 'mnu_about'); + menuFile.submenu.unshift(aboutItem); + menuFile.submenu.splice(1, 0, { type: 'separator' }); + } + } + } + template.push({ ...menuFile, submenu: [ diff --git a/runtime/src/js/pgadmin.js b/runtime/src/js/pgadmin.js index 02aeb3a46..7312bae90 100644 --- a/runtime/src/js/pgadmin.js +++ b/runtime/src/js/pgadmin.js @@ -264,8 +264,8 @@ function launchPgAdminWindow() { 'frame': true, 'position': 'center', 'resizable': true, - 'min_width': 640, - 'min_height': 480, + 'minWidth': 640, + 'minHeight': 480, 'width': 1024, 'height': 768, 'focus': true, @@ -323,8 +323,8 @@ function launchPgAdminWindow() { action: 'allow', overrideBrowserWindowOptions: { 'position': 'center', - 'min_width': 640, - 'min_height': 480, + 'minWidth': 640, + 'minHeight': 480, icon: '../../assets/pgAdmin4.png', ...pgAdminMainScreen.getBounds(), webPreferences: {