Renamed queryBulder to queryProcessor.
This commit is contained in:
@@ -2,7 +2,7 @@ define([
|
|||||||
'angular',
|
'angular',
|
||||||
'lodash',
|
'lodash',
|
||||||
'app/core/utils/datemath',
|
'app/core/utils/datemath',
|
||||||
'./queryBuilder',
|
'./queryProcessor',
|
||||||
'./directives',
|
'./directives',
|
||||||
'./zabbixAPI',
|
'./zabbixAPI',
|
||||||
'./helperFunctions',
|
'./helperFunctions',
|
||||||
@@ -14,7 +14,7 @@ function (angular, _, dateMath) {
|
|||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
function ZabbixAPIDatasource(instanceSettings, $q, templateSrv, alertSrv,
|
function ZabbixAPIDatasource(instanceSettings, $q, templateSrv, alertSrv,
|
||||||
ZabbixAPI, zabbixHelperSrv, ZabbixCache, QueryBuilder) {
|
ZabbixAPI, zabbixHelperSrv, ZabbixCache, QueryProcessor) {
|
||||||
|
|
||||||
// General data source settings
|
// General data source settings
|
||||||
this.name = instanceSettings.name;
|
this.name = instanceSettings.name;
|
||||||
@@ -37,7 +37,7 @@ function (angular, _, dateMath) {
|
|||||||
this.zabbixCache = new ZabbixCache(this.zabbixAPI);
|
this.zabbixCache = new ZabbixCache(this.zabbixAPI);
|
||||||
|
|
||||||
// Initialize query builder
|
// Initialize query builder
|
||||||
this.queryBuilder = new QueryBuilder(this.zabbixCache);
|
this.queryProcessor = new QueryProcessor(this.zabbixCache);
|
||||||
|
|
||||||
console.log(this.zabbixCache);
|
console.log(this.zabbixCache);
|
||||||
|
|
||||||
@@ -47,7 +47,6 @@ function (angular, _, dateMath) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test connection to Zabbix API
|
* Test connection to Zabbix API
|
||||||
*
|
|
||||||
* @return {object} Connection status and Zabbix API version
|
* @return {object} Connection status and Zabbix API version
|
||||||
*/
|
*/
|
||||||
this.testDatasource = function() {
|
this.testDatasource = function() {
|
||||||
@@ -88,12 +87,8 @@ function (angular, _, dateMath) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query panel data. Calls for each panel in dashboard.
|
* Query panel data. Calls for each panel in dashboard.
|
||||||
*
|
* @param {Object} options Contains time range, targets and other info.
|
||||||
* @param {Object} options Query options. Contains time range, targets
|
* @return {Object} Grafana metrics object with timeseries data for each target.
|
||||||
* and other info.
|
|
||||||
*
|
|
||||||
* @return {Object} Grafana metrics object with timeseries data
|
|
||||||
* for each target.
|
|
||||||
*/
|
*/
|
||||||
this.query = function(options) {
|
this.query = function(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -122,7 +117,7 @@ function (angular, _, dateMath) {
|
|||||||
// Query numeric data
|
// Query numeric data
|
||||||
if (!target.mode || target.mode === 0) {
|
if (!target.mode || target.mode === 0) {
|
||||||
|
|
||||||
var items = self.queryBuilder.build(groupFilter, hostFilter, appFilter, itemFilter);
|
var items = self.queryProcessor.build(groupFilter, hostFilter, appFilter, itemFilter);
|
||||||
|
|
||||||
// Use alias only for single metric, otherwise use item names
|
// Use alias only for single metric, otherwise use item names
|
||||||
var alias;
|
var alias;
|
||||||
@@ -139,13 +134,13 @@ function (angular, _, dateMath) {
|
|||||||
// Use trends
|
// Use trends
|
||||||
var valueType = target.downsampleFunction ? target.downsampleFunction.value : "avg";
|
var valueType = target.downsampleFunction ? target.downsampleFunction.value : "avg";
|
||||||
getHistory = self.zabbixAPI.getTrends(items, from, to).then(function(history) {
|
getHistory = self.zabbixAPI.getTrends(items, from, to).then(function(history) {
|
||||||
return self.queryBuilder.handleTrends(history, addHostName, valueType);
|
return self.queryProcessor.handleTrends(history, addHostName, valueType);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Use history
|
// Use history
|
||||||
getHistory = self.zabbixAPI.getHistory(items, from, to).then(function(history) {
|
getHistory = self.zabbixAPI.getHistory(items, from, to).then(function(history) {
|
||||||
return self.queryBuilder.handleHistory(history, addHostName);
|
return self.queryProcessor.handleHistory(history, addHostName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ function (angular, _, utils) {
|
|||||||
|
|
||||||
var module = angular.module('grafana.services');
|
var module = angular.module('grafana.services');
|
||||||
|
|
||||||
module.factory('QueryBuilder', function() {
|
module.factory('QueryProcessor', function() {
|
||||||
|
|
||||||
function QueryBuilder(zabbixCacheInstance) {
|
function QueryProcessor(zabbixCacheInstance) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.cache = zabbixCacheInstance;
|
this.cache = zabbixCacheInstance;
|
||||||
@@ -205,7 +205,7 @@ function (angular, _, utils) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QueryBuilder;
|
return QueryProcessor;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user