소스 검색

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.
Denis Doria 8 년 전
부모
커밋
31866b5e57
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      public/app/features/templating/interval_variable.ts

+ 3 - 2
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()};
     });