diff --git a/public/app/features/panel/panelDirective.js b/public/app/features/panel/panelDirective.js index a697aab4722..18ab6d7891c 100644 --- a/public/app/features/panel/panelDirective.js +++ b/public/app/features/panel/panelDirective.js @@ -40,6 +40,8 @@ function (angular, $, config) { }; }); + var targetLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + module.directive('queryEditorLoader', function($compile, $parse, datasourceSrv) { return { restrict: 'E', @@ -57,6 +59,7 @@ function (angular, $, config) { editorScope = scope.$new(); editorScope.datasource = ds; + editorScope.targetLetters = targetLetters; var panelEl = angular.element(document.createElement('metric-query-editor-' + ds.meta.type)); elem.append(panelEl); diff --git a/public/app/features/panel/panelSrv.js b/public/app/features/panel/panelSrv.js index 881cab29dc0..718e20caa34 100644 --- a/public/app/features/panel/panelSrv.js +++ b/public/app/features/panel/panelSrv.js @@ -55,6 +55,19 @@ function (angular, _, config) { $scope.setDatasource = function(datasource) { $scope.panel.datasource = datasource; $scope.datasource = null; + $scope.panel.targets = _.filter($scope.panel.targets, function(target) { + delete target.datasource; + return target.datasource === void 0; + }); + + if ($scope.panel.targets.length === 0) { + $scope.panel.targets = [{}]; + } + + if (datasource === 'mixed') { + $scope.panel.targets = []; + } + $scope.get_data(); }; diff --git a/public/app/partials/metrics.html b/public/app/partials/metrics.html index eca15e905d9..9343747f53f 100644 --- a/public/app/partials/metrics.html +++ b/public/app/partials/metrics.html @@ -6,12 +6,12 @@