public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - Fixes for #6863 & #6861
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch] - Fixes for #6863 & #6861
@ 2021-10-05 11:59 Khushboo Vashi <[email protected]>
  2021-10-05 12:05 ` Re: [pgAdmin4][Patch] - Fixes for #6863 & #6861 Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Khushboo Vashi @ 2021-10-05 11:59 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

Please find the attached patch to fix the below RMs:

RM # 6863 - Table Dialogue does not close on addition/deletion pf partition.
RM # 6861 - Nodes are loaded multiple times in server mode on 'Rest Layout'.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_6861_6863.patch (4.6K, 3-RM_6861_6863.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
index 963400145..60621c21f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
@@ -362,7 +362,6 @@ define('pgadmin.node.table', [
             'affected_partitions' in _newNodeData
         ) {
           var partitions = _newNodeData.affected_partitions,
-            self = this,
             newPartitionsIDs = [],
             insertChildTreeNodes = [],
             insertChildrenNodes = function() {
@@ -409,7 +408,7 @@ define('pgadmin.node.table', [
                     'parent': tablesCollNode,
                     'type': 'table',
                     'treeHierarchy':
-                      pgAdmin.Browser.Nodes.schema.getTreeNodeHierarchy(
+                      pgAdmin.Browser.tree.getTreeNodeHierarchy(
                         schemaNode
                       ),
                     'childrenIDs': _.clone(childIDs),
@@ -460,7 +459,7 @@ define('pgadmin.node.table', [
               insertChildTreeNodes.push({
                 'parent': partitionsCollNode,
                 'type': 'partition',
-                'treeHierarchy': self.getTreeNodeHierarchy(_node),
+                'treeHierarchy': pgAdmin.Browser.tree.getTreeNodeHierarchy(_node),
                 'childrenIDs': newPartitionsIDs,
               });
             }
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index 09b10ed82..dfbbfe67d 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -1890,7 +1890,7 @@ define('pgadmin.browser', [
         _parentNode = null;
 
         for (; idx < size; idx++) {
-          childNode = children.eq(idx);
+          childNode = children[idx];
           childNodeData = tree_local.itemData(childNode);
 
           if (childNodeData._type == _collType) {
@@ -1906,7 +1906,7 @@ define('pgadmin.browser', [
         size = children.length;
 
         for (; idx < size; idx++) {
-          childNode = children.eq(idx);
+          childNode = children[idx];
           childNodeData = tree_local.itemData(childNode);
 
           if (_childIds.indexOf(childNodeData._id) != -1) {
@@ -1953,7 +1953,7 @@ define('pgadmin.browser', [
         idx = 0, nodeData, node;
 
       for(; idx < siblings.length; idx++) {
-        node = siblings.eq(idx);
+        node = siblings[idx];
         nodeData = tree_local.itemData(node);
 
         if (nodeData && nodeData._id == _id)
@@ -1987,7 +1987,7 @@ define('pgadmin.browser', [
         return null;
 
       for(; idx < children.length; idx++) {
-        node = children.eq(idx);
+        node = children[idx];
         nodeData = tree_local.itemData(node);
 
         if (nodeData && nodeData._type == _collType)
@@ -2021,6 +2021,8 @@ define('pgadmin.browser', [
             null, 'nodes', childDummyInfo, true, childTreeInfo
           );
 
+          var _node = _node || arguments[1];
+
           $.ajax({
             url: childNodeUrl,
             dataType: 'json',
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index f886802bd..16dc4f97e 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -1046,14 +1046,28 @@ define('pgadmin.browser.node', [
         let tree = pgBrowser.tree,
           auto_expand = pgBrowser.get_preference('browser', 'auto_expand_sole_children');
 
-        pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state',
-          item);
-
         if (auto_expand && auto_expand.value == true && tree.children(item).length == 1) {
           // Automatically expand the child node, if a treeview node has only a single child.
-          tree.open(tree.first(item));
+          const first_child = tree.first(item);
+
+          if (first_child._loaded == true) {
+            tree.open(first_child);
+          } else {
+            const openSoleItem = setInterval(() => {
+              if (first_child._loaded) {
+                tree.open(first_child);
+                clearSoleItemInterval();
+              }
+            }, 200);
+            const clearSoleItemInterval = function() {
+              clearInterval(openSoleItem);
+            };
+          }
+
         }
 
+        pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state', item);
+
       },
       closed: function(item) {
         pgBrowser.Events.trigger('pgadmin:browser:tree:remove-from-tree-state',


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin4][Patch] - Fixes for #6863 & #6861
  2021-10-05 11:59 [pgAdmin4][Patch] - Fixes for #6863 & #6861 Khushboo Vashi <[email protected]>
@ 2021-10-05 12:05 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2021-10-05 12:05 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers

Thanks, the patch applied.

On Tue, Oct 5, 2021 at 5:29 PM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch to fix the below RMs:
>
> RM # 6863 - Table Dialogue does not close on addition/deletion pf
> partition.
> RM # 6861 - Nodes are loaded multiple times in server mode on 'Rest
> Layout'.
>
> Thanks,
> Khushboo
>
>

-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-10-05 12:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 11:59 [pgAdmin4][Patch] - Fixes for #6863 & #6861 Khushboo Vashi <[email protected]>
2021-10-05 12:05 ` Akshay Joshi <[email protected]>

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