refactor: move history calls to zabbix module

This commit is contained in:
Alexander Zobnin
2018-06-08 14:55:53 +03:00
parent 763b3a5f6e
commit 95bbede3da
5 changed files with 87 additions and 72 deletions

View File

@@ -40,6 +40,14 @@ function convertHistory(history, items, addHostName, convertPointCallback) {
});
}
function sortTimeseries(timeseries) {
// Sort trend data, issue #202
_.forEach(timeseries, series => {
series.datapoints = _.sortBy(series.datapoints, point => point[c.DATAPOINT_TS]);
});
return timeseries;
}
function handleHistory(history, items, addHostName = true) {
return convertHistory(history, items, addHostName, convertHistoryPoint);
}
@@ -211,13 +219,14 @@ function convertTrendPoint(valueType, point) {
}
export default {
handleHistory: handleHistory,
convertHistory: convertHistory,
handleTrends: handleTrends,
handleText: handleText,
handleHistoryAsTable: handleHistoryAsTable,
handleSLAResponse: handleSLAResponse,
handleTriggersResponse: handleTriggersResponse
handleHistory,
convertHistory,
handleTrends,
handleText,
handleHistoryAsTable,
handleSLAResponse,
handleTriggersResponse,
sortTimeseries
};
// Fix for backward compatibility with lodash 2.4