Hello,

PFA patch to fix the issue where SQL panel content is not updating properly
when user traverse from child to parent node in browser tree as described
in the ticket.

I have also fixed the similar issue for Dependencies & Dependents panel.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/static/js/browser.js 
b/web/pgadmin/browser/static/js/browser.js
index 3dac0cb..061bd4e 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -400,6 +400,7 @@ define('pgadmin.browser', [
         });
 
       setTimeout(function() {
+        obj.editor.setValue('-- ' + select_object_msg);
         obj.editor.refresh();
       }, 10);
 
diff --git a/web/pgadmin/misc/depends/static/js/depends.js 
b/web/pgadmin/misc/depends/static/js/depends.js
index 45b1897..9078e56 100644
--- a/web/pgadmin/misc/depends/static/js/depends.js
+++ b/web/pgadmin/misc/depends/static/js/depends.js
@@ -194,15 +194,19 @@ define('misc.depends', [
         $msgContainer = $container.find('.pg-panel-depends-message'),
         $gridContainer = $container.find('.pg-panel-depends-container'),
         treeHierarchy = node.getTreeNodeHierarchy(item),
-        n_type = type;
+        n_type = type,
+        cache_flag = {
+          node_type: n_type,
+          url: url,
+        };
 
       // Avoid unnecessary reloads
-      if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
+      if (_.isEqual($(panel[0]).data('node-prop'), cache_flag)) {
         return;
       }
 
       // Cache the current IDs for next time
-      $(panel[0]).data('node-prop', treeHierarchy);
+      $(panel[0]).data('node-prop', cache_flag);
 
       // Hide the grid container and show the default message container
       if (!$gridContainer.hasClass('hidden'))
@@ -381,4 +385,4 @@ define('misc.depends', [
   });
 
   return pgBrowser.ShowNodeDepends;
-});
\ No newline at end of file
+});
diff --git a/web/pgadmin/misc/sql/static/js/sql.js 
b/web/pgadmin/misc/sql/static/js/sql.js
index 1a6200d..9ffa7b1 100644
--- a/web/pgadmin/misc/sql/static/js/sql.js
+++ b/web/pgadmin/misc/sql/static/js/sql.js
@@ -69,24 +69,28 @@ define('misc.sql', [
       var that = this;
       this.timeout = setTimeout(
         function() {
-          var sql = '';
+          var sql = '-- ' + gettext('Please select an object in the tree 
view.');
           if (node) {
             sql = '-- ' + gettext('No SQL could be generated for the selected 
object.');
             var n_type = data._type,
-              treeHierarchy = node.getTreeNodeHierarchy(item);
+              url = node.generate_url(item, 'sql', data, true),
+              treeHierarchy = node.getTreeNodeHierarchy(item),
+              cache_flag = {
+                node_type: n_type,
+                url: url,
+              };
 
             // Avoid unnecessary reloads
-            if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), 
treeHierarchy)) {
+            if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), cache_flag)) 
{
               return;
             }
             // Cache the current IDs for next time
-            $(that.sqlPanels[0]).data('node-prop', treeHierarchy);
+            $(that.sqlPanels[0]).data('node-prop', cache_flag);
 
             if (node.hasSQL) {
 
               sql = '';
-              var url = node.generate_url(item, 'sql', data, true),
-                timer;
+              var timer;
 
               $.ajax({
                 url: url,
@@ -153,4 +157,4 @@ define('misc.sql', [
   });
 
   return pgBrowser.ShowNodeSQL;
-});
\ No newline at end of file
+});

Reply via email to