diff --git a/web/pgadmin/browser/static/js/menu.js b/web/pgadmin/browser/static/js/menu.js index e76c9ed2..3bcba022 100644 --- a/web/pgadmin/browser/static/js/menu.js +++ b/web/pgadmin/browser/static/js/menu.js @@ -78,7 +78,12 @@ define([ data: this.data, }).addClass('dropdown-item'); - this.is_disabled = this.disabled(node, item); + if(this.context !== undefined) { + this.is_disabled = this.context.disabled; + } else { + this.is_disabled = this.disabled(node, item); + } + if (this.icon) { url.append($('', { 'class': this.icon, diff --git a/web/pgadmin/static/js/tree/tree.js b/web/pgadmin/static/js/tree/tree.js index 2e616be7..c1cec082 100644 --- a/web/pgadmin/static/js/tree/tree.js +++ b/web/pgadmin/static/js/tree/tree.js @@ -300,6 +300,15 @@ function findInTree(rootNode, path) { } return (function findInNode(currentNode) { + + /* No point in checking the childrens if + * the path for currentNode itself is not matching + */ + if(currentNode.path !== undefined && path !== undefined + && !path.startsWith(currentNode.path)) { + return null; + } + for (let i = 0, length = currentNode.children.length; i < length; i++) { const calculatedNode = findInNode(currentNode.children[i]); if (calculatedNode !== null) {