diff --git a/public/app/directives/variableValueSelect.js b/public/app/directives/variableValueSelect.js index fa0e56acebc..0afb2a40509 100644 --- a/public/app/directives/variableValueSelect.js +++ b/public/app/directives/variableValueSelect.js @@ -9,7 +9,7 @@ function (angular, app, _) { angular .module('grafana.directives') - .directive('variableValueSelect', function($compile, $window, $timeout) { + .directive('variableValueSelect', function($compile, $window, $timeout, datasourceSrv) { return { scope: { variable: "=", @@ -132,6 +132,9 @@ function (angular, app, _) { } }; + scope.selectTag = function(tag) { + }; + scope.hide = function() { scope.selectorOpen = false; bodyEl.off('click', scope.bodyOnClick); diff --git a/public/app/features/dashboard/partials/variableValueSelect.html b/public/app/features/dashboard/partials/variableValueSelect.html index c055c1151ae..481f2734876 100644 --- a/public/app/features/dashboard/partials/variableValueSelect.html +++ b/public/app/features/dashboard/partials/variableValueSelect.html @@ -25,8 +25,8 @@
- - {{key}} + + {{tag}}
diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index a0549414b6a..6883410cd01 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -226,6 +226,42 @@ +
+
+
Value Groups/Tags
+
+
    +
  • + Tags query +
  • +
  • + +
  • +
+
+
+
+
    +
  • + Tags values query +
  • +
  • + +
  • +
+
+
+
+
    +
  • + +
  • +
+
+
+
+
+
Preview of values (shows max 20)
diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index 6db5ce595a2..7330be1b5cd 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -120,7 +120,7 @@ function (angular, _, kbn) { } return datasourceSrv.get(variable.datasource).then(function(datasource) { - return datasource.metricFindQuery(variable.query).then(function (results) { + var queryPromise = datasource.metricFindQuery(variable.query).then(function (results) { variable.options = self.metricNamesToVariableValues(variable, results); if (variable.includeAll) { @@ -138,6 +138,19 @@ function (angular, _, kbn) { return self.setVariableValue(variable, variable.options[0]); }); + + if (variable.useTags) { + return queryPromise.then(function() { + datasource.metricFindQuery(variable.tagsQuery).then(function (results) { + variable.tags = []; + for (var i = 0; i < results.length; i++) { + variable.tags.push(results[i].text); + } + }); + }); + } else { + return queryPromise; + } }); };