|
|
@@ -445,20 +445,28 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ this.start_scheduled_refresh = function (after_ms) {
|
|
|
+ this.cancel_scheduled_refresh();
|
|
|
+ self.refresh_timer = timer.register($timeout(function () {
|
|
|
+ self.start_scheduled_refresh(after_ms);
|
|
|
+ self.refresh();
|
|
|
+ }, after_ms));
|
|
|
+ };
|
|
|
+
|
|
|
+ this.cancel_scheduled_refresh = function () {
|
|
|
+ timer.cancel(self.refresh_timer);
|
|
|
+ };
|
|
|
+
|
|
|
this.set_interval = function (interval) {
|
|
|
self.current.refresh = interval;
|
|
|
- if(interval) {
|
|
|
+ if (interval) {
|
|
|
var _i = kbn.interval_to_ms(interval);
|
|
|
- timer.cancel(self.refresh_timer);
|
|
|
- self.refresh_timer = timer.register($timeout(function() {
|
|
|
- self.set_interval(interval);
|
|
|
- self.refresh();
|
|
|
- },_i));
|
|
|
- self.refresh();
|
|
|
+ this.start_scheduled_refresh(_i);
|
|
|
} else {
|
|
|
- timer.cancel(self.refresh_timer);
|
|
|
+ this.cancel_scheduled_refresh();
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
});
|
|
|
|
|
|
});
|