itemid-mode: minor refactor

This commit is contained in:
Alexander Zobnin
2017-07-26 11:16:07 +03:00
parent 3b1bc4d4a5
commit b23f6677dd
4 changed files with 83 additions and 43 deletions

View File

@@ -342,10 +342,22 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
return { data: data };
});
}
}, {
key: 'queryNumericData',
value: function queryNumericData(target, timeRange, useTrends, options) {
var _this2 = this;
var getItemOptions = {
itemtype: 'num'
};
return this.zabbix.getItemsFromTarget(target, getItemOptions).then(function (items) {
return _this2.queryNumericDataForItems(items, target, timeRange, useTrends, options);
});
}
}, {
key: 'queryNumericDataForItems',
value: function queryNumericDataForItems(items, target, timeRange, useTrends, options) {
var _this2 = this;
var _this3 = this;
var _timeRange = _slicedToArray(timeRange, 2),
timeFrom = _timeRange[0],
@@ -357,7 +369,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
if (useTrends) {
if (this.enableDirectDBConnection) {
getHistoryPromise = this.zabbix.getTrendsDB(items, timeFrom, timeTo, options).then(function (history) {
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
return _this3.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
});
} else {
var valueType = this.getTrendValueType(target);
@@ -377,7 +389,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
// Use history
if (this.enableDirectDBConnection) {
getHistoryPromise = this.zabbix.getHistoryDB(items, timeFrom, timeTo, options).then(function (history) {
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
return _this3.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
});
} else {
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo).then(function (history) {
@@ -387,7 +399,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
}
return getHistoryPromise.then(function (timeseries) {
return _this2.applyDataProcessingFunctions(timeseries, target);
return _this3.applyDataProcessingFunctions(timeseries, target);
}).then(function (timeseries) {
return downsampleSeries(timeseries, options);
}).catch(function (error) {
@@ -395,18 +407,6 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
return [];
});
}
}, {
key: 'queryNumericData',
value: function queryNumericData(target, timeRange, useTrends, options) {
var _this3 = this;
var getItemOptions = {
itemtype: 'num'
};
return this.zabbix.getItemsFromTarget(target, getItemOptions).then(function (items) {
return _this3.queryNumericDataForItems(items, target, timeRange, useTrends, options);
});
}
}, {
key: 'getTrendValueType',
value: function getTrendValueType(target) {