mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
'anyFamilyMember' runs the condition function for all nodes in the
hierarchy. No need to run the 'dashboardURL' function in the 'getDashboardURL' function for the current node too.
This commit is contained in:
parent
be3f9570e3
commit
e2ce73d855
@ -6,24 +6,22 @@ export function url(itemData, item, treeHierarchy) {
|
||||
let treeNode = pgBrowser.treeMenu.findNodeByDomElement(item);
|
||||
let url = null;
|
||||
|
||||
let getDashboardURL = (node) => {
|
||||
let nodeData = node.getData();
|
||||
let browserNode = pgBrowser.Nodes[nodeData._type];
|
||||
let dashboardURL = browserNode && browserNode.dashboard;
|
||||
|
||||
if (isFunction(dashboardURL)) {
|
||||
dashboardURL = dashboardURL.apply(
|
||||
browserNode, [node, nodeData, treeHierarchy]
|
||||
);
|
||||
}
|
||||
url = isString(dashboardURL) ? dashboardURL : null;
|
||||
|
||||
return (url !== null);
|
||||
};
|
||||
|
||||
if (treeNode) {
|
||||
if (getDashboardURL(treeNode) === false)
|
||||
treeNode.anyFamilyMember(getDashboardURL);
|
||||
treeNode.anyFamilyMember(
|
||||
(node) => {
|
||||
let nodeData = node.getData();
|
||||
let browserNode = pgBrowser.Nodes[nodeData._type];
|
||||
let dashboardURL = browserNode && browserNode.dashboard;
|
||||
|
||||
if (isFunction(dashboardURL)) {
|
||||
dashboardURL = dashboardURL.apply(
|
||||
browserNode, [node, nodeData, treeHierarchy]
|
||||
);
|
||||
}
|
||||
url = isString(dashboardURL) ? dashboardURL : null;
|
||||
|
||||
return (url !== null);
|
||||
});
|
||||
}
|
||||
|
||||
return url;
|
||||
|
Loading…
Reference in New Issue
Block a user