From fb7d90df9afe499c7475fcfdcc018b6be23ee40a Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 20 Jun 2015 22:27:22 +0300 Subject: [PATCH 1/2] iss #28 Change query editor design. --- zabbix/partials/query.editor.html | 58 ++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/zabbix/partials/query.editor.html b/zabbix/partials/query.editor.html index 76da671..44dcf66 100644 --- a/zabbix/partials/query.editor.html +++ b/zabbix/partials/query.editor.html @@ -49,13 +49,13 @@ class="tight-form-input input-medium" ng-model="target.alias" spellcheck='false' - placeholder="alias" + placeholder="Alias" ng-blur="targetBlur()"> +
  • Group
  • -
  • - + +
  • + Filter + +
  • -
  • +
  • Item
  • -
  • +
  • + Scale + +
  • -
    + From 27b1c62750636e7e96b342b712163a396c0fb69e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 20 Jun 2015 22:55:51 +0300 Subject: [PATCH 2/2] Resolved #28 Added host filtering by regex. --- zabbix/datasource.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zabbix/datasource.js b/zabbix/datasource.js index 125c8ca..6ca7ebe 100644 --- a/zabbix/datasource.js +++ b/zabbix/datasource.js @@ -81,6 +81,19 @@ function (angular, _, kbn) { var self = this; return this.itemFindQuery(groups, hosts, apps) .then(function (items) { + + // Filter hosts by regex + if (target.host.visible_name == 'All') { + if (target.hostFilter && _.every(items, _.identity.hosts)) { + var host_pattern = new RegExp(target.hostFilter); + items = _.filter(items, function (item) { + return _.some(item.hosts, function (host) { + return host_pattern.test(host.name); + }); + }); + } + } + if (itemnames == 'All') { // Filter items by regex