public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch] - RM #6930 - Existing Server group disappear if user rename it
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch] - RM #6930 - Existing Server group disappear if user rename it
@ 2021-10-19 05:23  Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

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

Hi,

Please find the attached patch to fix the RM #6930 - Existing Server group
disappear if user rename it

Thanks,
Khushboo


Attachments:

  [application/octet-stream] RM_6930.patch (1.7K, 3-RM_6930.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index f88fb6584..e1e025f9b 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -1267,7 +1267,8 @@ define('pgadmin.browser', [
             var _parent = this.t.parent(this.i) || null;
 
             // If there is no parent then just update the node
-            if(_parent && _parent.length == 0 && ctx.op == 'UPDATE') {
+            if(this.t.isRootNode(_parent) ||
+             (_parent && _parent.length == 0 && ctx.op == 'UPDATE')) {
               updateNode();
             } else {
               var postRemove = function() {
diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js
index 05582cee9..3ca4ee533 100644
--- a/web/pgadmin/static/js/tree/tree.js
+++ b/web/pgadmin/static/js/tree/tree.js
@@ -205,11 +205,11 @@ export class Tree {
 
   first(item) {
     const model = this.tree.getModel();
-    if (item === undefined || item === null) {
+    if ((item === undefined || item === null) && model.root.children !== null) {
       return model.root.children[0];
     }
 
-    if (item.branchSize > 0) {
+    if (item !== undefined && item !== null && item.branchSize > 0) {
       return item.children[0];
     }
 
@@ -285,6 +285,11 @@ export class Tree {
     return (item !== undefined && item.getMetadata('data') !== undefined) ? item._metadata.data : [];
   }
 
+  isRootNode(item) {
+    const model = this.tree.getModel();
+    return item === model.root;
+  }
+
   isInode(item) {
     const children = this.children(item);
     if (children === null || children === undefined) return false;


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

* Re: [pgAdmin4][Patch] - RM #6930 - Existing Server group disappear if user rename it
@ 2021-10-19 06:32  Akshay Joshi <[email protected]>
  parent: Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

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

Thanks, the patch applied.

On Tue, Oct 19, 2021 at 10:53 AM Khushboo Vashi <
[email protected]> wrote:

> Hi,
>
> Please find the attached patch to fix the RM #6930 - Existing Server
> group disappear if user rename it
>
> 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-19 06:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 05:23 [pgAdmin4][Patch] - RM #6930 - Existing Server group disappear if user rename it Khushboo Vashi <[email protected]>
2021-10-19 06:32 ` 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