mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'issue1862' of https://github.com/raintank/grafana into raintank-issue1862
This commit is contained in:
commit
52c32d8b10
@ -29,13 +29,7 @@ function (angular, _, kbn) {
|
|||||||
var variable = this.variables[i];
|
var variable = this.variables[i];
|
||||||
var urlValue = queryParams['var-' + variable.name];
|
var urlValue = queryParams['var-' + variable.name];
|
||||||
if (urlValue !== void 0) {
|
if (urlValue !== void 0) {
|
||||||
var option = _.findWhere(variable.options, { text: urlValue });
|
promises.push(this.setVariableFromUrl(variable, urlValue));
|
||||||
option = option || { text: urlValue, value: urlValue };
|
|
||||||
|
|
||||||
var promise = this.setVariableValue(variable, option, true);
|
|
||||||
this.updateAutoInterval(variable);
|
|
||||||
|
|
||||||
promises.push(promise);
|
|
||||||
}
|
}
|
||||||
else if (variable.refresh) {
|
else if (variable.refresh) {
|
||||||
promises.push(this.updateOptions(variable));
|
promises.push(this.updateOptions(variable));
|
||||||
@ -48,6 +42,25 @@ function (angular, _, kbn) {
|
|||||||
return $q.all(promises);
|
return $q.all(promises);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setVariableFromUrl = function(variable, urlValue) {
|
||||||
|
if (variable.refresh) {
|
||||||
|
var self = this;
|
||||||
|
//refresh the list of options before setting the value
|
||||||
|
return this.updateOptions(variable).then(function() {
|
||||||
|
var option = _.findWhere(variable.options, { text: urlValue });
|
||||||
|
option = option || { text: urlValue, value: urlValue };
|
||||||
|
|
||||||
|
self.updateAutoInterval(variable);
|
||||||
|
return self.setVariableValue(variable, option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var option = _.findWhere(variable.options, { text: urlValue });
|
||||||
|
option = option || { text: urlValue, value: urlValue };
|
||||||
|
|
||||||
|
this.updateAutoInterval(variable);
|
||||||
|
return this.setVariableValue(variable, option);
|
||||||
|
};
|
||||||
|
|
||||||
this.updateAutoInterval = function(variable) {
|
this.updateAutoInterval = function(variable) {
|
||||||
if (!variable.auto) { return; }
|
if (!variable.auto) { return; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user