public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM-6988]: Reset pgAdmin layout if the layout is in an inconsistent state.
Date: Thu, 11 Nov 2021 15:05:32 +0530
Message-ID: <CAOBg0AMiZfL5--CNcfcaG2kvb5SeRswpEj0gSibyVemYDaSdSQ@mail.gmail.com> (raw)

Hi Hackers,

Please find the attached patch for RM-6988:
<https://redmine.postgresql.org/issues/6988; Reset pgAdmin layout if the
layout is in an inconsistent state.


-- 
*Thanks & Regards,*
*Nikhil Mohite*
*Senior Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*


Attachments:

  [application/octet-stream] RM-6988.patch (1.2K, 3-RM-6988.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/layout.js b/web/pgadmin/browser/static/js/layout.js
index 9491bfaa..cb741a65 100644
--- a/web/pgadmin/browser/static/js/layout.js
+++ b/web/pgadmin/browser/static/js/layout.js
@@ -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.warning(gettext('PgAdmin detected some issues with the UI layout, pgAdmin reset it to the default layout.'), 0);
+          if(defaultLayoutCallback){
+            defaultLayoutCallback(docker);
+          }
+        }
       }
       catch(err) {
         docker.clear();


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM-6988]: Reset pgAdmin layout if the layout is in an inconsistent state.
  In-Reply-To: <CAOBg0AMiZfL5--CNcfcaG2kvb5SeRswpEj0gSibyVemYDaSdSQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox