diff --git a/ui/src/app/api/time.service.js b/ui/src/app/api/time.service.js index 1acea59b5b..9ca6e186b6 100644 --- a/ui/src/app/api/time.service.js +++ b/ui/src/app/api/time.service.js @@ -256,11 +256,9 @@ function TimeService($translate, $http, $q, types) { return timewindow; } - function toHistoryTimewindow(timewindow, startTimeMs, endTimeMs) { - - var interval = 0; + function toHistoryTimewindow(timewindow, startTimeMs, endTimeMs, interval = 0) { if (timewindow.history) { - interval = timewindow.history.interval; + interval = angular.isDefined(interval) ? interval : timewindow.history.interval; } else if (timewindow.realtime) { interval = timewindow.realtime.interval; } diff --git a/ui/src/app/components/dashboard.directive.js b/ui/src/app/components/dashboard.directive.js index 5ffd218acc..831ecc29f6 100644 --- a/ui/src/app/components/dashboard.directive.js +++ b/ui/src/app/components/dashboard.directive.js @@ -219,14 +219,14 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $ } }, 0); }, - onUpdateTimewindow: function(startTimeMs, endTimeMs) { + onUpdateTimewindow: function(startTimeMs, endTimeMs, interval) { if (!vm.originalDashboardTimewindow) { vm.originalDashboardTimewindow = angular.copy(vm.dashboardTimewindow); } $timeout(function() { - vm.dashboardTimewindow = timeService.toHistoryTimewindow(vm.dashboardTimewindow, startTimeMs, endTimeMs); + vm.dashboardTimewindow = timeService.toHistoryTimewindow(vm.dashboardTimewindow, startTimeMs, endTimeMs, interval); }, 0); - } + }, }; addResizeListener(gridsterParent[0], onGridsterParentResize); // eslint-disable-line no-undef diff --git a/ui/src/app/components/widget/widget.controller.js b/ui/src/app/components/widget/widget.controller.js index a58064320c..b5ad7ac0d5 100644 --- a/ui/src/app/components/widget/widget.controller.js +++ b/ui/src/app/components/widget/widget.controller.js @@ -76,9 +76,9 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele defaultSubscription: null, dashboardTimewindow: dashboardTimewindow, timewindowFunctions: { - onUpdateTimewindow: function(startTimeMs, endTimeMs) { + onUpdateTimewindow: function(startTimeMs, endTimeMs, interval) { if (widgetContext.defaultSubscription) { - widgetContext.defaultSubscription.onUpdateTimewindow(startTimeMs, endTimeMs); + widgetContext.defaultSubscription.onUpdateTimewindow(startTimeMs, endTimeMs, interval); } }, onResetTimewindow: function() {