mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(elasticsearch): quote variable value in lucene variable mulit format, fixes #2828
This commit is contained in:
parent
b80dc92ca5
commit
a567939f78
@ -44,7 +44,10 @@ function (angular, _) {
|
||||
return '(' + value.join('|') + ')';
|
||||
}
|
||||
case "lucene": {
|
||||
return '(' + value.join(' OR ') + ')';
|
||||
var quotedValues = _.map(value, function(val) {
|
||||
return '\\\"' + val + '\\\"';
|
||||
});
|
||||
return '(' + quotedValues.join(' OR ') + ')';
|
||||
}
|
||||
case "pipe": {
|
||||
return value.join('|');
|
||||
|
@ -262,7 +262,10 @@ function (angular, _, kbn) {
|
||||
break;
|
||||
}
|
||||
case 'lucene': {
|
||||
allValue = '(' + _.pluck(variable.options, 'text').join(' OR ') + ')';
|
||||
var quotedValues = _.map(variable.options, function(val) {
|
||||
return '\\\"' + val.text + '\\\"';
|
||||
});
|
||||
allValue = '(' + quotedValues.join(' OR ') + ')';
|
||||
break;
|
||||
}
|
||||
case 'regex values': {
|
||||
|
@ -68,7 +68,7 @@ define([
|
||||
value: ['test','test2'],
|
||||
}
|
||||
});
|
||||
expect(result).to.be('(test OR test2)');
|
||||
expect(result).to.be('(\\\"test\\\" OR \\\"test2\\\")');
|
||||
});
|
||||
|
||||
it('multi value and regex format should render regex string', function() {
|
||||
|
@ -321,7 +321,7 @@ define([
|
||||
});
|
||||
|
||||
it('should add lucene glob', function() {
|
||||
expect(scenario.variable.options[0].value).to.be('(backend1 OR backend2)');
|
||||
expect(scenario.variable.options[0].value).to.be('(\\\"backend1\\\" OR \\\"backend2\\\")');
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user