Przeglądaj źródła

Fixed issue with updating default data source, it required page reload to take effect, should not be required, now fixed, Fixes #1671

Torkel Ödegaard 10 lat temu
rodzic
commit
1d0a3660bd

+ 5 - 0
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**

+ 5 - 3
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();
       });
     };
 

+ 2 - 4
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();
   });
 });