From 9e26a4cfcba77471442b56683a8cd8ff39c27141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Sep 2016 15:30:11 +0200 Subject: [PATCH] fix(templating): fixed unique filter after regex pass, fixes #6086 --- public/app/features/templating/query_variable.ts | 4 ++-- public/app/features/templating/specs/variable_srv_specs.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/features/templating/query_variable.ts b/public/app/features/templating/query_variable.ts index 82f180b1f94..96766d1bbfb 100644 --- a/public/app/features/templating/query_variable.ts +++ b/public/app/features/templating/query_variable.ts @@ -115,14 +115,14 @@ export class QueryVariable implements Variable { if (!matches) { continue; } if (matches.length > 1) { value = matches[1]; - text = value; + text = matches[1]; } } options.push({text: text, value: value}); } - options = _.uniq(options, 'value'); + options = _.uniqBy(options, 'value'); return this.sortVariableValues(options, this.sort); } diff --git a/public/app/features/templating/specs/variable_srv_specs.ts b/public/app/features/templating/specs/variable_srv_specs.ts index 3e5af531668..85bca8d6068 100644 --- a/public/app/features/templating/specs/variable_srv_specs.ts +++ b/public/app/features/templating/specs/variable_srv_specs.ts @@ -250,7 +250,7 @@ describe('VariableSrv', function() { describeUpdateVariable('regex pattern remove duplicates', function(scenario) { scenario.setup(function() { scenario.variableModel = {type: 'query', query: 'apps.*', name: 'test'}; - scenario.variableModel.regex = 'backend_01'; + scenario.variableModel.regex = '/backend_01/'; scenario.queryResult = [{text: 'apps.backend.backend_01.counters.req'}, {text: 'apps.backend.backend_01.counters.req'}]; });