public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rahul Shirsat <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin] RM4892 pgAdmin "Inception"
Date: Wed, 23 Dec 2020 20:16:48 +0530
Message-ID: <CAKtn9dMus8pTVv5p9o4PNQccZ04Pk0wAFRD=akpS5g5O2PDV7Q@mail.gmail.com> (raw)

Hi Hackers,

Please find the attached patch which resolves the issue of pgadmin
Inception in Firefox browser.

The fix is tested on:

   1. MacOS 10.13.6 Firefox Browser 84.0 (64-bit)
   2. Windows 2016 Firefox Browser 84.0.1 (64-bit)

-- 
*Rahul Shirsat*
Senior Software Engineer | EnterpriseDB Corporation.


Attachments:

  [application/octet-stream] RM4892.patch (2.6K, 3-RM4892.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
index d7e3da9b6..7c1f16523 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py
@@ -148,7 +148,8 @@ def check_precondition(f):
         self.datistemplate = \
             self.manager.db_info[kwargs['did']]['datistemplate'] \
             if self.manager.db_info is not None and \
-            kwargs['did'] in self.manager.db_info else False
+            kwargs['did'] in self.manager.db_info and \
+            'datistemplate' in self.manager.db_info[kwargs['did']] else False
 
         # Set the template path for the SQL scripts
         if self.manager.server_type == 'gpdb':
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index 20ed9da4b..b698c08e7 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -299,7 +299,7 @@ define('pgadmin.datagrid', [
             ).set({'title': gettext('Rename Panel')});
           });
 
-          var openQueryToolURL = function(j) {
+          var openQueryToolURL = function(j, panel_url) {
             // add spinner element
             let $spinner_el =
               $(`<div class="pg-sp-container">
@@ -315,9 +315,20 @@ define('pgadmin.datagrid', [
               if (frameInitialized) {
                 clearInterval(init_poller_id);
                 var frame = $(j).data('embeddedFrame');
+
                 if (frame) {
                   frame.onLoaded(()=>{
                     $spinner_el.remove();
+                    // Fix for firefox backspace click causes pgadmin Inception - RM4892
+                    // start of code
+                    var current_browser = pgAdmin.Browser.get_browser();
+                    if (current_browser.name === 'Firefox') {
+                      frame.$iFrame[0].contentWindow.history.pushState(null, null, panel_url);
+                      frame.$iFrame[0].contentWindow.onpopstate = function () {
+                        frame.$iFrame[0].contentWindow.history.go(1);
+                      };
+                    }
+                    // end of code
                   });
                   frame.openHTML(queryToolForm);
                 }
@@ -325,7 +336,7 @@ define('pgadmin.datagrid', [
             }, 100);
           };
 
-          openQueryToolURL(queryToolPanel);
+          openQueryToolURL(queryToolPanel, panel_url);
         }
         return true;
       },


view thread (5+ 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] RM4892 pgAdmin "Inception"
  In-Reply-To: <CAKtn9dMus8pTVv5p9o4PNQccZ04Pk0wAFRD=akpS5g5O2PDV7Q@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