Refactor: queryProcessor.service.

This commit is contained in:
Alexander Zobnin
2016-11-12 18:04:29 +03:00
parent 4a73957c16
commit 2e57b9b166
4 changed files with 166 additions and 267 deletions

View File

@@ -146,12 +146,10 @@ class ZabbixAPIDatasource {
}
queryNumericData(target, timeFrom, timeTo, useTrends) {
// Build query in asynchronous manner
return this.queryProcessor.build(target.group.filter,
target.host.filter,
target.application.filter,
target.item.filter,
'num')
let options = {
itemtype: 'num'
};
return this.queryProcessor.build(target, options)
.then(items => {
// Add hostname for items from multiple hosts
var addHostName = utils.isRegex(target.host.filter);
@@ -227,11 +225,10 @@ class ZabbixAPIDatasource {
}
queryTextData(target, timeFrom, timeTo) {
return this.queryProcessor.build(target.group.filter,
target.host.filter,
target.application.filter,
target.item.filter,
'text')
let options = {
itemtype: 'text'
};
return this.queryProcessor.build(target, options)
.then(items => {
if (items.length) {
return this.zabbixAPI.getHistory(items, timeFrom, timeTo)