gemhome / fnordmetric

(possible new home for) FnordMetric is a redis/ruby-based realtime Event-Tracking app
0 stars 1 forks source link

Autoupdate for barwidget #36

Open bf4 opened 10 years ago

bf4 commented 10 years ago

Issue by tnbredillet Thursday Jan 10, 2013 at 10:51 GMT Originally opened as https://github.com/paulasmuth/fnordmetric/issues/110


Hey !

fnordmetric is pretty amazing ;-)

I'm running into an issue though, if I'm not mistaken the autoupdates are triggered by the javascript that sends a message to the Reactor class. My issue is that my bar widget is not updating automatically even though the autoupdate parameter is set to 5.

I've looked into the js and I don't see any autoupdate function for the barwidget and I think that's the issue.

Cheers, Thomas

bf4 commented 10 years ago

Comment by tnbredillet Thursday Jan 17, 2013 at 14:53 GMT


I added the following to the render function in the barwidget js and autoupdate works fine now :

if(opts.autoupdate){
      var secs = parseInt(opts.autoupdate);
      if(secs > 0){
        var autoupdate_interval = window.setInterval(function(){
          requestValuesAsync();
        }, secs*1000);
        $('body').bind('fm_dashboard_close', function(){
          window.clearInterval(autoupdate_interval);
        });
      }
    }