mysql-connector: minor refactor
This commit is contained in:
@@ -175,7 +175,7 @@ class ZabbixAPIDatasource {
|
||||
// Use history
|
||||
if (this.enableDirectDBConnection) {
|
||||
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo, options)
|
||||
.then(history => this.zabbix.dbConnector.handleHistory(history, items));
|
||||
.then(history => this.zabbix.dbConnector.handleGrafanaTSResponse(history, items));
|
||||
} else {
|
||||
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo)
|
||||
.then(history => responseHandler.handleHistory(history, items));
|
||||
|
||||
@@ -75,8 +75,8 @@ function ZabbixDBConnectorFactory(datasourceSrv, backendSrv) {
|
||||
});
|
||||
}
|
||||
|
||||
handleHistory(history, items, addHostName = true) {
|
||||
return convertHistory(history, items, addHostName);
|
||||
handleGrafanaTSResponse(history, items, addHostName = true) {
|
||||
return convertGrafanaTSResponse(history, items, addHostName);
|
||||
}
|
||||
|
||||
invokeSQLQuery(query) {
|
||||
@@ -115,7 +115,7 @@ angular
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function convertHistory(time_series, items, addHostName) {
|
||||
function convertGrafanaTSResponse(time_series, items, addHostName) {
|
||||
var hosts = _.uniqBy(_.flatten(_.map(items, 'hosts')), 'hostid'); //uniqBy is needed to deduplicate
|
||||
let grafanaSeries = _.map(time_series, series => {
|
||||
let itemid = series.name;
|
||||
|
||||
Reference in New Issue
Block a user