Skip to content

Commit

Permalink
Merge branch 'develop' into release-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Jul 11, 2015
2 parents f7ded40 + dcf840f commit a671b84
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions zabbix/datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ function (angular, _, kbn) {
// Filter hosts by regex
if (target.host.visible_name === 'All') {
if (target.hostFilter && _.every(items, _.identity.hosts)) {
var host_pattern = new RegExp(target.hostFilter);

// Use templated variables in filter
var pattern = templateSrv.replace(target.hostFilter);
var host_pattern = new RegExp(pattern);
items = _.filter(items, function (item) {
return _.some(item.hosts, function (host) {
return host_pattern.test(host.name);
Expand All @@ -103,7 +106,10 @@ function (angular, _, kbn) {

// Filter items by regex
if (target.itemFilter) {
var item_pattern = new RegExp(target.itemFilter);

// Use templated variables in filter
var pattern = templateSrv.replace(target.itemFilter);
var item_pattern = new RegExp(pattern);
return _.filter(items, function (item) {
return item_pattern.test(zabbixHelperSrv.expandItemName(item));
});
Expand Down

0 comments on commit a671b84

Please sign in to comment.