From 7806da11e65fdd220119c0d33eb672b2888a564a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 24 Jun 2015 21:31:16 +0200 Subject: [PATCH] Fixed issue with test data source connection and direct access, Fixes #2219 --- public/app/features/org/datasourceEditCtrl.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/public/app/features/org/datasourceEditCtrl.js b/public/app/features/org/datasourceEditCtrl.js index f2af6325a20..9bb49edff42 100644 --- a/public/app/features/org/datasourceEditCtrl.js +++ b/public/app/features/org/datasourceEditCtrl.js @@ -58,7 +58,7 @@ function (angular, config) { }; $scope.updateFrontendSettings = function() { - backendSrv.get('/api/frontend/settings').then(function(settings) { + return backendSrv.get('/api/frontend/settings').then(function(settings) { config.datasources = settings.datasources; config.defaultDatasource = settings.defaultDatasource; datasourceSrv.init(); @@ -101,12 +101,13 @@ function (angular, config) { if ($scope.current.id) { return backendSrv.put('/api/datasources/' + $scope.current.id, $scope.current).then(function() { - $scope.updateFrontendSettings(); - if (test) { - $scope.testDatasource(); - } else { - $location.path('datasources'); - } + $scope.updateFrontendSettings().then(function() { + if (test) { + $scope.testDatasource(); + } else { + $location.path('datasources'); + } + }); }); } else { return backendSrv.post('/api/datasources', $scope.current).then(function(result) {