mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter, Fixes #1207
This commit is contained in:
parent
3c1b30e3c1
commit
acd944a649
@ -2,6 +2,7 @@
|
||||
|
||||
**Fixes**
|
||||
- [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,7 +1,8 @@
|
||||
define([
|
||||
'lodash'
|
||||
'lodash',
|
||||
'jquery'
|
||||
],
|
||||
function (_) {
|
||||
function (_, $) {
|
||||
'use strict';
|
||||
|
||||
var index = [];
|
||||
@ -501,15 +502,15 @@ function (_) {
|
||||
addFuncDef({
|
||||
name: 'movingAverage',
|
||||
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]
|
||||
});
|
||||
|
||||
addFuncDef({
|
||||
name: 'movingMedian',
|
||||
category: categories.Filter,
|
||||
params: [{ name: "windowSize", type: "select", options: ['1min', '5min', '15min', '30min', '1hour'] }],
|
||||
defaultParams: ['1min']
|
||||
params: [{ name: "windowSize", type: "int_or_interval", options: ['5', '7', '10', '5min', '10min', '30min', '1hour'] }],
|
||||
defaultParams: ['5']
|
||||
});
|
||||
|
||||
addFuncDef({
|
||||
@ -595,6 +596,9 @@ function (_) {
|
||||
if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') {
|
||||
return value;
|
||||
}
|
||||
else if (paramType === 'int_or_interval' && $.isNumeric(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return "'" + value + "'";
|
||||
|
||||
|
@ -46,6 +46,18 @@ define([
|
||||
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() {
|
||||
var func = gfunc.createFuncInstance('groupByNode');
|
||||
func.params[0] = 5;
|
||||
|
Loading…
Reference in New Issue
Block a user