feat(dashboard): sync time range with url, closes #458

This commit is contained in:
Torkel Ödegaard 2016-05-24 13:57:25 +02:00
parent 5607a114f9
commit a81806d3d0

View File

@ -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);
};