Fix the stopping of the traffic flow visualization.
@@ -209,6 +209,7 @@ class Dots extends TrafficAnimation {
this.excludedAddresses = localStorage[CHORDFILTERKEY] ? JSON.parse(localStorage[CHORDFILTERKEY]) : [];
this.radius = radius; // the radius of a router circle
this.lastFlows = {}; // the number of dots animated between routers
+ this.stopped = true;
this.chordData = new ChordData(this.traffic.QDRService, true, converter); // gets ingressHistogram data
this.chordData.setFilter(this.excludedAddresses);
traffic.$scope.addresses = {};
@@ -253,10 +254,9 @@ class Dots extends TrafficAnimation {
};
}
remove() {
- for (let id in this.lastFlows) {
- d3.select('#SVG_ID').selectAll('circle.flow' + id).remove();
- }
+ d3.select('#SVG_ID').selectAll('circle.flow').remove();
this.lastFlows = {};
+ this.stopped = true;
}
updateAddresses() {
this.excludedAddresses = [];
@@ -287,6 +287,7 @@ class Dots extends TrafficAnimation {
}
doUpdate() {
let self = this;
+ this.stopped = false;
// we need the nextHop data to show traffic between routers that are connected by intermediaries
this.traffic.QDRService.management.topology.ensureAllEntities([{ entity: 'router.node', attrs: ['id', 'nextHop'] }], function () {
// get the ingressHistogram data for all routers
@@ -296,6 +297,7 @@ class Dots extends TrafficAnimation {
});
}
render(matrix) {
+ if (this.stopped === false) {
this.traffic.$timeout(function () {
this.traffic.$scope.addresses = this.chordData.getAddresses();
}.bind(this));
@@ -357,6 +359,7 @@ class Dots extends TrafficAnimation {
}
}
}
+ }
// animate the d3 selection (flow) along the given path
animateFlow(flow, path, count, back, rate) {
let self = this;
@@ -365,7 +368,9 @@ class Dots extends TrafficAnimation {
.ease('easeLinear')
.duration(l * 10 / rate)
.attrTween('transform', self.translateDots(self.radius, path, count, back))
- .each('end', function () { self.animateFlow(flow, path, count, back, rate); });
+ .each('end', function () { if (this.stopped === false) {
+ self.animateFlow(flow, path, count, back, rate);
+ }});
}
// create dots along the path between routers
startAnimation(path, id, hop, rate) {
