mysql-connector: imlement getTrends()

This commit is contained in:
Alexander Zobnin
2017-07-22 21:28:27 +03:00
parent 0da9aefccc
commit 75f041f841
12 changed files with 180 additions and 40 deletions

View File

@@ -215,19 +215,24 @@ var ZabbixAPIDatasource = function () {
options.consolidateBy = getConsolidateBy(target);
if (useTrends) {
var valueType = _this2.getTrendValueType(target);
getHistoryPromise = _this2.zabbix.getTrend(items, timeFrom, timeTo).then(function (history) {
return _responseHandler2.default.handleTrends(history, items, valueType);
}).then(function (timeseries) {
// Sort trend data, issue #202
_lodash2.default.forEach(timeseries, function (series) {
series.datapoints = _lodash2.default.sortBy(series.datapoints, function (point) {
return point[c.DATAPOINT_TS];
});
if (_this2.enableDirectDBConnection) {
getHistoryPromise = _this2.zabbix.getTrend(items, timeFrom, timeTo, options).then(function (history) {
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
});
return timeseries;
});
} else {
var valueType = _this2.getTrendValueType(target);
getHistoryPromise = _this2.zabbix.getTrend(items, timeFrom, timeTo).then(function (history) {
return _responseHandler2.default.handleTrends(history, items, valueType);
}).then(function (timeseries) {
// Sort trend data, issue #202
_lodash2.default.forEach(timeseries, function (series) {
series.datapoints = _lodash2.default.sortBy(series.datapoints, function (point) {
return point[c.DATAPOINT_TS];
});
});
return timeseries;
});
}
} else {
// Use history
if (_this2.enableDirectDBConnection) {