diff --git a/public/app/features/dashboard/graphiteImportCtrl.js b/public/app/features/dashboard/graphiteImportCtrl.js index 5a9205bd817..be912610e36 100644 --- a/public/app/features/dashboard/graphiteImportCtrl.js +++ b/public/app/features/dashboard/graphiteImportCtrl.js @@ -10,25 +10,27 @@ function (angular, app, _, kbn) { var module = angular.module('grafana.controllers'); module.controller('GraphiteImportCtrl', function($scope, datasourceSrv, dashboardSrv, $location) { + $scope.options = {}; $scope.init = function() { $scope.datasources = []; _.each(datasourceSrv.getAll(), function(ds) { if (ds.type === 'graphite') { - $scope.sourceName = ds.name; + $scope.options.sourceName = ds.name; $scope.datasources.push(ds.name); } }); }; $scope.listAll = function() { - $scope.datasource = datasourceSrv.get($scope.sourceName); - - $scope.datasource.listDashboards('').then(function(results) { - $scope.dashboards = results; - }, function(err) { - var message = err.message || err.statusText || 'Error'; - $scope.appEvent('alert-error', ['Failed to load dashboard list from graphite', message]); + datasourceSrv.get($scope.options.sourceName).then(function(datasource) { + $scope.datasource = datasource; + $scope.datasource.listDashboards('').then(function(results) { + $scope.dashboards = results; + }, function(err) { + var message = err.message || err.statusText || 'Error'; + $scope.appEvent('alert-error', ['Failed to load dashboard list from graphite', message]); + }); }); }; diff --git a/public/app/features/dashboard/partials/graphiteImport.html b/public/app/features/dashboard/partials/graphiteImport.html index 0082fa92047..343b5d52e41 100644 --- a/public/app/features/dashboard/partials/graphiteImport.html +++ b/public/app/features/dashboard/partials/graphiteImport.html @@ -9,7 +9,7 @@ Data source
  • -