Explorar el Código

Templating : return __empty__ value when all value return nothing to prevent elasticsearch syntaxe error (#9701)

Seuf hace 7 años
padre
commit
1888708ca5
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      public/app/features/templating/template_srv.ts

+ 3 - 0
public/app/features/templating/template_srv.ts

@@ -74,6 +74,9 @@ export class TemplateSrv {
     if (typeof value === 'string') {
     if (typeof value === 'string') {
       return luceneEscape(value);
       return luceneEscape(value);
     }
     }
+    if (value instanceof Array && value.length === 0) {
+        return '__empty__';
+    }
     var quotedValues = _.map(value, function(val) {
     var quotedValues = _.map(value, function(val) {
       return '"' + luceneEscape(val) + '"';
       return '"' + luceneEscape(val) + '"';
     });
     });