public inbox for [email protected]  
help / color / mirror / Atom feed
From: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - Fixes for RM #6839 & RM #6852
Date: Sat, 2 Oct 2021 13:32:45 +0530
Message-ID: <CAFOhELdzpvqRiouoYHS-6R6vZ9mEXOJE3-haay+F3MrHrFh75w@mail.gmail.com> (raw)

Hi,

Please find the attached patch to fix the below RMs:

RM #6839 - Newly added server/server group is not visible in tree unless
pgAdmin refreshed
RM #6852 - Internal server error displayed if disconnect the server

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_6839_6852.patch (4.1K, 3-RM_6839_6852.patch)
  download | inline diff:
diff --git a/web/package.json b/web/package.json
index 2bc5b5981..046126c66 100644
--- a/web/package.json
+++ b/web/package.json
@@ -136,7 +136,7 @@
     "path-fx": "^2.0.0",
     "pathfinding": "^0.4.18",
     "paths-js": "^0.4.9",
-    "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#51d4024780793cdb8c7cea8ec6ec3bb4cf438331",
+    "pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#ec58f480f43aa6deb862778d49d6f2fb797a7d13",
     "postcss": "^8.2.15",
     "raf": "^3.4.1",
     "react": "^17.0.1",
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index 58794082e..09b10ed82 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -469,6 +469,7 @@ define('pgadmin.browser', [
             $div = $('<div></div>'),
             context_menu = {};
 
+          if(item) obj.tree.select(item);
           pgAdmin.Browser.MenuCreator(
             obj.Nodes, $div, menus, obj.menu_categories, d, item, context_menu
           );
@@ -1095,7 +1096,6 @@ define('pgadmin.browser', [
               } else {
                 var _append = function() {
                   var ___ctx = this,
-                    is_parent_loaded_before = ___ctx.t.wasLoad(___ctx.i),
                     _parent_data = ___ctx.t.itemData(___ctx.i);
 
                   ___ctx.t.append(___ctx.i, _data).then(
@@ -1103,7 +1103,7 @@ define('pgadmin.browser', [
                       // Open the item path only if its parent is loaded
                       // or parent type is same as nodes
                       if(
-                        is_parent_loaded_before &&
+                        ___ctx.t.wasLoad(___ctx.i) &&
                           _parent_data &&  _parent_data._type.search(
                           _data._type
                         ) > -1
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index c90459d61..41835b3bf 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -140,12 +140,12 @@ export class Tree {
     await this.tree.toggleDirectory(item);
   }
 
-  async select(item) {
-    await this.tree.setActiveFile(item);
+  async select(item, ensureVisible=false) {
+    await this.tree.setActiveFile(item, ensureVisible);
   }
 
-  async selectNode(item) {
-    this.tree.setActiveFile(item);
+  async selectNode(item, ensureVisible=false) {
+    this.tree.setActiveFile(item, ensureVisible);
   }
 
   async unload(item) {
@@ -194,7 +194,7 @@ export class Tree {
 
   wasLoad(item) {
     if (item && item.type === FileType.Directory) {
-      return item.isExpanded;
+      return item.isExpanded && item.children != null && item.children.length > 0;
     }
     return true;
   }
@@ -270,7 +270,7 @@ export class Tree {
   }
 
   itemData(item) {
-    return (item !== undefined && item.getMetadata('data') !== undefined) ? item._metadata.data : [];
+    return (item !== undefined && item !== null  && item.getMetadata('data') !== undefined) ? item._metadata.data : [];
   }
 
   getData(item) {
diff --git a/web/pgadmin/static/js/tree/tree_init.tsx b/web/pgadmin/static/js/tree/tree_init.tsx
index 4d67ecf21..0587f1dc8 100644
--- a/web/pgadmin/static/js/tree/tree_init.tsx
+++ b/web/pgadmin/static/js/tree/tree_init.tsx
@@ -76,7 +76,7 @@ var initBrowserTree = async (pgBrowser) => {
   // Render Browser Tree
   await render(
     <div>
-      <FileTreeX height={999} width={'100%'} model={treeModelX}
+      <FileTreeX height={950} width={'100%'} model={treeModelX}
         onReady={itemHandle} create={create} remove={remove} update={update}/>
      </div>, document.getElementById('tree'));
 }
diff --git a/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss b/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss
index af090bc34..99a68dec1 100644
--- a/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss
+++ b/web/pgadmin/static/scss/_pgadmin4-tree.overrides.scss
@@ -54,7 +54,7 @@
         font-size: 18px;
         text-align: center;
         height: 21px !important;
-        width: 20px;
+        width: 20px !important;
         &:before {
             height: inherit;
             width: inherit;


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] - Fixes for RM #6839 & RM #6852
  In-Reply-To: <CAFOhELdzpvqRiouoYHS-6R6vZ9mEXOJE3-haay+F3MrHrFh75w@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