From 1d0a3660bde4b93905c257f7eb04e8c361a52f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 31 Mar 2015 14:31:47 +0200 Subject: [PATCH] Fixed issue with updating default data source, it required page reload to take effect, should not be required, now fixed, Fixes #1671 --- CHANGELOG.md | 5 +++++ public/app/features/org/datasourceEditCtrl.js | 8 +++++--- public/app/services/datasourceSrv.js | 6 ++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa48bf7df41..26996359593 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.0.0-RC1 (unreleased) + +- [Issue #1671](https://github.com/grafana/grafana/issues/1671). Data sources: Fixed issue with changing default data source (should not require full page load to take effect, now fixed) + + # 2.0.0-Beta1 (2015-03-30) **New features** diff --git a/public/app/features/org/datasourceEditCtrl.js b/public/app/features/org/datasourceEditCtrl.js index 913c45fcd67..780aee3e843 100644 --- a/public/app/features/org/datasourceEditCtrl.js +++ b/public/app/features/org/datasourceEditCtrl.js @@ -1,8 +1,8 @@ define([ 'angular', - 'lodash', + 'config', ], -function (angular) { +function (angular, config) { 'use strict'; var module = angular.module('grafana.controllers'); @@ -59,7 +59,9 @@ function (angular) { $scope.updateFrontendSettings = function() { backendSrv.get('/api/frontend/settings').then(function(settings) { - datasourceSrv.init(settings.datasources); + config.datasources = settings.datasources; + config.defaultDatasource = settings.defaultDatasource; + datasourceSrv.init(); }); }; diff --git a/public/app/services/datasourceSrv.js b/public/app/services/datasourceSrv.js index 82a19efdff0..35256c9fe4f 100644 --- a/public/app/services/datasourceSrv.js +++ b/public/app/services/datasourceSrv.js @@ -11,9 +11,7 @@ function (angular, _, config) { module.service('datasourceSrv', function($q, $injector, $rootScope) { var self = this; - this.init = function(dsSettingList) { - config.datasources = dsSettingList; - + this.init = function() { this.datasources = {}; this.metricSources = []; this.annotationSources = []; @@ -77,6 +75,6 @@ function (angular, _, config) { return this.metricSources; }; - this.init(config.datasources); + this.init(); }); });