mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter, Fixes #1207
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
**Fixes**
|
**Fixes**
|
||||||
- [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled
|
- [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled
|
||||||
|
- [Issue #1207](https://github.com/grafana/grafana/issues/1207). Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter
|
||||||
|
|
||||||
# 1.9.0 (2014-12-02)
|
# 1.9.0 (2014-12-02)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
define([
|
define([
|
||||||
'lodash'
|
'lodash',
|
||||||
|
'jquery'
|
||||||
],
|
],
|
||||||
function (_) {
|
function (_, $) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var index = [];
|
var index = [];
|
||||||
@@ -501,15 +502,15 @@ function (_) {
|
|||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'movingAverage',
|
name: 'movingAverage',
|
||||||
category: categories.Filter,
|
category: categories.Filter,
|
||||||
params: [{ name: "window size", type: "int" }],
|
params: [{ name: "windowSize", type: "int_or_interval", options: ['5', '7', '10', '5min', '10min', '30min', '1hour'] }],
|
||||||
defaultParams: [10]
|
defaultParams: [10]
|
||||||
});
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
name: 'movingMedian',
|
name: 'movingMedian',
|
||||||
category: categories.Filter,
|
category: categories.Filter,
|
||||||
params: [{ name: "windowSize", type: "select", options: ['1min', '5min', '15min', '30min', '1hour'] }],
|
params: [{ name: "windowSize", type: "int_or_interval", options: ['5', '7', '10', '5min', '10min', '30min', '1hour'] }],
|
||||||
defaultParams: ['1min']
|
defaultParams: ['5']
|
||||||
});
|
});
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
@@ -595,6 +596,9 @@ function (_) {
|
|||||||
if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') {
|
if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
else if (paramType === 'int_or_interval' && $.isNumeric(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
return "'" + value + "'";
|
return "'" + value + "'";
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,18 @@ define([
|
|||||||
expect(func.render('hello')).to.equal("scaleToSeconds(hello, 1)");
|
expect(func.render('hello')).to.equal("scaleToSeconds(hello, 1)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle int or interval params with number', function() {
|
||||||
|
var func = gfunc.createFuncInstance('movingMedian');
|
||||||
|
func.params[0] = '5';
|
||||||
|
expect(func.render('hello')).to.equal("movingMedian(hello, 5)");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle int or interval params with interval string', function() {
|
||||||
|
var func = gfunc.createFuncInstance('movingMedian');
|
||||||
|
func.params[0] = '5min';
|
||||||
|
expect(func.render('hello')).to.equal("movingMedian(hello, '5min')");
|
||||||
|
});
|
||||||
|
|
||||||
it('should handle metric param and int param and string param', function() {
|
it('should handle metric param and int param and string param', function() {
|
||||||
var func = gfunc.createFuncInstance('groupByNode');
|
var func = gfunc.createFuncInstance('groupByNode');
|
||||||
func.params[0] = 5;
|
func.params[0] = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user