mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 17:15:40 -06:00
fix(templating): fixed detection of nested template variables, fixes #5103
This commit is contained in:
parent
df0ddc0b50
commit
2416ee04c8
@ -97,8 +97,11 @@ function (angular, _) {
|
||||
if (!str) {
|
||||
return false;
|
||||
}
|
||||
var match = this._regex.exec(str);
|
||||
return match && (match[1] === variableName || match[2] === variableName);
|
||||
|
||||
variableName = regexEscape(variableName);
|
||||
var findVarRegex = new RegExp('\\$(' + variableName + ')[\\W|$]|\\[\\[(' + variableName + ')\\]\\]', 'g');
|
||||
var match = findVarRegex.exec(str);
|
||||
return match !== null;
|
||||
};
|
||||
|
||||
this.highlightVariablesAsHtml = function(str) {
|
||||
|
@ -200,6 +200,11 @@ define([
|
||||
expect(contains).to.be(true);
|
||||
});
|
||||
|
||||
it('should find it when part of segment', function() {
|
||||
var contains = _templateSrv.containsVariable('metrics.$env.$group-*', 'group');
|
||||
expect(contains).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('updateTemplateData with simple value', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user