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

Method createOrUpdateNode

web/pgadmin/static/js/tree/tree.js:435–455  ·  view source on GitHub ↗
(id, data, parent, domNode)

Source from the content-addressed store, hash-verified

433 }
434
435 createOrUpdateNode(id, data, parent, domNode) {
436 let oldNodePath = id;
437 if (parent?.path != '/browser') {
438 oldNodePath = parent.path + '/' + id;
439 }
440 const oldNode = this.findNode(oldNodePath);
441 if (oldNode !== null) {
442 oldNode.data = data;
443 oldNode.domNode = domNode;
444 return oldNode;
445 }
446
447 const node = new TreeNode(id, data, domNode, parent);
448 if (parent === this.rootNode) {
449 node.parentNode = null;
450 }
451
452 if (parent !== null && parent !== undefined)
453 parent.children.push(node);
454 return node;
455 }
456
457 async updateAndReselectNode(item, data) {
458 await this.update(item, data);

Callers 1

addNewNodeMethod · 0.95

Calls 1

findNodeMethod · 0.95

Tested by

no test coverage detected