stormpython/tagcloud

IP address aggregations return a long

black2d opened this issue · 1 comments

IP address aggregations return a long instead of the IP address. I found a way to fix this by updating the rendering /public/vis/components/elements/text.js

replacing

var textAccessor = function (d) { return d.text; };

with

var textAccessor = function textAccessor(d) {
if (!isNaN(d.text)) {
var part1 = d.text & 255;
var part2 = ((d.text >> 8) & 255);
var part3 = ((d.text >> 16) & 255);
var part4 = ((d.text >> 24) & 255);

      var ip = part4 + "." + part3 + "." + part2 + "." + part1;
      if (ip.startsWith("0.")) {
          return d.text;
      }
      else {
          return ip;

      }
  }
  return d.text;

};

However it may not be the best place to do it (and I am not too familiar with github).

Thoughts?

Thanks!

@black2d thanks, but I agree that this isn't the best place to put this.

Ideally, this logic would be incorporated in the controller where the data is transformed and sent to the viz component. I will take a look at the issue.

Would you mind including a screenshot of the issue?