Sha256: b50cd1b5d3e6107f033f30fbe71c23873da32f2bb70d6d3528344ac6fee7cdff

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

:javascript
  (function(){
    function graph_href(type, metric){
      if (type == 'timers')
        metric += ':mean';

      return '/graph#'+ type +'='+ metric;
    }

    var types = {};
    var content = d3.select('#content');

    d3.json('/available', function(stats){
      if (!stats.length || stats.error)
        return content.append('strong').text(stats.error || 'No Statistics Available');

      for (var i = 0, stat; stat = stats[i]; i++){
        var split = stat.split(':', 2);
        var type = split[0];

        (types[type] || (types[type] = [])).push(split[1]);
      }

      for (var type in types){
        var container = content.append('div');

        container.attr('class', 'list-container');
        container.append('h3').text(type);

        var metrics = types[type].sort();
        var list = container.append('ul');

        for (var i = 0, m; m = metrics[i]; i++)
          list.append('li').append('a').text(m).attr('href', graph_href(type, m));
      }
    });
  }());

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
batsd-dash-0.5.0 lib/batsd-dash/views/root.haml