Commit 98f7febe by Torkel Ödegaard

feat(influxdb): added all functions

parent 4f04eaec
......@@ -85,6 +85,9 @@ class InfluxQuery {
if (partModel.def.category === categories.Aggregations) {
return false;
}
if (partModel.def.category === categories.Selectors) {
return false;
}
return true;
});
});
......
......@@ -5,6 +5,7 @@ import _ = require('lodash');
var index = [];
var categories = {
Aggregations: [],
Selectors: [],
Transformations: [],
Math: [],
Aliasing: [],
......@@ -91,6 +92,10 @@ function replaceAggregationAddStrategy(selectParts, partModel) {
selectParts[i] = partModel;
return;
}
if (part.def.category === categories.Selectors) {
selectParts[i] = partModel;
return;
}
}
selectParts.splice(1, 0, partModel);
......@@ -161,6 +166,34 @@ QueryPartDef.register({
renderer: fieldRenderer,
});
// Aggregations
QueryPartDef.register({
type: 'count',
addStrategy: replaceAggregationAddStrategy,
category: categories.Aggregations,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'distinct',
addStrategy: replaceAggregationAddStrategy,
category: categories.Aggregations,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'integral',
addStrategy: replaceAggregationAddStrategy,
category: categories.Aggregations,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'mean',
addStrategy: replaceAggregationAddStrategy,
......@@ -171,6 +204,15 @@ QueryPartDef.register({
});
QueryPartDef.register({
type: 'median',
addStrategy: replaceAggregationAddStrategy,
category: categories.Aggregations,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'sum',
addStrategy: replaceAggregationAddStrategy,
category: categories.Aggregations,
......@@ -179,6 +221,8 @@ QueryPartDef.register({
renderer: functionRenderer,
});
// transformations
QueryPartDef.register({
type: 'derivative',
addStrategy: addTransformationStrategy,
......@@ -189,6 +233,24 @@ QueryPartDef.register({
});
QueryPartDef.register({
type: 'non_negative_derivative',
addStrategy: addTransformationStrategy,
category: categories.Transformations,
params: [{ name: "duration", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h']}],
defaultParams: ['10s'],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'stddev',
addStrategy: addTransformationStrategy,
category: categories.Transformations,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'time',
category: groupByTimeFunctions,
params: [{ name: "interval", type: "time", options: ['auto', '1s', '10s', '1m', '5m', '10m', '15m', '1h'] }],
......@@ -204,6 +266,70 @@ QueryPartDef.register({
renderer: functionRenderer,
});
// Selectors
QueryPartDef.register({
type: 'bottom',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [{name: 'count', type: 'int'}],
defaultParams: [3],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'first',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'last',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'max',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'min',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [],
defaultParams: [],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'percentile',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [{name: 'nth', type: 'int'}],
defaultParams: [95],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'top',
addStrategy: replaceAggregationAddStrategy,
category: categories.Selectors,
params: [{name: 'count', type: 'int'}],
defaultParams: [3],
renderer: functionRenderer,
});
QueryPartDef.register({
type: 'tag',
category: groupByTimeFunctions,
......
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