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

* [pgAdmin4][Patch] - Fixes for RM #6839 & RM #6852
@ 2021-10-02 08:02 Khushboo Vashi <[email protected]>
  2021-10-03 06:49 ` Re: [pgAdmin4][Patch] - Fixes for RM #6839 & RM #6852 Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Khushboo Vashi @ 2021-10-02 08:02 UTC (permalink / raw)
  To: pgadmin-hackers

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;


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

* Re: [pgAdmin4][Patch] - Fixes for RM #6839 & RM #6852
  2021-10-02 08:02 [pgAdmin4][Patch] - Fixes for RM #6839 & RM #6852 Khushboo Vashi <[email protected]>
@ 2021-10-03 06:49 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

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

Thanks, the patch applied.

On Sat, Oct 2, 2021 at 1:33 PM Khushboo Vashi <
[email protected]> wrote:

> 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
>
>

-- 
*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-03 06:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 08:02 [pgAdmin4][Patch] - Fixes for RM #6839 & RM #6852 Khushboo Vashi <[email protected]>
2021-10-03 06:49 ` 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