mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' of github.com:grafana/grafana
This commit is contained in:
commit
f5c5d1b1da
@ -1,6 +1,8 @@
|
||||
# 3.1.0 (unreleased)
|
||||
|
||||
### Enhancements
|
||||
* **Dashboard Url**: Time range changes updates url, closes [#458](https://github.com/grafana/grafana/issues/458)
|
||||
* **Dashboard Url**: Template variable change updates url, closes [#5002](https://github.com/grafana/grafana/issues/5002)
|
||||
* **Singlestat**: Add support for range to text mappings, closes [#1319](https://github.com/grafana/grafana/issues/1319)
|
||||
* **Graph**: Adds sort order options for graph tooltip, closes [#1189](https://github.com/grafana/grafana/issues/1189)
|
||||
* **Theme**: Add default theme to config file [#5011](https://github.com/grafana/grafana/pull/5011)
|
||||
@ -9,6 +11,7 @@
|
||||
# 3.0.4 Patch release (unreleased)
|
||||
* **Templating**: Fixed issue with nested multi select variables and cascading and updating child variable selection state, fixes [#4861](https://github.com/grafana/grafana/pull/4861)
|
||||
* **Singlestat gauge**: Fixed issue with gauge render position, fixes [#5143](https://github.com/grafana/grafana/pull/5143)
|
||||
* **Home dashboard**: Fixes broken home dashboard api, fixes [#5167](https://github.com/grafana/grafana/issues/5167)
|
||||
|
||||
# 3.0.3 Patch release (2016-05-23)
|
||||
* **Annotations**: Annotations can now use a template variable as data source, closes [#5054](https://github.com/grafana/grafana/issues/5054)
|
||||
|
@ -1,6 +1,7 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
|
||||
export class SubmenuCtrl {
|
||||
annotations: any;
|
||||
@ -8,7 +9,11 @@ export class SubmenuCtrl {
|
||||
dashboard: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private $rootScope, private templateValuesSrv, private dynamicDashboardSrv) {
|
||||
constructor(private $rootScope,
|
||||
private templateValuesSrv,
|
||||
private templateSrv,
|
||||
private dynamicDashboardSrv,
|
||||
private $location) {
|
||||
this.annotations = this.dashboard.templating.list;
|
||||
this.variables = this.dashboard.templating.list;
|
||||
}
|
||||
@ -22,8 +27,25 @@ export class SubmenuCtrl {
|
||||
return this.templateValuesSrv.getValuesForTag(variable, tagKey);
|
||||
}
|
||||
|
||||
updateUrlParamsWithCurrentVariables() {
|
||||
// update url
|
||||
var params = this.$location.search();
|
||||
// remove variable params
|
||||
_.each(params, function(value, key) {
|
||||
if (key.indexOf('var-') === 0) {
|
||||
delete params[key];
|
||||
}
|
||||
});
|
||||
|
||||
// add new values
|
||||
this.templateSrv.fillVariableValuesForUrl(params);
|
||||
// update url
|
||||
this.$location.search(params);
|
||||
}
|
||||
|
||||
variableUpdated(variable) {
|
||||
this.templateValuesSrv.variableUpdated(variable).then(() => {
|
||||
this.updateUrlParamsWithCurrentVariables();
|
||||
this.dynamicDashboardSrv.update(this.dashboard);
|
||||
this.$rootScope.$emit('template-variable-value-updated');
|
||||
this.$rootScope.$broadcast('refresh');
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -79,7 +79,6 @@ function (angular, _, kbn) {
|
||||
else if (variable.refresh === 1 || variable.refresh === 2) {
|
||||
return self.updateOptions(variable).then(function() {
|
||||
if (_.isEmpty(variable.current) && variable.options.length) {
|
||||
console.log("setting current for %s", variable.name);
|
||||
self.setVariableValue(variable, variable.options[0]);
|
||||
}
|
||||
lock.resolve();
|
||||
@ -102,7 +101,10 @@ function (angular, _, kbn) {
|
||||
}
|
||||
|
||||
return promise.then(function() {
|
||||
var option = _.findWhere(variable.options, { text: urlValue });
|
||||
var option = _.find(variable.options, function(op) {
|
||||
return op.text === urlValue || op.value === urlValue;
|
||||
});
|
||||
|
||||
option = option || { text: urlValue, value: urlValue };
|
||||
|
||||
self.updateAutoInterval(variable);
|
||||
|
Loading…
Reference in New Issue
Block a user