From 31866b5e57cfe39a79a044e6ab1350b6e31cc1bb Mon Sep 17 00:00:00 2001 From: Denis Doria Date: Mon, 6 Mar 2017 08:37:49 +0100 Subject: [PATCH] Allow commas on template variable #7681 (#7732) This improvement allows to wrap an "expression" when using single or double quotes. So now you can have time interval with offset for influxdb. --- public/app/features/templating/interval_variable.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/features/templating/interval_variable.ts b/public/app/features/templating/interval_variable.ts index ab1b0e59442..10977596057 100644 --- a/public/app/features/templating/interval_variable.ts +++ b/public/app/features/templating/interval_variable.ts @@ -59,8 +59,9 @@ export class IntervalVariable implements Variable { } updateOptions() { - // extract options in comma separated string - this.options = _.map(this.query.split(/[,]+/), function(text) { + // extract options between quotes and/or comma + this.options = _.map(this.query.match(/(["'])(.*?)\1|\w+/g), function(text) { + text = text.replace(/["']+/g, ''); return {text: text.trim(), value: text.trim()}; });