When opening pgAdmin the layout should be auto reset if it is corrupted. Reset layout menu should work if layout is corrupted while using pgAdmin. #6266

This commit is contained in:
Aditya Toshniwal 2023-05-26 18:30:28 +05:30
parent 72794f9524
commit dc8832192d
2 changed files with 4 additions and 5 deletions

View File

@ -85,9 +85,9 @@ export default class MainMenuFactory {
return new MenuItem({...options, callback: () => {
// Some callbacks registered in 'callbacks' check and call specifiec callback function
if (options.module && 'callbacks' in options.module && options.module.callbacks[options.callback]) {
options.module.callbacks[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree.selected()]);
options.module.callbacks[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree?.selected()]);
} else if (options.module && options.module[options.callback]) {
options.module[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree.selected()]);
options.module[options.callback].apply(options.module, [options.data, pgAdmin.Browser.tree?.selected()]);
} else if (options?.callback) {
options.callback(options);
} else {
@ -125,4 +125,4 @@ export default class MainMenuFactory {
return {flag,showMenu:undefined};
}
}
}
}

View File

@ -62,8 +62,7 @@ _.extend(pgBrowser, {
docker.restore(layout);
if(checkLayout) {
// Check restore layout is restored pgAdmin 4 layout successfully if not then reset layout to default pgAdmin 4 layout.
let _panel = docker.findPanels('properties');
if(_panel.length == 0 && defaultLayoutCallback){
if((docker.findPanels('properties').length == 0 || docker.findPanels('browser').length == 0) && defaultLayoutCallback){
// clear the wcDocker before reset layout.
docker.clear();
Notify.info(gettext('pgAdmin has reset the layout because the previously saved layout is invalid.'), null);