public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM #6930 - Existing Server group disappear if user rename it
Date: Tue, 19 Oct 2021 10:53:24 +0530
Message-ID: <CAFOhELeKPKE12qGZ0CpKBM1+5wfrS86vkabjpZ1=ZHKFn=8S_Q@mail.gmail.com> (raw)
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;
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 #6930 - Existing Server group disappear if user rename it
In-Reply-To: <CAFOhELeKPKE12qGZ0CpKBM1+5wfrS86vkabjpZ1=ZHKFn=8S_Q@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