make the graph work with edges to nodes that are not reporting

Signed-off-by: Mikolaj Pawlikowski <mikolaj@pawlikowski.pl>
This commit is contained in:
Mikolaj Pawlikowski
2019-03-14 08:13:44 -04:00
parent 7c43626b1e
commit d8f8c20927
+22 -2
View File
@@ -229,6 +229,7 @@ var main = function(timeout){
// prepare nodes
var nodes = [];
var podIPs = [];
var resp = data.responses;
for (let podIP in resp) {
let value = resp[podIP];
@@ -239,8 +240,8 @@ var main = function(timeout){
"y": 0,
_data: value,
});
podIPs.push(podIP);
};
//console.log(nodes);
// prepare the edges
var edges = [];
@@ -257,7 +258,26 @@ var main = function(timeout){
};
}
};
//console.log(edges);
console.log(edges);
console.log(nodes);
// if running goldpinger with PING_NUMBER, then we need to add nodes for the edges
// that are not reporting but are reported to
edges.forEach(function(edge) {
[edge.source, edge.target].forEach(function(value) {
if (podIPs.indexOf(value) == -1){
nodes.push({
"label": value,
"id": value,
"x": 0,
"y": 0,
_data: {},
});
podIPs.push(value);
}
})
})
console.log(nodes);
// build the actual graph