Replace native map() and forEach() methods by lodash.
This commit is contained in:
4
dist/test/datasource-zabbix/dataProcessor.js
vendored
4
dist/test/datasource-zabbix/dataProcessor.js
vendored
@@ -275,14 +275,14 @@ function findNearestLeft(series, point) {
|
||||
|
||||
function timeShift(interval, range) {
|
||||
var shift = utils.parseTimeShiftInterval(interval) / 1000;
|
||||
return range.map(function (time) {
|
||||
return _lodash2.default.map(range, function (time) {
|
||||
return time - shift;
|
||||
});
|
||||
}
|
||||
|
||||
function unShiftTimeSeries(interval, datapoints) {
|
||||
var unshift = utils.parseTimeShiftInterval(interval);
|
||||
return datapoints.map(function (dp) {
|
||||
return _lodash2.default.map(datapoints, function (dp) {
|
||||
return [dp[0], dp[1] + unshift];
|
||||
});
|
||||
}
|
||||
|
||||
7
dist/test/datasource-zabbix/datasource.js
vendored
7
dist/test/datasource-zabbix/datasource.js
vendored
@@ -186,6 +186,9 @@ var ZabbixAPIDatasource = function () {
|
||||
return getHistoryPromise.then(function (timeseries_data) {
|
||||
return _this2.applyDataProcessingFunctions(timeseries_data, target);
|
||||
});
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
}, {
|
||||
@@ -460,7 +463,7 @@ var ZabbixAPIDatasource = function () {
|
||||
var _this7 = this;
|
||||
|
||||
var parts = ['group', 'host', 'application', 'item'];
|
||||
parts.forEach(function (p) {
|
||||
_lodash2.default.forEach(parts, function (p) {
|
||||
if (target[p] && target[p].filter) {
|
||||
target[p].filter = _this7.replaceTemplateVars(target[p].filter, options.scopedVars);
|
||||
}
|
||||
@@ -468,7 +471,7 @@ var ZabbixAPIDatasource = function () {
|
||||
target.textFilter = this.replaceTemplateVars(target.textFilter, options.scopedVars);
|
||||
|
||||
_lodash2.default.forEach(target.functions, function (func) {
|
||||
func.params = func.params.map(function (param) {
|
||||
func.params = _lodash2.default.map(func.params, function (param) {
|
||||
if (typeof param === 'number') {
|
||||
return +_this7.templateSrv.replace(param.toString(), options.scopedVars);
|
||||
} else {
|
||||
|
||||
@@ -218,7 +218,7 @@ function ZabbixAPIServiceFactory(alertSrv, zabbixAPICoreService) {
|
||||
return this.request('item.get', params).then(expandItems);
|
||||
|
||||
function expandItems(items) {
|
||||
items.forEach(function (item) {
|
||||
_lodash2.default.forEach(items, function (item) {
|
||||
item.item = item.name;
|
||||
item.name = utils.expandItemName(item.item, item.key_);
|
||||
return item;
|
||||
|
||||
@@ -83,6 +83,8 @@ var ZabbixAPICoreService = function () {
|
||||
|
||||
// Success
|
||||
return response.data.result;
|
||||
}).catch(function () {
|
||||
return Promise.reject(new ZabbixAPIError({ data: "Connection Error" }));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user