diff --git a/src/kibana/components/courier/courier.js b/src/kibana/components/courier/courier.js index f8c32f26e2ad..5a91918b1792 100644 --- a/src/kibana/components/courier/courier.js +++ b/src/kibana/components/courier/courier.js @@ -1,6 +1,7 @@ define(function (require) { var errors = require('errors'); - + var _ = require('lodash'); + require('services/es'); require('services/promises'); require('components/index_patterns/index_patterns'); @@ -114,6 +115,17 @@ define(function (require) { throw new Error('Aborting all pending requests failed.'); } }; + + // Listen for refreshInterval changes + var $parentScope = $rootScope; + $parentScope.$watch('timefilter.refreshInterval', function () { + var refreshValue = _.deepGet($parentScope, 'timefilter.refreshInterval.value'); + if (_.isNumber(refreshValue)) { + self.fetchInterval(refreshValue); + } else { + self.fetchInterval(0); + } + }); } return new Courier(); diff --git a/src/kibana/components/courier/looper/_looper.js b/src/kibana/components/courier/looper/_looper.js index ee5166509bb9..60a4d3151c49 100644 --- a/src/kibana/components/courier/looper/_looper.js +++ b/src/kibana/components/courier/looper/_looper.js @@ -19,7 +19,22 @@ define(function (require) { */ looper.ms = function (ms) { _ms = ms; - looper.restart(); + if (_ms) { + looper.restart(); + } else { + looper.pause(); + } + return this; + }; + + /** + * Cancels the current looper while keeping internal + * state as started + * + * @chainable + */ + looper.pause = function () { + if (_timerId) _timerId = $timeout.cancel(_timerId); return this; }; @@ -97,6 +112,15 @@ define(function (require) { return !!_started; }; + /** + * Returns the current loop interval + * + * @return {number} + */ + looper.loopInterval = function () { + return _ms; + }; + /** * Wraps _fn so that _fn can be changed * without rescheduling and schedules diff --git a/src/kibana/components/timepicker/timepicker.html b/src/kibana/components/timepicker/timepicker.html index 399afa4c226d..336f9020036b 100644 --- a/src/kibana/components/timepicker/timepicker.html +++ b/src/kibana/components/timepicker/timepicker.html @@ -13,132 +13,152 @@ padding: 0px 15px; } + .kbn-refresh-list { + padding: 0px 15px; + } + .kbn-timepicket-alert { width: 100px; } -