mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
influxdb: holt winters edits
This commit is contained in:
@@ -91,7 +91,13 @@ export function queryPartEditorDirective($compile, templateSrv) {
|
||||
}
|
||||
|
||||
var typeaheadSource = function (query, callback) {
|
||||
if (param.options) { return param.options; }
|
||||
if (param.options) {
|
||||
var options = param.options;
|
||||
if (param.type === 'int') {
|
||||
options = _.map(options, function(val) { return val.toString(); });
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
$scope.$apply(function() {
|
||||
$scope.handleEvent({$event: {name: 'get-param-options'}}).then(function(result) {
|
||||
@@ -102,10 +108,6 @@ export function queryPartEditorDirective($compile, templateSrv) {
|
||||
};
|
||||
|
||||
$input.attr('data-provide', 'typeahead');
|
||||
var options = param.options;
|
||||
if (param.type === 'int') {
|
||||
options = _.map(options, function(val) { return val.toString(); });
|
||||
}
|
||||
|
||||
$input.typeahead({
|
||||
source: typeaheadSource,
|
||||
|
||||
@@ -15,6 +15,7 @@ var categories = {
|
||||
Aggregations: [],
|
||||
Selectors: [],
|
||||
Transformations: [],
|
||||
Predictors: [],
|
||||
Math: [],
|
||||
Aliasing: [],
|
||||
Fields: [],
|
||||
@@ -233,7 +234,7 @@ register({
|
||||
type: 'moving_average',
|
||||
addStrategy: addTransformationStrategy,
|
||||
category: categories.Transformations,
|
||||
params: [{ name: "window", type: "number", options: [5, 10, 20, 30, 40]}],
|
||||
params: [{ name: "window", type: "int", options: [5, 10, 20, 30, 40]}],
|
||||
defaultParams: [10],
|
||||
renderer: functionRenderer,
|
||||
});
|
||||
@@ -259,8 +260,8 @@ register({
|
||||
register({
|
||||
type: 'time',
|
||||
category: groupByTimeFunctions,
|
||||
params: [{ name: "interval", type: "time", options: ['auto', '1s', '10s', '1m', '5m', '10m', '15m', '1h'] }],
|
||||
defaultParams: ['auto'],
|
||||
params: [{ name: "interval", type: "time", options: ['$__interval', '1s', '10s', '1m', '5m', '10m', '15m', '1h']}],
|
||||
defaultParams: ['$__interval'],
|
||||
renderer: functionRenderer,
|
||||
});
|
||||
|
||||
@@ -281,6 +282,26 @@ register({
|
||||
renderer: functionRenderer,
|
||||
});
|
||||
|
||||
// predictions
|
||||
register({
|
||||
type: 'holt_winters',
|
||||
addStrategy: addTransformationStrategy,
|
||||
category: categories.Predictors,
|
||||
params: [{ name: "number", type: "int", options: [5, 10, 20, 30, 40]}, { name: "season", type: "int", options: [0, 1, 2, 5, 10]}],
|
||||
defaultParams: [10, 2],
|
||||
renderer: functionRenderer,
|
||||
});
|
||||
|
||||
debugger;
|
||||
register({
|
||||
type: 'holt_winters_with_fit',
|
||||
addStrategy: addTransformationStrategy,
|
||||
category: categories.Predictors,
|
||||
params: [{ name: "number", type: "int", options: [5, 10, 20, 30, 40]}, { name: "season", type: "int", options: [0, 1, 2, 5, 10]}],
|
||||
defaultParams: [10, 2],
|
||||
renderer: functionRenderer,
|
||||
});
|
||||
|
||||
// Selectors
|
||||
register({
|
||||
type: 'bottom',
|
||||
|
||||
@@ -123,8 +123,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter ' +
|
||||
'GROUP BY time($__interval), "host"');
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval), "host"');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user