Commit 38c6eb04 by Vishal Kadam

Fixed node not found error

parent 92c47239
...@@ -107,7 +107,7 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -107,7 +107,7 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
var nodes = {}; var nodes = {};
function getNode(nodeId) { function getNode(nodeId) {
if (!nodes[nodeId]) { if (!nodes[nodeId] && data.vertices[nodeId]) {
nodes[nodeId] = angular.copy(data.vertices[nodeId]); nodes[nodeId] = angular.copy(data.vertices[nodeId]);
} }
return nodes[nodeId]; return nodes[nodeId];
...@@ -120,11 +120,20 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco ...@@ -120,11 +120,20 @@ angular.module('dgc.lineage').controller('LineageController', ['$element', '$sco
* */ * */
var parentId = node.tail, var parentId = node.tail,
parentNode = getNode(parentId); parentNode = getNode(parentId);
if (!parentNode.children) { if (!parentNode) {
parentNode.children = []; console.log('Parent Node not found id', parentId);
} else {
var childId = node.head,
childNode = getNode(childId);
if (childNode) {
if (!parentNode.children) {
parentNode.children = [];
}
parentNode.children.push(childNode);
} else {
console.log('Child Node not found id', childId);
}
} }
var childId = node.head;
parentNode.children.push(getNode(childId));
}); });
var id = 0, var id = 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment