mysql-connector: minor refactor

This commit is contained in:
Alexander Zobnin
2017-07-22 21:09:17 +03:00
parent 59bfacccbc
commit 0da9aefccc
8 changed files with 16 additions and 16 deletions

View File

@@ -372,7 +372,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
// Use history
if (_this2.enableDirectDBConnection) {
getHistoryPromise = _this2.zabbix.getHistory(items, timeFrom, timeTo, options).then(function (history) {
return _this2.zabbix.dbConnector.handleHistory(history, items);
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
});
} else {
getHistoryPromise = _this2.zabbix.getHistory(items, timeFrom, timeTo).then(function (history) {

File diff suppressed because one or more lines are too long

View File

@@ -71,11 +71,11 @@ System.register(['angular', 'lodash'], function (_export, _context) {
});
}
}, {
key: 'handleHistory',
value: function handleHistory(history, items) {
key: 'handleGrafanaTSResponse',
value: function handleGrafanaTSResponse(history, items) {
var addHostName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
return convertHistory(history, items, addHostName);
return convertGrafanaTSResponse(history, items, addHostName);
}
}, {
key: 'invokeSQLQuery',
@@ -113,7 +113,7 @@ System.register(['angular', 'lodash'], function (_export, _context) {
///////////////////////////////////////////////////////////////////////////////
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
var grafanaSeries = _.map(time_series, function (series) {
var itemid = series.name;

File diff suppressed because one or more lines are too long