1) Table Dialogue does not close on addition/deletion of partition. Fixes #6863

2) Nodes are loaded multiple times in server mode on 'Reset Layout'. Fixes #6861
pull/62/head
Khushboo Vashi 2021-10-05 17:33:50 +05:30 committed by Akshay Joshi
parent bfb65e82aa
commit a693014371
3 changed files with 26 additions and 11 deletions

View File

@ -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,
});
}

View File

@ -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',

View File

@ -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',