mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 19:30:36 -06:00
Merge branch 'v3.0.x'
Conflicts: package.json
This commit is contained in:
commit
c60d737928
@ -88,7 +88,7 @@ func NewApiPluginProxy(ctx *middleware.Context, proxyPath string, route *plugins
|
||||
}
|
||||
|
||||
for key, value := range headers {
|
||||
log.Info("setting key %v value %v", key, value[0])
|
||||
log.Trace("setting key %v value %v", key, value[0])
|
||||
req.Header.Set(key, value[0])
|
||||
}
|
||||
}
|
||||
|
@ -66,14 +66,17 @@ function (angular, _, coreModule, config) {
|
||||
};
|
||||
|
||||
this.getAnnotationSources = function() {
|
||||
return _.reduce(config.datasources, function(memo, value) {
|
||||
var sources = [];
|
||||
|
||||
this.addDataSourceVariables(sources);
|
||||
|
||||
_.each(config.datasources, function(value) {
|
||||
if (value.meta && value.meta.annotations) {
|
||||
memo.push(value);
|
||||
sources.push(value);
|
||||
}
|
||||
});
|
||||
|
||||
return memo;
|
||||
}, []);
|
||||
return sources;
|
||||
};
|
||||
|
||||
this.getMetricSources = function(options) {
|
||||
@ -90,24 +93,7 @@ function (angular, _, coreModule, config) {
|
||||
});
|
||||
|
||||
if (!options || !options.skipVariables) {
|
||||
// look for data source variables
|
||||
for (var i = 0; i < templateSrv.variables.length; i++) {
|
||||
var variable = templateSrv.variables[i];
|
||||
if (variable.type !== 'datasource') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var first = variable.current.value;
|
||||
var ds = config.datasources[first];
|
||||
|
||||
if (ds) {
|
||||
metricSources.push({
|
||||
name: '$' + variable.name,
|
||||
value: '$' + variable.name,
|
||||
meta: ds.meta,
|
||||
});
|
||||
}
|
||||
}
|
||||
this.addDataSourceVariables(metricSources);
|
||||
}
|
||||
|
||||
metricSources.sort(function(a, b) {
|
||||
@ -123,6 +109,27 @@ function (angular, _, coreModule, config) {
|
||||
return metricSources;
|
||||
};
|
||||
|
||||
this.addDataSourceVariables = function(list) {
|
||||
// look for data source variables
|
||||
for (var i = 0; i < templateSrv.variables.length; i++) {
|
||||
var variable = templateSrv.variables[i];
|
||||
if (variable.type !== 'datasource') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var first = variable.current.value;
|
||||
var ds = config.datasources[first];
|
||||
|
||||
if (ds) {
|
||||
list.push({
|
||||
name: '$' + variable.name,
|
||||
value: '$' + variable.name,
|
||||
meta: ds.meta,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.init();
|
||||
});
|
||||
});
|
||||
|
@ -30,7 +30,7 @@ function (angular, _, $) {
|
||||
$scope.datasourceChanged = function() {
|
||||
return datasourceSrv.get($scope.currentAnnotation.datasource).then(function(ds) {
|
||||
$scope.currentDatasource = ds;
|
||||
$scope.currentAnnotation.datasource = ds.name;
|
||||
$scope.currentAnnotation.datasource = $scope.currentAnnotation.datasource;
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user