From 7e3ccdf983b76bc9680687f83c70c4f3ebe1de2e Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Tue, 10 Jan 2017 12:35:05 -0800 Subject: [PATCH] Fixed opentsdb templating bug (#7208) --- public/app/features/templating/specs/template_srv_specs.ts | 5 +++++ public/app/features/templating/templateSrv.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/public/app/features/templating/specs/template_srv_specs.ts b/public/app/features/templating/specs/template_srv_specs.ts index ca336e97ba3..af95b68cb7d 100644 --- a/public/app/features/templating/specs/template_srv_specs.ts +++ b/public/app/features/templating/specs/template_srv_specs.ts @@ -150,6 +150,11 @@ describe('templateSrv', function() { expect(result).to.be('test,build=test2'); }); + it('multi value and distributed should render when not string', function() { + var result = _templateSrv.formatValue(['test'], 'distributed', { name: 'build' }); + expect(result).to.be('test'); + }); + it('slash should be properly escaped in regex format', function() { var result = _templateSrv.formatValue('Gi3/14', 'regex'); expect(result).to.be('Gi3\\/14'); diff --git a/public/app/features/templating/templateSrv.js b/public/app/features/templating/templateSrv.js index a41f5a9d0f3..de82be2cf66 100644 --- a/public/app/features/templating/templateSrv.js +++ b/public/app/features/templating/templateSrv.js @@ -97,6 +97,9 @@ function (angular, _, kbn) { return value.join('|'); } case "distributed": { + if (typeof value === 'string') { + return value; + } return this.distributeVariable(value, variable.name); } default: {