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:
Joao De Almeida Pereira
2018-06-05 16:42:59 +05:30
committed by Ashesh Vashi
parent 920934759f
commit 7dd6372eeb
75 changed files with 5186 additions and 1939 deletions
+14 -4
View File
@@ -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);
}