public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - Fixes for #6863 & #6861
Date: Tue, 5 Oct 2021 17:29:28 +0530
Message-ID: <CAFOhELcXXiro6vUZZoqg7jP8h7i-aLvwJdbKq5scdmFtHv91mw@mail.gmail.com> (raw)
Hi,
Please find the attached patch to fix the below RMs:
RM # 6863 - Table Dialogue does not close on addition/deletion pf partition.
RM # 6861 - Nodes are loaded multiple times in server mode on 'Rest Layout'.
Thanks,
Khushboo
Attachments:
[application/octet-stream] RM_6861_6863.patch (4.6K, 3-RM_6861_6863.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
index 963400145..60621c21f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js
@@ -362,7 +362,6 @@ define('pgadmin.node.table', [
'affected_partitions' in _newNodeData
) {
var partitions = _newNodeData.affected_partitions,
- self = this,
newPartitionsIDs = [],
insertChildTreeNodes = [],
insertChildrenNodes = function() {
@@ -409,7 +408,7 @@ define('pgadmin.node.table', [
'parent': tablesCollNode,
'type': 'table',
'treeHierarchy':
- pgAdmin.Browser.Nodes.schema.getTreeNodeHierarchy(
+ pgAdmin.Browser.tree.getTreeNodeHierarchy(
schemaNode
),
'childrenIDs': _.clone(childIDs),
@@ -460,7 +459,7 @@ define('pgadmin.node.table', [
insertChildTreeNodes.push({
'parent': partitionsCollNode,
'type': 'partition',
- 'treeHierarchy': self.getTreeNodeHierarchy(_node),
+ 'treeHierarchy': pgAdmin.Browser.tree.getTreeNodeHierarchy(_node),
'childrenIDs': newPartitionsIDs,
});
}
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index 09b10ed82..dfbbfe67d 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -1890,7 +1890,7 @@ define('pgadmin.browser', [
_parentNode = null;
for (; idx < size; idx++) {
- childNode = children.eq(idx);
+ childNode = children[idx];
childNodeData = tree_local.itemData(childNode);
if (childNodeData._type == _collType) {
@@ -1906,7 +1906,7 @@ define('pgadmin.browser', [
size = children.length;
for (; idx < size; idx++) {
- childNode = children.eq(idx);
+ childNode = children[idx];
childNodeData = tree_local.itemData(childNode);
if (_childIds.indexOf(childNodeData._id) != -1) {
@@ -1953,7 +1953,7 @@ define('pgadmin.browser', [
idx = 0, nodeData, node;
for(; idx < siblings.length; idx++) {
- node = siblings.eq(idx);
+ node = siblings[idx];
nodeData = tree_local.itemData(node);
if (nodeData && nodeData._id == _id)
@@ -1987,7 +1987,7 @@ define('pgadmin.browser', [
return null;
for(; idx < children.length; idx++) {
- node = children.eq(idx);
+ node = children[idx];
nodeData = tree_local.itemData(node);
if (nodeData && nodeData._type == _collType)
@@ -2021,6 +2021,8 @@ define('pgadmin.browser', [
null, 'nodes', childDummyInfo, true, childTreeInfo
);
+ var _node = _node || arguments[1];
+
$.ajax({
url: childNodeUrl,
dataType: 'json',
diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js
index f886802bd..16dc4f97e 100644
--- a/web/pgadmin/browser/static/js/node.js
+++ b/web/pgadmin/browser/static/js/node.js
@@ -1046,14 +1046,28 @@ define('pgadmin.browser.node', [
let tree = pgBrowser.tree,
auto_expand = pgBrowser.get_preference('browser', 'auto_expand_sole_children');
- pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state',
- item);
-
if (auto_expand && auto_expand.value == true && tree.children(item).length == 1) {
// Automatically expand the child node, if a treeview node has only a single child.
- tree.open(tree.first(item));
+ const first_child = tree.first(item);
+
+ if (first_child._loaded == true) {
+ tree.open(first_child);
+ } else {
+ const openSoleItem = setInterval(() => {
+ if (first_child._loaded) {
+ tree.open(first_child);
+ clearSoleItemInterval();
+ }
+ }, 200);
+ const clearSoleItemInterval = function() {
+ clearInterval(openSoleItem);
+ };
+ }
+
}
+ pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state', item);
+
},
closed: function(item) {
pgBrowser.Events.trigger('pgadmin:browser:tree:remove-from-tree-state',
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 #6863 & #6861
In-Reply-To: <CAFOhELcXXiro6vUZZoqg7jP8h7i-aLvwJdbKq5scdmFtHv91mw@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