mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(templating): progress on templating rethink
This commit is contained in:
@@ -31,13 +31,18 @@ function (angular, _) {
|
||||
}, this);
|
||||
};
|
||||
|
||||
this.regexEscape = function(value) {
|
||||
return value.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');
|
||||
};
|
||||
|
||||
this.formatValue = function(value, format) {
|
||||
if (_.isString(value)) {
|
||||
return value;
|
||||
} else {
|
||||
switch(format) {
|
||||
case "regex values": {
|
||||
return '(' + value.join('|') + ')';
|
||||
case "regex": {
|
||||
var escapedValues = _.map(value, this.regexEscape);
|
||||
return '(' + escapedValues.join('|') + ')';
|
||||
}
|
||||
case "lucene": {
|
||||
var quotedValues = _.map(value, function(val) {
|
||||
|
||||
Reference in New Issue
Block a user