Skip to content

Commit

Permalink
fix(ui): add a visited map to prevent duplicate node from showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
IndeedSi authored and fhussonnois committed Oct 21, 2020
1 parent 4f67fc6 commit 4bce06e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions azkarra-ui/src/components/TopologyDAG.vue
Expand Up @@ -147,20 +147,21 @@ export default {
return new Topology(topologiesLayouts);
},
buildTopologyNodes(grouped, nodes, layouts = [], level = 0) {
buildTopologyNodes(grouped, nodes, layouts = [], level = 0, visited = new Map()) {
if (nodes.length == 0) return layouts;
layouts.push(nodes);
let layout = [];
nodes.forEach ( (node, i) => {
node.id = i; node.level = level;
node.successors.forEach(s => {
let successor = grouped.get(s);
if (successor.isDrawable()) {
if (successor.isDrawable() && !visited.get(s)) {
layout.push(successor);
visited.set(s, true);
}
});
});
return this.buildTopologyNodes(grouped, layout, layouts, level + 1);
return this.buildTopologyNodes(grouped, layout, layouts, level + 1, visited);
},
createSVG(objectTopology) {
Expand Down

0 comments on commit 4bce06e

Please sign in to comment.