diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index 62d7b8c591e..b0e89e32590 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -65,11 +65,17 @@ define([ } }; - this.setAutoRefresh = function (interval) { + this.setAutoRefresh = function (interval, align) { this.dashboard.refresh = interval; if (interval) { var _i = kbn.interval_to_ms(interval); - this.start_scheduled_refresh(_i); + var wait_ms = 0; + if (align) { + wait_ms = _i - (Date.now() % _i); + } + $timeout(function () { + self.start_scheduled_refresh(_i); + }, wait_ms); } else { this.cancel_scheduled_refresh(); } diff --git a/public/app/features/dashboard/timepicker/dropdown.html b/public/app/features/dashboard/timepicker/dropdown.html index 8b6d0c24a0c..7e40b055e9b 100644 --- a/public/app/features/dashboard/timepicker/dropdown.html +++ b/public/app/features/dashboard/timepicker/dropdown.html @@ -40,6 +40,7 @@
+
diff --git a/public/app/features/dashboard/timepicker/timepicker.ts b/public/app/features/dashboard/timepicker/timepicker.ts index 453eaaf3204..b0eb93fe894 100644 --- a/public/app/features/dashboard/timepicker/timepicker.ts +++ b/public/app/features/dashboard/timepicker/timepicker.ts @@ -109,7 +109,7 @@ export class TimePickerCtrl { applyCustom() { if (this.refresh.value !== this.dashboard.refresh) { - this.timeSrv.setAutoRefresh(this.refresh.value); + this.timeSrv.setAutoRefresh(this.refresh.value, this.refresh.align); } this.timeSrv.setTime(this.timeRaw, true);