From 57315f1e27081ce0b30d6bf0b1edaface4ceff1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 1 Mar 2016 19:12:54 +0100 Subject: [PATCH] feat(templating): updates to template variable forms --- .../features/templating/partials/editor.html | 63 ++++++++++--------- public/app/features/templating/templateSrv.js | 6 +- .../plugins/datasource/opentsdb/datasource.js | 4 +- public/test/specs/templateSrv-specs.js | 2 +- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 78132a1d04a..442ee0c9f2a 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -12,7 +12,7 @@
  • - {{current.name}} + Edit
  • @@ -108,35 +108,35 @@
    Value Options
    - Values - + Values +
    - - - Auto interval steps How many times should the current time range be divided to calculate the value - -
    - + Auto option + +
    +
    +
    + + Auto steps How many times should the current time range be divided to calculate the value + +
    + +
    +
    +
    + + Min interval The calculated value will not go below this threshold + +
    -
    -
    - - Auto interval min value The calculated value will not go below this threshold - -
    Values seperated by comma - -
    -
    - Include All option - - +
    @@ -152,11 +152,6 @@
    -
    - All value - - -
    Update @@ -165,13 +160,19 @@
    -
    Multi-value selection Enables multiple values to be selected at the same time
    +
    Selection Options
    + Multi-value - Multi format -
    - -
    + Enables multiple values to be selected at the same time +
    +
    + Include All option + +
    +
    + Custom all value +
    diff --git a/public/app/features/templating/templateSrv.js b/public/app/features/templating/templateSrv.js index 011b3150e2f..0df887ca483 100644 --- a/public/app/features/templating/templateSrv.js +++ b/public/app/features/templating/templateSrv.js @@ -107,7 +107,11 @@ function (angular, _) { if (variable.allValue) { return variable.allValue; } - return _.pluck(variable.options, 'value'); + var values = []; + for (var i = 1; i < variable.options.length; i++) { + values.push(variable.options[i].value); + } + return values; }; this.replace = function(target, scopedVars, format) { diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index 14605151752..e9662f8f289 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -335,7 +335,7 @@ function (angular, _, dateMath) { query.tags = angular.copy(target.tags); if(query.tags){ for(var key in query.tags){ - query.tags[key] = templateSrv.replace(query.tags[key], options.scopedVars); + query.tags[key] = templateSrv.replace(query.tags[key], options.scopedVars, 'pipe'); } } } @@ -355,7 +355,7 @@ function (angular, _, dateMath) { } else { return target.metric === metricData.metric && _.all(target.tags, function(tagV, tagK) { - interpolatedTagValue = templateSrv.replace(tagV, options.scopedVars); + interpolatedTagValue = templateSrv.replace(tagV, options.scopedVars, 'pipe'); return metricData.tags[tagK] === interpolatedTagValue || interpolatedTagValue === "*"; }); } diff --git a/public/test/specs/templateSrv-specs.js b/public/test/specs/templateSrv-specs.js index d48cd04e7bf..65bd3f088ef 100644 --- a/public/test/specs/templateSrv-specs.js +++ b/public/test/specs/templateSrv-specs.js @@ -72,7 +72,7 @@ define([ name: 'test', current: {value: '$__all' }, options: [ - {value: 'value1'}, {value: 'value2'} + {value: '$__all'}, {value: 'value1'}, {value: 'value2'} ] }]); });