Commit 6c70122e by Adrien Samson

Add alignToFrom param to summarize

parent 6c83699e
......@@ -339,8 +339,12 @@ function (_) {
addFuncDef({
name: 'summarize',
category: categories.Transform,
params: [{ name: "interval", type: "string" }, { name: "func", type: "select", options: ['sum', 'avg', 'min', 'max', 'last'] }],
defaultParams: ['1h', 'sum']
params: [
{ name: "interval", type: "string" },
{ name: "func", type: "select", options: ['sum', 'avg', 'min', 'max', 'last'] },
{ name: "alignToFrom", type: "boolean", optional: true, options: ['false', 'true'] },
],
defaultParams: ['1h', 'sum', 'false']
});
addFuncDef({
......@@ -543,7 +547,7 @@ function (_) {
var parameters = _.map(this.params, function(value, index) {
var paramType = this.def.params[index].type;
if (paramType === 'int' || paramType === 'value_or_series') {
if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') {
return value;
}
......
......@@ -79,7 +79,7 @@ define([
var func = gfunc.createFuncInstance('summarize', { withDefaultParams: true });
func.updateParam('1h', 0);
expect(func.params[0]).to.be('1h');
expect(func.text).to.be('summarize(1h, sum)');
expect(func.text).to.be('summarize(1h, sum, false)');
});
it('should parse numbers as float', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment