fix target backward compatibility

This commit is contained in:
Alexander Zobnin
2017-07-26 12:11:12 +03:00
parent 4020710d00
commit 39f4db5182
10 changed files with 32 additions and 13 deletions

View File

@@ -168,7 +168,7 @@ var ZabbixAPIDatasource = function () {
var useTrends = _this.isUseTrends(timeRange);
// Metrics or Text query mode
if (target.mode === c.MODE_METRICS || target.mode === c.MODE_TEXT || target.mode === c.MODE_ITEMID) {
if (!target.mode || target.mode === c.MODE_METRICS || target.mode === c.MODE_TEXT || target.mode === c.MODE_ITEMID) {
// Migrate old targets
target = migrations.migrate(target);

View File

@@ -29,7 +29,8 @@ var categories = {
Filter: [],
Trends: [],
Time: [],
Alias: []
Alias: [],
Special: []
};
function addFuncDef(funcDef) {
@@ -202,6 +203,14 @@ addFuncDef({
defaultParams: ['/(.*)/', '$1']
});
// Special
addFuncDef({
name: 'consolidateBy',
category: 'Special',
params: [{ name: 'type', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count'] }],
defaultParams: ['avg']
});
_lodash2.default.each(categories, function (funcList, catName) {
categories[catName] = _lodash2.default.sortBy(funcList, 'name');
});

View File

@@ -84,7 +84,7 @@ describe('ZabbixDatasource', function () {
ctx.ds.query(ctx.options);
// Check that useTrends options is true
expect(ctx.ds.queryNumericData).to.have.been.calledWith(defined, defined, true);
expect(ctx.ds.queryNumericData).to.have.been.calledWith(defined, defined, true, _sinon2.default.match.any);
});
done();
@@ -99,7 +99,7 @@ describe('ZabbixDatasource', function () {
ctx.ds.query(ctx.options);
// Check that useTrends options is false
expect(ctx.ds.queryNumericData).to.have.been.calledWith(defined, defined, false);
expect(ctx.ds.queryNumericData).to.have.been.calledWith(defined, defined, false, _sinon2.default.match.any);
});
done();
});