Commit 67a52c3e authored by Paul Asmuth's avatar Paul Asmuth
Browse files

fixed legacy toplist widget

parent e4b02d30
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -9,15 +9,13 @@ TODO
- report: print number of samples, interval-size on topright via scalaexp-buttonstyle
- caching

- pie widget :)
- fix toplist widget
- timeseries-widget: cardinal on/off should be skeuomorph

- namespace picker in sidebar
- fix session view
- split up fnordmetric.namespace block into multiple files
- proper cmdline output (status?)

- pie widget (+ fix for old first)
- distgauge: render std. deviation
- timeseries-gauge: overview series weights
- timeseries-gauge: punchcards
+6 −1
Original line number Diff line number Diff line
class FnordMetric::ToplistWidget < FnordMetric::Widget

  def self.execute(namespace, event)
    t = Time.now.to_i

    return false unless event["gauge"]

    resp = if event["cmd"] == "values_for"
      {
        :cmd => :values_for,
        :gauge => event["gauge"],
        :values => execute_values_for(namespace.gauges[event["gauge"].to_sym], Time.now.to_i)
        :values => execute_values_for(namespace.gauges[event["gauge"].to_sym], t),
        :count  => namespace.gauges[event["gauge"].to_sym].field_values_total(t)
      }
    end

+1 −23
Original line number Diff line number Diff line
FnordMetric.widgets.toplistWidget = function(){

  var opts;
  var current_gauge = false;

  function render(_opts){
    opts = _opts;

    var current_gauge = false;

    /* if (!opts.tick){ opts.tick = opts.ticks[0]; } */

    var headbar = $('<div class="headbar"></div>').append(
      $('<h2></h2>').html(opts.title)
    );
@@ -43,7 +40,6 @@ FnordMetric.widgets.toplistWidget = function(){
      loadGauge(opts.gauges[0], true);
    }

    /*
    if(opts.autoupdate){
      var secs = parseInt(opts.autoupdate);
      if(secs > 0){
@@ -58,21 +54,6 @@ FnordMetric.widgets.toplistWidget = function(){
      }
    };

  */

  }

  function requestValuesAsync(){
    FnordMetric.publish({
      "type": "widget_request",
      "klass": "ToplistWidget",
      "gauges": opts.gauges,
      "cmd": "values_for",
      "since": opts.start_timestamp,
      "until": opts.end_timestamp,
      "tick": opts.tick,
      "widget_key": opts.widget_key
    })
  }

  function loadGauge(gkey, silent){
@@ -84,9 +65,6 @@ FnordMetric.widgets.toplistWidget = function(){
    if(!silent)
        $('.toplist_inner', opts.elem).addClass('loading');

    var _url = FnordMetric.p + '/' + FnordMetric.currentNamespace + '/gauge/' + gkey;
    if(opts.tick){ _url += ("?tick=" + opts.tick); }

    FnordMetric.publish({
      "type": "widget_request",
      "klass": "ToplistWidget",