public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM-6988]: Reset pgAdmin layout if the layout is in an inconsistent state.
Date: Mon, 15 Nov 2021 15:36:22 +0530
Message-ID: <CAOBg0AOKHUCO0mSj_MNKPF-+zNvus2mrwmFcvWAjxV=oDS4m8Q@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDfX-iLgP-DFykJLwVep67+Nn2VQ2FqO-iB2H8nhpyAVhg@mail.gmail.com>
References: <CAOBg0AMiZfL5--CNcfcaG2kvb5SeRswpEj0gSibyVemYDaSdSQ@mail.gmail.com>
	<CANxoLDfX-iLgP-DFykJLwVep67+Nn2VQ2FqO-iB2H8nhpyAVhg@mail.gmail.com>

Hi Akshay,

Please find the updated patch for RM-6988.
Resolved the issue where reset layout message showing when open query
tool(or open query tool in new tab).

Regards,
Nikhil Mohite

On Fri, Nov 12, 2021 at 12:00 PM Akshay Joshi <[email protected]>
wrote:

> Thanks, the patch applied.
>
> On Thu, Nov 11, 2021 at 3:05 PM Nikhil Mohite <
> [email protected]> wrote:
>
>> 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.*
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


Attachments:

  [application/octet-stream] RM-6988_v2.patch (2.7K, 3-RM-6988_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index 6be59dd9..ac7222ea 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -430,7 +430,7 @@ define('pgadmin.browser', [
 
         // Stored layout in database from the previous session
         var layout = pgBrowser.utils.layout;
-        obj.restore_layout(obj.docker, layout, obj.buildDefaultLayout.bind(obj));
+        obj.restore_layout(obj.docker, layout, obj.buildDefaultLayout.bind(obj), true);
 
         obj.docker.on(wcDocker.EVENT.LAYOUT_CHANGED, function() {
           obj.save_current_layout('Browser/Layout', obj.docker);
diff --git a/web/pgadmin/browser/static/js/layout.js b/web/pgadmin/browser/static/js/layout.js
index 90929d42..6fa19e47 100644
--- a/web/pgadmin/browser/static/js/layout.js
+++ b/web/pgadmin/browser/static/js/layout.js
@@ -56,30 +56,23 @@ _.extend(pgBrowser, {
     }
   },
 
-  restore_layout: function(docker, layout, defaultLayoutCallback) {
+  restore_layout: function(docker, layout, defaultLayoutCallback, checkLayout= false) {
     // Try to restore the layout if there is one
     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(checkLayout) {
+          // Check restore layout is restored pgAdmin 4 layout successfully if not then reset layout to default pgAdmin 4 layout.
+          var _panel = docker.findPanels('properties');
+          if(_panel.length == 0 && 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);
             }
           }
         }
-        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();


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], [email protected]
  Subject: Re: [pgAdmin][RM-6988]: Reset pgAdmin layout if the layout is in an inconsistent state.
  In-Reply-To: <CAOBg0AOKHUCO0mSj_MNKPF-+zNvus2mrwmFcvWAjxV=oDS4m8Q@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