mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Closes #54, template/filter can now use "All", when all is not a wildcard but the specific metric segments specified in the filter query.
This commit is contained in:
parent
e574314472
commit
a35ed05bc3
@ -41,8 +41,19 @@ function (angular, app, _) {
|
||||
filter.options = _.map(results, function(node) {
|
||||
return { text: node.text, value: node.text };
|
||||
});
|
||||
|
||||
if (filter.includeAll) {
|
||||
filter.options.unshift({text: 'All', value: '*'});
|
||||
if(endsWithWildcard(filter.query)) {
|
||||
filter.options.unshift({text: 'All', value: '*'});
|
||||
}
|
||||
else {
|
||||
var allExpr = '{';
|
||||
_.each(filter.options, function(option) {
|
||||
allExpr += option.text + ',';
|
||||
});
|
||||
allExpr = allExpr.substring(0, allExpr.length - 1) + '}';
|
||||
filter.options.unshift({text: 'All', value: allExpr});
|
||||
}
|
||||
}
|
||||
|
||||
filterSrv.filterOptionSelected(filter, filter.options[0]);
|
||||
@ -66,5 +77,13 @@ function (angular, app, _) {
|
||||
$rootScope.$broadcast('render');
|
||||
};
|
||||
|
||||
function endsWithWildcard(query) {
|
||||
if (query.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return query[query.length - 1] === '*';
|
||||
}
|
||||
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user