fix target backward compatibility
This commit is contained in:
2
dist/datasource-zabbix/datasource.js
vendored
2
dist/datasource-zabbix/datasource.js
vendored
@@ -315,7 +315,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
var useTrends = _this.isUseTrends(timeRange);
|
var useTrends = _this.isUseTrends(timeRange);
|
||||||
|
|
||||||
// Metrics or Text query mode
|
// 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
|
// Migrate old targets
|
||||||
target = migrations.migrate(target);
|
target = migrations.migrate(target);
|
||||||
|
|
||||||
|
|||||||
2
dist/datasource-zabbix/datasource.js.map
vendored
2
dist/datasource-zabbix/datasource.js.map
vendored
File diff suppressed because one or more lines are too long
11
dist/datasource-zabbix/metricFunctions.js
vendored
11
dist/datasource-zabbix/metricFunctions.js
vendored
@@ -80,7 +80,8 @@ System.register(['lodash', 'jquery'], function (_export, _context) {
|
|||||||
Filter: [],
|
Filter: [],
|
||||||
Trends: [],
|
Trends: [],
|
||||||
Time: [],
|
Time: [],
|
||||||
Alias: []
|
Alias: [],
|
||||||
|
Special: []
|
||||||
};
|
};
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'groupBy',
|
name: 'groupBy',
|
||||||
@@ -239,6 +240,14 @@ System.register(['lodash', 'jquery'], function (_export, _context) {
|
|||||||
defaultParams: ['/(.*)/', '$1']
|
defaultParams: ['/(.*)/', '$1']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Special
|
||||||
|
addFuncDef({
|
||||||
|
name: 'consolidateBy',
|
||||||
|
category: 'Special',
|
||||||
|
params: [{ name: 'type', type: 'string', options: ['avg', 'min', 'max', 'sum', 'count'] }],
|
||||||
|
defaultParams: ['avg']
|
||||||
|
});
|
||||||
|
|
||||||
_.each(categories, function (funcList, catName) {
|
_.each(categories, function (funcList, catName) {
|
||||||
categories[catName] = _.sortBy(funcList, 'name');
|
categories[catName] = _.sortBy(funcList, 'name');
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -69,7 +69,7 @@ describe('ZabbixDatasource', () => {
|
|||||||
|
|
||||||
// Check that useTrends options is true
|
// Check that useTrends options is true
|
||||||
expect(ctx.ds.queryNumericData)
|
expect(ctx.ds.queryNumericData)
|
||||||
.to.have.been.calledWith(defined, defined, true);
|
.to.have.been.calledWith(defined, defined, true, sinon.match.any);
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
@@ -85,7 +85,7 @@ describe('ZabbixDatasource', () => {
|
|||||||
|
|
||||||
// Check that useTrends options is false
|
// Check that useTrends options is false
|
||||||
expect(ctx.ds.queryNumericData)
|
expect(ctx.ds.queryNumericData)
|
||||||
.to.have.been.calledWith(defined, defined, false);
|
.to.have.been.calledWith(defined, defined, false, sinon.match.any);
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
2
dist/test/datasource-zabbix/datasource.js
vendored
2
dist/test/datasource-zabbix/datasource.js
vendored
@@ -168,7 +168,7 @@ var ZabbixAPIDatasource = function () {
|
|||||||
var useTrends = _this.isUseTrends(timeRange);
|
var useTrends = _this.isUseTrends(timeRange);
|
||||||
|
|
||||||
// Metrics or Text query mode
|
// 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
|
// Migrate old targets
|
||||||
target = migrations.migrate(target);
|
target = migrations.migrate(target);
|
||||||
|
|
||||||
|
|||||||
11
dist/test/datasource-zabbix/metricFunctions.js
vendored
11
dist/test/datasource-zabbix/metricFunctions.js
vendored
@@ -29,7 +29,8 @@ var categories = {
|
|||||||
Filter: [],
|
Filter: [],
|
||||||
Trends: [],
|
Trends: [],
|
||||||
Time: [],
|
Time: [],
|
||||||
Alias: []
|
Alias: [],
|
||||||
|
Special: []
|
||||||
};
|
};
|
||||||
|
|
||||||
function addFuncDef(funcDef) {
|
function addFuncDef(funcDef) {
|
||||||
@@ -202,6 +203,14 @@ addFuncDef({
|
|||||||
defaultParams: ['/(.*)/', '$1']
|
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) {
|
_lodash2.default.each(categories, function (funcList, catName) {
|
||||||
categories[catName] = _lodash2.default.sortBy(funcList, 'name');
|
categories[catName] = _lodash2.default.sortBy(funcList, 'name');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ describe('ZabbixDatasource', function () {
|
|||||||
ctx.ds.query(ctx.options);
|
ctx.ds.query(ctx.options);
|
||||||
|
|
||||||
// Check that useTrends options is true
|
// 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();
|
done();
|
||||||
@@ -99,7 +99,7 @@ describe('ZabbixDatasource', function () {
|
|||||||
ctx.ds.query(ctx.options);
|
ctx.ds.query(ctx.options);
|
||||||
|
|
||||||
// Check that useTrends options is false
|
// 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();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ class ZabbixAPIDatasource {
|
|||||||
let useTrends = this.isUseTrends(timeRange);
|
let useTrends = this.isUseTrends(timeRange);
|
||||||
|
|
||||||
// Metrics or Text query mode
|
// 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
|
// Migrate old targets
|
||||||
target = migrations.migrate(target);
|
target = migrations.migrate(target);
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ describe('ZabbixDatasource', () => {
|
|||||||
|
|
||||||
// Check that useTrends options is true
|
// Check that useTrends options is true
|
||||||
expect(ctx.ds.queryNumericData)
|
expect(ctx.ds.queryNumericData)
|
||||||
.to.have.been.calledWith(defined, defined, true);
|
.to.have.been.calledWith(defined, defined, true, sinon.match.any);
|
||||||
});
|
});
|
||||||
|
|
||||||
done();
|
done();
|
||||||
@@ -85,7 +85,7 @@ describe('ZabbixDatasource', () => {
|
|||||||
|
|
||||||
// Check that useTrends options is false
|
// Check that useTrends options is false
|
||||||
expect(ctx.ds.queryNumericData)
|
expect(ctx.ds.queryNumericData)
|
||||||
.to.have.been.calledWith(defined, defined, false);
|
.to.have.been.calledWith(defined, defined, false, sinon.match.any);
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user