mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed importing dashboards from graphite web issue
This commit is contained in:
@@ -10,26 +10,28 @@ function (angular, app, _, kbn) {
|
|||||||
var module = angular.module('grafana.controllers');
|
var module = angular.module('grafana.controllers');
|
||||||
|
|
||||||
module.controller('GraphiteImportCtrl', function($scope, datasourceSrv, dashboardSrv, $location) {
|
module.controller('GraphiteImportCtrl', function($scope, datasourceSrv, dashboardSrv, $location) {
|
||||||
|
$scope.options = {};
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.datasources = [];
|
$scope.datasources = [];
|
||||||
_.each(datasourceSrv.getAll(), function(ds) {
|
_.each(datasourceSrv.getAll(), function(ds) {
|
||||||
if (ds.type === 'graphite') {
|
if (ds.type === 'graphite') {
|
||||||
$scope.sourceName = ds.name;
|
$scope.options.sourceName = ds.name;
|
||||||
$scope.datasources.push(ds.name);
|
$scope.datasources.push(ds.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.listAll = function() {
|
$scope.listAll = function() {
|
||||||
$scope.datasource = datasourceSrv.get($scope.sourceName);
|
datasourceSrv.get($scope.options.sourceName).then(function(datasource) {
|
||||||
|
$scope.datasource = datasource;
|
||||||
$scope.datasource.listDashboards('').then(function(results) {
|
$scope.datasource.listDashboards('').then(function(results) {
|
||||||
$scope.dashboards = results;
|
$scope.dashboards = results;
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
var message = err.message || err.statusText || 'Error';
|
var message = err.message || err.statusText || 'Error';
|
||||||
$scope.appEvent('alert-error', ['Failed to load dashboard list from graphite', message]);
|
$scope.appEvent('alert-error', ['Failed to load dashboard list from graphite', message]);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.import = function(dashName) {
|
$scope.import = function(dashName) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<strong>Data source</strong>
|
<strong>Data source</strong>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<select type="text" ng-model="sourceName" class="input-medium tight-form-input" ng-options="f for f in datasources">
|
<select type="text" ng-model="options.sourceName" class="input-medium tight-form-input" ng-options="f for f in datasources">
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
<li style="float: right">
|
<li style="float: right">
|
||||||
|
|||||||
Reference in New Issue
Block a user