Fixed building request for text metrics.

This commit is contained in:
Alexander Zobnin
2016-04-12 14:29:12 +03:00
parent 4ddfc4becf
commit e210150c82
3 changed files with 11 additions and 11 deletions

View File

@@ -207,7 +207,7 @@ export class ZabbixAPIDatasource {
// Query text data
else if (target.mode === 2) {
return self.queryProcessor.build(groupFilter, hostFilter, appFilter, itemFilter)
return self.queryProcessor.build(groupFilter, hostFilter, appFilter, itemFilter, 'text')
.then(function(items) {
var deferred = self.q.defer();
if (items.length) {

View File

@@ -14,13 +14,13 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) {
/**
* Build query in asynchronous manner
*/
build(groupFilter, hostFilter, appFilter, itemFilter) {
build(groupFilter, hostFilter, appFilter, itemFilter, itemtype) {
var self = this;
if (this.cache._initialized) {
return this.$q.when(self.buildFromCache(groupFilter, hostFilter, appFilter, itemFilter));
return this.$q.when(self.buildFromCache(groupFilter, hostFilter, appFilter, itemFilter, itemtype));
} else {
return this.cache.refresh().then(function() {
return self.buildFromCache(groupFilter, hostFilter, appFilter, itemFilter);
return self.buildFromCache(groupFilter, hostFilter, appFilter, itemFilter, itemtype);
});
}
}
@@ -64,8 +64,8 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) {
/**
* Build query - convert target filters to array of Zabbix items
*/
buildFromCache(groupFilter, hostFilter, appFilter, itemFilter, showDisabledItems) {
return this.getItems(groupFilter, hostFilter, appFilter, showDisabledItems)
buildFromCache(groupFilter, hostFilter, appFilter, itemFilter, itemtype, showDisabledItems) {
return this.getItems(groupFilter, hostFilter, appFilter, itemtype, showDisabledItems)
.then(items => {
return getByFilter(items, itemFilter);
});
@@ -108,7 +108,7 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) {
});
}
getItems(groupFilter, hostFilter, appFilter, showDisabledItems) {
getItems(groupFilter, hostFilter, appFilter, itemtype, showDisabledItems) {
var self = this;
return this.getHosts(groupFilter)
.then(hosts => {
@@ -133,7 +133,7 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) {
.then(apps => {
if (apps.appFilterEmpty) {
return self.cache
.getItems(apps.hostids, undefined)
.getItems(apps.hostids, undefined, itemtype)
.then(items => {
if (showDisabledItems) {
items = _.filter(items, {'status': '0'});
@@ -143,7 +143,7 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) {
} else {
var appids = _.map(apps, 'applicationid');
return self.cache
.getItems(undefined, appids)
.getItems(undefined, appids, itemtype)
.then(items => {
if (showDisabledItems) {
items = _.filter(items, {'status': '0'});

View File

@@ -102,9 +102,9 @@ angular.module('grafana.services').factory('ZabbixCachingProxy', function($q, $i
});
}
getItems(hostids, appids) {
getItems(hostids, appids, itemtype) {
var self = this;
return this.getItemsOnce(hostids, appids)
return this.getItemsOnce(hostids, appids, itemtype)
.then(items => {
self._items = _.union(self._items, items);
return items;