Fixed issues while testing multiple popups issue. #8316

pull/8616/head
Aditya Toshniwal 2025-03-31 14:28:56 +05:30
parent c001b7b50a
commit cfca6f6218
3 changed files with 30 additions and 24 deletions

View File

@ -83,38 +83,41 @@ Menu.setApplicationMenu(null);
// pgAdmin tried to open the window on the display where the it // pgAdmin tried to open the window on the display where the it
// was last closed. // was last closed.
function isWithinDisplayBounds(pos) { function isWithinDisplayBounds(pos) {
const displays = screen.getAllDisplays() const displays = screen.getAllDisplays();
return displays.reduce((result, display) => { return displays.reduce((result, display) => {
const area = display.workArea const area = display.workArea;
return ( return (
result || result ||
(pos.x >= area.x && (pos.x >= area.x &&
pos.y >= area.y && pos.y >= area.y &&
pos.x < area.x + area.width && pos.x < area.x + area.width &&
pos.y < area.y + area.height) pos.y < area.y + area.height)
) );
}, false) }, false);
} }
function openConfigure() { function openConfigure() {
if (configureWindow === null){ if (configureWindow === null || configureWindow?.isDestroyed()) {
configureWindow = new BrowserWindow({ configureWindow = new BrowserWindow({
show: false, show: false,
width: 600, width: 600,
height: 580, height: 580,
position: 'center', position: 'center',
resizable: false, resizable: false,
parent: pgAdminMainScreen, parent: pgAdminMainScreen,
icon: '../../assets/pgAdmin4.png', icon: '../../assets/pgAdmin4.png',
webPreferences: { webPreferences: {
preload: path.join(__dirname, 'other_preload.js'), preload: path.join(__dirname, 'other_preload.js'),
}, },
}); });
configureWindow.loadFile('./src/html/configure.html'); configureWindow.loadFile('./src/html/configure.html');
configureWindow.once('ready-to-show', ()=>{ configureWindow.once('ready-to-show', ()=>{
configureWindow.show();
});
} else {
configureWindow.hide();
configureWindow.show(); configureWindow.show();
}); }
}
} }
function showErrorDialog(intervalID) { function showErrorDialog(intervalID) {
@ -327,7 +330,7 @@ function launchPgAdminWindow() {
setupMenu(pgAdminMainScreen, { setupMenu(pgAdminMainScreen, {
'view_logs': ()=>{ 'view_logs': ()=>{
if(viewLogWindow === null){ if(viewLogWindow === null || viewLogWindow?.isDestroyed()) {
viewLogWindow = new BrowserWindow({ viewLogWindow = new BrowserWindow({
show: false, show: false,
width: 800, width: 800,
@ -344,6 +347,9 @@ function launchPgAdminWindow() {
viewLogWindow.once('ready-to-show', ()=>{ viewLogWindow.once('ready-to-show', ()=>{
viewLogWindow.show(); viewLogWindow.show();
}); });
} else {
viewLogWindow.hide();
viewLogWindow.show();
} }
}, },
'configure': openConfigure, 'configure': openConfigure,

View File

@ -98,7 +98,7 @@ function confirm(title, text, onOkClick, onCancelClick, okLabel = gettext('Yes')
return ( return (
<AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} okLabel={okLabel} cancelLabel={cancelLabel} okIcon={okIcon}/> <AlertContent text={text} confirm onOkClick={onOkClickClose} onCancelClick={onCancelClickClose} okLabel={okLabel} cancelLabel={cancelLabel} okIcon={okIcon}/>
); );
}, {modalId: modalId}); }, {id: modalId});
} }
function confirmDelete(title, text, onDeleteClick, onCancelClick, deleteLabel = gettext('Delete'), cancelLabel = gettext('Cancel')) { function confirmDelete(title, text, onDeleteClick, onCancelClick, deleteLabel = gettext('Delete'), cancelLabel = gettext('Cancel')) {

View File

@ -1147,7 +1147,7 @@ export function ResultSet() {
eventBus.fireEvent(QUERY_TOOL_EVENTS.WARN_SAVE_TEXT_CLOSE); eventBus.fireEvent(QUERY_TOOL_EVENTS.WARN_SAVE_TEXT_CLOSE);
}} }}
/> />
), {modalId:modalId}); ), {id: modalId});
}; };
useEffect(()=>{ useEffect(()=>{
let isDirty = _.size(dataChangeStore.updated) || _.size(dataChangeStore.added) || _.size(dataChangeStore.deleted); let isDirty = _.size(dataChangeStore.updated) || _.size(dataChangeStore.added) || _.size(dataChangeStore.deleted);