mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
import from graphite: set correct datasource for panel
This commit is contained in:
parent
8ea4351797
commit
ae9d9ea284
@ -13,7 +13,7 @@ function (angular, app, _) {
|
|||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
console.log('hej!');
|
console.log('hej!');
|
||||||
$scope.datasources = datasourceSrv.listOptions();
|
$scope.datasources = datasourceSrv.listOptions();
|
||||||
$scope.setDatasource(datasourceSrv.default.value);
|
$scope.setDatasource(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -48,14 +48,14 @@ function (angular, app, _) {
|
|||||||
throw { message: 'no dashboard state received from graphite' };
|
throw { message: 'no dashboard state received from graphite' };
|
||||||
}
|
}
|
||||||
|
|
||||||
graphiteToGrafanaTranslator(results.data.state);
|
graphiteToGrafanaTranslator(results.data.state, $scope.datasource.name);
|
||||||
})
|
})
|
||||||
.then(null, function(err) {
|
.then(null, function(err) {
|
||||||
$scope.error = err.message || 'Failed to import dashboard';
|
$scope.error = err.message || 'Failed to import dashboard';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function graphiteToGrafanaTranslator(state) {
|
function graphiteToGrafanaTranslator(state, datasource) {
|
||||||
var graphsPerRow = 2;
|
var graphsPerRow = 2;
|
||||||
var rowHeight = 300;
|
var rowHeight = 300;
|
||||||
var rowTemplate;
|
var rowTemplate;
|
||||||
@ -85,7 +85,8 @@ function (angular, app, _) {
|
|||||||
type: 'graphite',
|
type: 'graphite',
|
||||||
span: 12 / graphsPerRow,
|
span: 12 / graphsPerRow,
|
||||||
title: graph[1].title,
|
title: graph[1].title,
|
||||||
targets: []
|
targets: [],
|
||||||
|
datasource: datasource
|
||||||
};
|
};
|
||||||
|
|
||||||
_.each(graph[1].target, function(target) {
|
_.each(graph[1].target, function(target) {
|
||||||
|
Loading…
Reference in New Issue
Block a user