mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
fix: templating issue with data source variables, can now be used right away in other query variables and panels (without page reload), fixes #7510
This commit is contained in:
parent
fee1e6df41
commit
68c4ce34d5
@ -129,6 +129,10 @@ function (angular, _, coreModule, config) {
|
||||
}
|
||||
|
||||
var first = variable.current.value;
|
||||
if (first === 'default') {
|
||||
first = config.defaultDatasource;
|
||||
}
|
||||
|
||||
var ds = config.datasources[first];
|
||||
|
||||
if (ds) {
|
||||
|
@ -35,14 +35,6 @@ export class VariableEditorCtrl {
|
||||
$scope.init = function() {
|
||||
$scope.mode = 'list';
|
||||
|
||||
$scope.datasources = _.filter(datasourceSrv.getMetricSources(), function(ds) {
|
||||
return !ds.meta.mixed && ds.value !== null;
|
||||
});
|
||||
|
||||
$scope.datasourceTypes = _($scope.datasources).uniqBy('meta.id').map(function(ds) {
|
||||
return {text: ds.meta.name, value: ds.meta.id};
|
||||
}).value();
|
||||
|
||||
$scope.variables = variableSrv.variables;
|
||||
$scope.reset();
|
||||
|
||||
@ -130,6 +122,15 @@ export class VariableEditorCtrl {
|
||||
$scope.reset = function() {
|
||||
$scope.currentIsNew = true;
|
||||
$scope.current = variableSrv.createVariableFromModel({type: 'query'});
|
||||
|
||||
// this is done here in case a new data source type variable was added
|
||||
$scope.datasources = _.filter(datasourceSrv.getMetricSources(), function(ds) {
|
||||
return !ds.meta.mixed && ds.value !== null;
|
||||
});
|
||||
|
||||
$scope.datasourceTypes = _($scope.datasources).uniqBy('meta.id').map(function(ds) {
|
||||
return {text: ds.meta.name, value: ds.meta.id};
|
||||
}).value();
|
||||
};
|
||||
|
||||
$scope.typeChanged = function() {
|
||||
|
Loading…
Reference in New Issue
Block a user