feat(dashboard): sync time range with url, closes #458
This commit is contained in:
@@ -10,7 +10,7 @@ define([
|
||||
|
||||
var module = angular.module('grafana.services');
|
||||
|
||||
module.service('timeSrv', function($rootScope, $timeout, $routeParams, timer) {
|
||||
module.service('timeSrv', function($rootScope, $timeout, $routeParams, timer, $location) {
|
||||
var self = this;
|
||||
|
||||
this.init = function(dashboard) {
|
||||
@@ -108,6 +108,13 @@ define([
|
||||
this.old_refresh = null;
|
||||
}
|
||||
|
||||
// update url params
|
||||
var urlParams = $location.search();
|
||||
var urlRange = this.timeRangeForUrl();
|
||||
urlParams.from = urlRange.from;
|
||||
urlParams.to = urlRange.to;
|
||||
$location.search(urlParams);
|
||||
|
||||
$rootScope.appEvent('time-range-changed', this.time);
|
||||
$timeout(this.refreshDashboard, 0);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user