mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-04 18:33:22 -05:00
Extract the tests and refactor some of the methods.
Extract some of the ACI Tree functionalities, and decouple it from the main source. Also - create some abstractions from the repeated code around the enable/disable the schema children object create/edit/delete functionalities, and also created the dialog wrappers for backup and restore dialogs. Reviewed by: Khushboo and Ashesh Refactored by: Ashesh
This commit is contained in:
committed by
Ashesh Vashi
parent
920934759f
commit
7dd6372eeb
@@ -59,17 +59,20 @@ export class TreeNode {
|
||||
tree.aciTreeApi.unload(this.domNode);
|
||||
}
|
||||
|
||||
anyParent(condition) {
|
||||
/*
|
||||
* Find the ancestor with matches this condition
|
||||
*/
|
||||
ancestorNode(condition) {
|
||||
let node = this;
|
||||
|
||||
while (node.hasParent()) {
|
||||
node = node.parent();
|
||||
if (condition(node)) {
|
||||
return true;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +84,10 @@ export class TreeNode {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.anyParent(condition);
|
||||
return this.ancestorNode(condition) !== null;
|
||||
}
|
||||
anyParent(condition) {
|
||||
return this.ancestorNode(condition) !== null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,3 +216,7 @@ function findInTree(rootNode, path) {
|
||||
}
|
||||
})(rootNode);
|
||||
}
|
||||
|
||||
export function isValidTreeNodeData(treeNodeData) {
|
||||
return !_.isUndefined(treeNodeData) && !_.isNull(treeNodeData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user