MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / getTreeNodeHierarchy

Method getTreeNodeHierarchy

web/pgadmin/static/js/tree/tree.js:477–506  ·  view source on GitHub ↗
(identifier)

Source from the content-addressed store, hash-verified

475 }
476
477 getTreeNodeHierarchy(identifier) {
478 let idx = 0;
479 let node_cnt = 0;
480 let result = {};
481 if (!identifier) return;
482 let item;
483 try {
484 item = TreeNode.prototype.isPrototypeOf(identifier) ? identifier : this.findNode(identifier.path);
485 } catch {
486 // It is possible that the requested path is not present in the tree anymore
487 item = null;
488 }
489 if (!item) return;
490 do {
491 const currentNodeData = item.getData();
492 if (currentNodeData._type in this.Nodes && this.Nodes[currentNodeData._type].hasId) {
493 const nodeType = mapType(currentNodeData._type, node_cnt);
494 if (result[nodeType] === undefined) {
495 result[nodeType] = _.extend({}, currentNodeData, {
496 'priority': idx,
497 });
498 idx -= 1;
499 }
500 }
501 node_cnt += 1;
502 item = item.hasParent() ? item.parent() : null;
503 } while (item);
504
505 return result;
506 }
507
508 /*
509 *

Callers 15

handleDraggableMethod · 0.95
tablespace.jsFile · 0.45
resource_group.jsFile · 0.45
directory.jsFile · 0.45
showRoleReassignFunction · 0.45
role.jsFile · 0.45
canDeleteWithForceFunction · 0.45
database.jsFile · 0.45
package.jsFile · 0.45
schema.jsFile · 0.45

Calls 6

findNodeMethod · 0.95
extendMethod · 0.80
mapTypeFunction · 0.70
hasParentMethod · 0.65
parentMethod · 0.65
getDataMethod · 0.45

Tested by

no test coverage detected