Commit 1aac2ec758c245e5ab4c6705102a55fabe0de394

Authored by okolesnik
1 parent 17067442

UI. Possibility to transmit interval into time service

@@ -256,11 +256,9 @@ function TimeService($translate, $http, $q, types) { @@ -256,11 +256,9 @@ function TimeService($translate, $http, $q, types) {
256 return timewindow; 256 return timewindow;
257 } 257 }
258 258
259 - function toHistoryTimewindow(timewindow, startTimeMs, endTimeMs) {  
260 -  
261 - var interval = 0; 259 + function toHistoryTimewindow(timewindow, startTimeMs, endTimeMs, interval = 0) {
262 if (timewindow.history) { 260 if (timewindow.history) {
263 - interval = timewindow.history.interval; 261 + interval = angular.isDefined(interval) ? interval : timewindow.history.interval;
264 } else if (timewindow.realtime) { 262 } else if (timewindow.realtime) {
265 interval = timewindow.realtime.interval; 263 interval = timewindow.realtime.interval;
266 } 264 }
@@ -219,14 +219,14 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $ @@ -219,14 +219,14 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
219 } 219 }
220 }, 0); 220 }, 0);
221 }, 221 },
222 - onUpdateTimewindow: function(startTimeMs, endTimeMs) { 222 + onUpdateTimewindow: function(startTimeMs, endTimeMs, interval) {
223 if (!vm.originalDashboardTimewindow) { 223 if (!vm.originalDashboardTimewindow) {
224 vm.originalDashboardTimewindow = angular.copy(vm.dashboardTimewindow); 224 vm.originalDashboardTimewindow = angular.copy(vm.dashboardTimewindow);
225 } 225 }
226 $timeout(function() { 226 $timeout(function() {
227 - vm.dashboardTimewindow = timeService.toHistoryTimewindow(vm.dashboardTimewindow, startTimeMs, endTimeMs); 227 + vm.dashboardTimewindow = timeService.toHistoryTimewindow(vm.dashboardTimewindow, startTimeMs, endTimeMs, interval);
228 }, 0); 228 }, 0);
229 - } 229 + },
230 }; 230 };
231 231
232 addResizeListener(gridsterParent[0], onGridsterParentResize); // eslint-disable-line no-undef 232 addResizeListener(gridsterParent[0], onGridsterParentResize); // eslint-disable-line no-undef
@@ -76,9 +76,9 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele @@ -76,9 +76,9 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele
76 defaultSubscription: null, 76 defaultSubscription: null,
77 dashboardTimewindow: dashboardTimewindow, 77 dashboardTimewindow: dashboardTimewindow,
78 timewindowFunctions: { 78 timewindowFunctions: {
79 - onUpdateTimewindow: function(startTimeMs, endTimeMs) { 79 + onUpdateTimewindow: function(startTimeMs, endTimeMs, interval) {
80 if (widgetContext.defaultSubscription) { 80 if (widgetContext.defaultSubscription) {
81 - widgetContext.defaultSubscription.onUpdateTimewindow(startTimeMs, endTimeMs); 81 + widgetContext.defaultSubscription.onUpdateTimewindow(startTimeMs, endTimeMs, interval);
82 } 82 }
83 }, 83 },
84 onResetTimewindow: function() { 84 onResetTimewindow: function() {