mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-24 09:40:21 -06:00
Fixed an issue where "Quit App" confirmation modal in desktop app is not respecting "Confirm on close or refresh?". #7890
This commit is contained in:
parent
23ea201325
commit
100f59f78b
@ -37,4 +37,5 @@ Bug fixes
|
|||||||
| `Issue #7811 <https://github.com/pgadmin-org/pgadmin4/issues/7811>`_ - Fixed an issue where servers listed in the servers.json file were being reimported upon container restart.
|
| `Issue #7811 <https://github.com/pgadmin-org/pgadmin4/issues/7811>`_ - Fixed an issue where servers listed in the servers.json file were being reimported upon container restart.
|
||||||
| `Issue #7839 <https://github.com/pgadmin-org/pgadmin4/issues/7839>`_ - Added support for OIDC based OAuth2 authentication.
|
| `Issue #7839 <https://github.com/pgadmin-org/pgadmin4/issues/7839>`_ - Added support for OIDC based OAuth2 authentication.
|
||||||
| `Issue #7878 <https://github.com/pgadmin-org/pgadmin4/issues/7878>`_ - Fixed an issue where cursor moves to end of line when editing input fields.
|
| `Issue #7878 <https://github.com/pgadmin-org/pgadmin4/issues/7878>`_ - Fixed an issue where cursor moves to end of line when editing input fields.
|
||||||
|
| `Issue #7890 <https://github.com/pgadmin-org/pgadmin4/issues/7890>`_ - Fixed an issue where "Quit App" confirmation modal in desktop app is not respecting "Confirm on close or refresh?".
|
||||||
| `Issue #7895 <https://github.com/pgadmin-org/pgadmin4/issues/7895>`_ - Fixed an issue where different client backend shows all SQL are same.
|
| `Issue #7895 <https://github.com/pgadmin-org/pgadmin4/issues/7895>`_ - Fixed an issue where different client backend shows all SQL are same.
|
@ -75,7 +75,7 @@ function buildMenu(pgadminMenus, pgAdminMainScreen, callbacks) {
|
|||||||
{
|
{
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ label: 'Reload', click: ()=>BrowserWindow.getFocusedWindow().webContents.reload()},
|
{ label: 'Reload', click: callbacks['reloadApp']},
|
||||||
{ label: 'Toggle Developer Tools', click: ()=>BrowserWindow.getFocusedWindow().webContents.openDevTools({ mode: 'bottom' })},
|
{ label: 'Toggle Developer Tools', click: ()=>BrowserWindow.getFocusedWindow().webContents.openDevTools({ mode: 'bottom' })},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ role: 'resetZoom' },
|
{ role: 'resetZoom' },
|
||||||
|
@ -115,6 +115,17 @@ function showErrorDialog(intervalID) {
|
|||||||
}).loadFile('./src/html/server_error.html');
|
}).loadFile('./src/html/server_error.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadApp() {
|
||||||
|
const currWin = BrowserWindow.getFocusedWindow();
|
||||||
|
|
||||||
|
const preventUnload = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
currWin.webContents.off('will-prevent-unload', preventUnload);
|
||||||
|
};
|
||||||
|
currWin.webContents.on('will-prevent-unload', preventUnload)
|
||||||
|
currWin.webContents.reload();
|
||||||
|
}
|
||||||
|
|
||||||
// This functions is used to start the pgAdmin4 server by spawning a
|
// This functions is used to start the pgAdmin4 server by spawning a
|
||||||
// separate process.
|
// separate process.
|
||||||
function startDesktopMode() {
|
function startDesktopMode() {
|
||||||
@ -287,6 +298,7 @@ function launchPgAdminWindow() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
'configure': openConfigure,
|
'configure': openConfigure,
|
||||||
|
'reloadApp': reloadApp,
|
||||||
});
|
});
|
||||||
|
|
||||||
pgAdminMainScreen.loadURL(startPageUrl);
|
pgAdminMainScreen.loadURL(startPageUrl);
|
||||||
@ -353,9 +365,10 @@ ipcMain.on('restartApp', ()=>{
|
|||||||
app.relaunch();
|
app.relaunch();
|
||||||
app.exit(0);
|
app.exit(0);
|
||||||
});
|
});
|
||||||
ipcMain.handle('log', (text) => ()=>{
|
ipcMain.on('log', (text) => ()=>{
|
||||||
misc.writeServerLog(text);
|
misc.writeServerLog(text);
|
||||||
});
|
});
|
||||||
|
ipcMain.on('reloadApp', reloadApp);
|
||||||
ipcMain.handle('checkPortAvailable', async (_e, fixedPort)=>{
|
ipcMain.handle('checkPortAvailable', async (_e, fixedPort)=>{
|
||||||
try {
|
try {
|
||||||
await misc.getAvailablePort(fixedPort);
|
await misc.getAvailablePort(fixedPort);
|
||||||
|
@ -23,4 +23,5 @@ contextBridge.exposeInMainWorld('electronUI', {
|
|||||||
showOpenDialog: (options) => ipcRenderer.invoke('showOpenDialog', options),
|
showOpenDialog: (options) => ipcRenderer.invoke('showOpenDialog', options),
|
||||||
showSaveDialog: (options) => ipcRenderer.invoke('showSaveDialog', options),
|
showSaveDialog: (options) => ipcRenderer.invoke('showSaveDialog', options),
|
||||||
log: (text)=> ipcRenderer.send('log', text),
|
log: (text)=> ipcRenderer.send('log', text),
|
||||||
|
reloadApp: ()=>{ipcRenderer.send('reloadApp');},
|
||||||
});
|
});
|
@ -26,6 +26,7 @@ import { DefaultButton, PgIconButton, PrimaryButton } from '../../../../static/j
|
|||||||
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
||||||
import { getBinaryPathSchema } from '../../../../browser/server_groups/servers/static/js/binary_path.ui';
|
import { getBinaryPathSchema } from '../../../../browser/server_groups/servers/static/js/binary_path.ui';
|
||||||
import usePreferences from '../store';
|
import usePreferences from '../store';
|
||||||
|
import { getBrowser } from '../../../../static/js/utils';
|
||||||
|
|
||||||
|
|
||||||
const StyledBox = styled(Box)(({theme}) => ({
|
const StyledBox = styled(Box)(({theme}) => ({
|
||||||
@ -110,6 +111,16 @@ class PreferencesSchema extends BaseUISchema {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function reloadPgAdmin() {
|
||||||
|
let {name: browser} = getBrowser();
|
||||||
|
if(browser == 'Electron') {
|
||||||
|
await window.electronUI.log('test');
|
||||||
|
await window.electronUI.reloadApp();
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function RightPanel({ schema, refreshKey, ...props }) {
|
function RightPanel({ schema, refreshKey, ...props }) {
|
||||||
const schemaViewRef = React.useRef(null);
|
const schemaViewRef = React.useRef(null);
|
||||||
@ -583,7 +594,7 @@ export default function PreferencesComponent({ ...props }) {
|
|||||||
gettext('A page refresh is required to apply the theme. Do you wish to refresh the page now?'),
|
gettext('A page refresh is required to apply the theme. Do you wish to refresh the page now?'),
|
||||||
function () {
|
function () {
|
||||||
/* If user clicks Yes */
|
/* If user clicks Yes */
|
||||||
location.reload();
|
reloadPgAdmin();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
function () { props.closeModal();},
|
function () { props.closeModal();},
|
||||||
@ -643,7 +654,7 @@ export default function PreferencesComponent({ ...props }) {
|
|||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
}).then(()=>{
|
}).then(()=>{
|
||||||
if (refresh){
|
if (refresh){
|
||||||
location.reload();
|
reloadPgAdmin();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
preferencesStore.cache();
|
preferencesStore.cache();
|
||||||
|
@ -236,7 +236,11 @@ export function useBeforeUnload({ enabled, isNewTab, beforeClose, closePanel })
|
|||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(getBrowser().name == 'Electron' && isNewTab) {
|
if(getBrowser().name == 'Electron' && isNewTab) {
|
||||||
window.addEventListener('beforeunload', onBeforeUnloadElectron);
|
if(enabled) {
|
||||||
|
window.addEventListener('beforeunload', onBeforeUnloadElectron);
|
||||||
|
} else {
|
||||||
|
window.removeEventListener('beforeunload', onBeforeUnloadElectron);
|
||||||
|
}
|
||||||
} else if(getBrowser().name != 'Electron') {
|
} else if(getBrowser().name != 'Electron') {
|
||||||
if(enabled){
|
if(enabled){
|
||||||
window.addEventListener('beforeunload', onBeforeUnload);
|
window.addEventListener('beforeunload', onBeforeUnload);
|
||||||
|
Loading…
Reference in New Issue
Block a user