Reset the layout if pgAdmin4 detects the layout is in an inconsistent state. Fixes #6988

This commit is contained in:
Nikhil Mohite 2021-11-12 11:50:37 +05:30 committed by Akshay Joshi
parent d4bf7164f9
commit 8bf178b0a3
2 changed files with 20 additions and 0 deletions

View File

@ -32,3 +32,4 @@ Bug fixes
| `Issue #6949 <https://redmine.postgresql.org/issues/6949>`_ - Ensure that dialog should be opened when clicking on Reassign/Drop owned menu.
| `Issue #6954 <https://redmine.postgresql.org/issues/6954>`_ - Ensure that changing themes should work on Windows when system high contrast mode is enabled.
| `Issue #6976 <https://redmine.postgresql.org/issues/6976>`_ - Fixed an issue where textarea should be allowed to resize and have more than 255 chars.
| `Issue #6988 <https://redmine.postgresql.org/issues/6988>`_ - Reset the layout if pgAdmin4 detects the layout is in an inconsistent state.

View File

@ -61,6 +61,25 @@ _.extend(pgBrowser, {
if (layout != '') {
try {
docker.restore(layout);
// Check restore layout is restored pgAdmin 4 layout successfully if not then reset layout to default pgAdmin 4 layout.
var reset_layout_to_default = true;
for (const [key, value] of Object.entries(this.panels)) {
if(value.name !== 'browser' || key !== 'browser') {
var _panel = docker.findPanels(value.name);
if(_panel.length > 0){
reset_layout_to_default = false;
break;
}
}
}
if(reset_layout_to_default && defaultLayoutCallback) {
// clear the wcDocker before reset layout.
docker.clear();
Alertify.info(gettext('pgAdmin has detected some issues with the UI layout, so reset it to the default.'), 0);
if(defaultLayoutCallback){
defaultLayoutCallback(docker);
}
}
}
catch(err) {
docker.clear();