mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(dashboard): sync time range with url, closes #458
This commit is contained in:
parent
5607a114f9
commit
a81806d3d0
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user