Return only numeric or text items depend of editor mode.

This commit is contained in:
Alexander Zobnin
2016-04-12 12:21:43 +03:00
parent 49ea07451f
commit a6c2774334
2 changed files with 21 additions and 5 deletions

View File

@@ -93,10 +93,11 @@ export class ZabbixQueryController extends QueryCtrl {
initFilters() {
var self = this;
var itemtype = self.editorModes[self.target.mode];
return this.$q.when(this.suggestGroups())
.then(() => {return self.suggestHosts();})
.then(() => {return self.suggestApps();})
.then(() => {return self.suggestItems();});
.then(() => {return self.suggestItems(itemtype);});
}
suggestGroups() {
@@ -138,7 +139,7 @@ export class ZabbixQueryController extends QueryCtrl {
});
}
suggestItems() {
suggestItems(itemtype='num') {
var self = this;
var appFilter = this.templateSrv.replace(this.target.application.filter);
if (appFilter) {
@@ -148,7 +149,7 @@ export class ZabbixQueryController extends QueryCtrl {
.then(apps => {
var appids = _.map(apps, 'applicationid');
return self.zabbix
.getItems(undefined, appids)
.getItems(undefined, appids, itemtype)
.then(items => {
if (!self.target.showDisabledItems) {
items = _.filter(items, {'status': '0'});
@@ -161,7 +162,7 @@ export class ZabbixQueryController extends QueryCtrl {
// Return all items belonged to selected hosts
var hostids = _.map(self.metric.hostList, 'hostid');
return self.zabbix
.getItems(hostids)
.getItems(hostids, undefined, itemtype)
.then(items => {
if (!self.target.showDisabledItems) {
items = _.filter(items, {'status': '0'});