From b30dfcf28a92d770e02c007dc67b309acb287cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sun, 16 Aug 2015 01:34:09 +0200 Subject: [PATCH] feat(datasource): added new mixed data source --- public/app/features/panel/panelDirective.js | 3 ++ public/app/features/panel/panelSrv.js | 13 ++++++ public/app/partials/metrics.html | 4 +- .../plugins/datasource/graphite/queryCtrl.js | 3 -- .../influxdb/partials/query.editor.html | 18 ++++---- .../plugins/datasource/mixed/datasource.js | 42 +++++++++++++++++++ .../app/plugins/datasource/mixed/plugin.json | 15 +++++++ public/css/less/tightform.less | 1 + 8 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 public/app/plugins/datasource/mixed/datasource.js create mode 100644 public/app/plugins/datasource/mixed/plugin.json 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 @@
- - +