From 29acf951b28c8bc1721634a3615d53341429acc0 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 8 May 2020 17:09:18 +0300 Subject: [PATCH] Problems: fix proxy filter --- .../partials/query.editor.html | 15 +++++++++++++ src/datasource-zabbix/query.controller.js | 22 ++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/datasource-zabbix/partials/query.editor.html b/src/datasource-zabbix/partials/query.editor.html index ace1625..03a574c 100644 --- a/src/datasource-zabbix/partials/query.editor.html +++ b/src/datasource-zabbix/partials/query.editor.html @@ -86,6 +86,21 @@ }"> +
+ + +
+
diff --git a/src/datasource-zabbix/query.controller.js b/src/datasource-zabbix/query.controller.js index 4c4eb5c..cf0fb19 100644 --- a/src/datasource-zabbix/query.controller.js +++ b/src/datasource-zabbix/query.controller.js @@ -106,6 +106,7 @@ export class ZabbixQueryController extends QueryCtrl { this.getApplicationNames = _.bind(this.getMetricNames, this, 'appList'); this.getItemNames = _.bind(this.getMetricNames, this, 'itemList'); this.getITServices = _.bind(this.getMetricNames, this, 'itServiceList'); + this.getProxyNames = _.bind(this.getMetricNames, this, 'proxyList'); this.getVariables = _.bind(this.getTemplateVariables, this); // Update metric suggestion when template variable was changed @@ -161,12 +162,18 @@ export class ZabbixQueryController extends QueryCtrl { initFilters() { let itemtype = _.find(this.editorModes, {'queryType': this.target.queryType}); itemtype = itemtype ? itemtype.value : null; - return Promise.all([ + const promises = [ this.suggestGroups(), this.suggestHosts(), this.suggestApps(), - this.suggestItems(itemtype) - ]); + this.suggestItems(itemtype), + ]; + + if (this.target.queryType === c.MODE_PROBLEMS) { + promises.push(this.suggestProxies()); + } + + return Promise.all(promises); } // Get list of metric names for bs-typeahead directive @@ -243,6 +250,15 @@ export class ZabbixQueryController extends QueryCtrl { }); } + suggestProxies() { + return this.zabbix.getProxies() + .then(response => { + const proxies = _.map(response, 'host'); + this.metric.proxyList = proxies; + return proxies; + }); + } + isRegex(str) { return utils.isRegex(str); }