public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM #6844 - Partitions collection node loading issue.
Date: Mon, 4 Oct 2021 15:39:17 +0530
Message-ID: <CAFOhELcBvBhVDfRnSWgdN4F4osGYVoHCVnZbi9MN-KKyqaf6dw@mail.gmail.com> (raw)

Hi,

Please find the attached patch to fix the RM #6844 - [Table node]:
Partitions collection node loading issue.

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_6844.patch (1.3K, 3-RM_6844.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/tree/tree_nodes.ts b/web/pgadmin/static/js/tree/tree_nodes.ts
index f7b8d0142..b8d5350f3 100644
--- a/web/pgadmin/static/js/tree/tree_nodes.ts
+++ b/web/pgadmin/static/js/tree/tree_nodes.ts
@@ -155,15 +155,23 @@ export class ManageTreeNodes {
   public generate_url = (path: string) => {
     let _path = path;
     let _parent_path = [];
+    let _partitions = [];
     while(_path != '/') {
       let node = this.findNode(_path);
       let _parent = unix.dirname(_path);
       if(node.parentNode && node.parentNode.path == _parent) {
         if (node.parentNode.metadata.data !== null && !node.parentNode.metadata.data._type.includes('coll-'))
-          _parent_path.push(node.parentNode.metadata.data._id);
+          if(node.parentNode.metadata.data._type.includes('partition')) {
+            _partitions.push(node.parentNode.metadata.data._id);
+          } else {
+            _parent_path.push(node.parentNode.metadata.data._id);
+          }
      }
      _path = _parent;
     }
+    // Replace the table with the last partition as in reality partition node is not child of the table
+    if(_partitions.length > 0) _parent_path[0]  = _partitions[_partitions.length-1];
+
     let _rev_arr = _parent_path.reverse();
     return _rev_arr.join("/");
   }


view thread (2+ 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: [pgAdmin4][Patch] - RM #6844 - Partitions collection node loading issue.
  In-Reply-To: <CAFOhELcBvBhVDfRnSWgdN4F4osGYVoHCVnZbi9MN-KKyqaf6dw@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