Problems: fix proxy filter
This commit is contained in:
@@ -86,6 +86,21 @@
|
||||
}">
|
||||
</div>
|
||||
|
||||
<div class="gf-form" ng-show="ctrl.target.queryType == editorMode.PROBLEMS">
|
||||
<label class="gf-form-label query-keyword width-7">Proxy</label>
|
||||
<input type="text"
|
||||
ng-model="ctrl.target.proxy.filter"
|
||||
bs-typeahead="ctrl.getProxyNames"
|
||||
ng-blur="ctrl.onTargetBlur()"
|
||||
data-min-length=0
|
||||
data-items=100
|
||||
class="gf-form-input width-14"
|
||||
ng-class="{
|
||||
'zbx-variable': ctrl.isVariable(ctrl.target.proxy.filter),
|
||||
'zbx-regex': ctrl.isRegex(ctrl.target.proxy.filter)
|
||||
}">
|
||||
</div>
|
||||
|
||||
<div class="gf-form gf-form--grow">
|
||||
<div class="gf-form-label gf-form-label--grow"></div>
|
||||
</div>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user