Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
9bdcc4ec
Commit
9bdcc4ec
authored
Apr 11, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
influxdb: holt winters edits
parents
0384eecf
cdfb24ab
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
25 deletions
+57
-25
pkg/tsdb/influxdb/query_part.go
+10
-1
public/app/core/components/query_part/query_part_editor.ts
+7
-5
public/app/plugins/datasource/influxdb/query_part.ts
+24
-3
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
+1
-2
tasks/options/exec.js
+2
-1
tasks/options/watch.js
+13
-13
No files found.
pkg/tsdb/influxdb/query_part.go
View file @
9bdcc4ec
...
...
@@ -32,6 +32,15 @@ func init() {
renders
[
"median"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
}
renders
[
"sum"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
}
renders
[
"holt_winters"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
,
Params
:
[]
DefinitionParameters
{{
Name
:
"number"
,
Type
:
"number"
},
{
Name
:
"season"
,
Type
:
"number"
}},
}
renders
[
"holt_winters_with_fit"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
,
Params
:
[]
DefinitionParameters
{{
Name
:
"number"
,
Type
:
"number"
},
{
Name
:
"season"
,
Type
:
"number"
}},
}
renders
[
"derivative"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
,
Params
:
[]
DefinitionParameters
{{
Name
:
"duration"
,
Type
:
"interval"
}},
...
...
@@ -49,7 +58,7 @@ func init() {
renders
[
"stddev"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
}
renders
[
"time"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
,
Params
:
[]
DefinitionParameters
{{
Name
:
"interval"
,
Type
:
"time"
}},
Params
:
[]
DefinitionParameters
{{
Name
:
"interval"
,
Type
:
"time"
}
,
{
Name
:
"offset"
,
Type
:
"time"
}
},
}
renders
[
"fill"
]
=
QueryDefinition
{
Renderer
:
functionRenderer
,
...
...
public/app/core/components/query_part/query_part_editor.ts
View file @
9bdcc4ec
...
...
@@ -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
,
...
...
public/app/plugins/datasource/influxdb/query_part.ts
View file @
9bdcc4ec
...
...
@@ -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'
,
...
...
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
View file @
9bdcc4ec
...
...
@@ -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"'
);
});
});
...
...
tasks/options/exec.js
View file @
9bdcc4ec
...
...
@@ -2,6 +2,7 @@ module.exports = function(config) {
'use strict'
return
{
tslint
:
"node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json"
,
tscompile
:
"node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics"
tscompile
:
"node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics"
,
tswatch
:
"node ./node_modules/typescript/lib/tsc.js -p tsconfig.json --diagnostics --watch"
,
};
};
tasks/options/watch.js
View file @
9bdcc4ec
...
...
@@ -54,19 +54,19 @@ module.exports = function(config, grunt) {
grunt
.
task
.
run
(
'css'
);
}
if
(
/
(\.
ts
)
$/
.
test
(
filepath
))
{
newPath
=
filepath
.
replace
(
/^public/
,
'public_gen'
);
grunt
.
log
.
writeln
(
'Copying to '
+
newPath
);
grunt
.
file
.
copy
(
filepath
,
newPath
);
// copy ts file also used by source maps
//changes changed file source to that of the changed file
grunt
.
config
(
'typescript.build.src'
,
filepath
);
grunt
.
config
(
'tslint.source.files.src'
,
filepath
);
grunt
.
task
.
run
(
'exec:tscompile'
);
grunt
.
task
.
run
(
'exec:tslint'
);
}
//
if (/(\.ts)$/.test(filepath)) {
//
newPath = filepath.replace(/^public/, 'public_gen');
//
grunt.log.writeln('Copying to ' + newPath);
//
grunt.file.copy(filepath, newPath);
//
//
// copy ts file also used by source maps
//
//changes changed file source to that of the changed file
//
grunt.config('typescript.build.src', filepath);
//
grunt.config('tslint.source.files.src', filepath);
//
//
grunt.task.run('exec:tscompile');
//
grunt.task.run('exec:tslint');
//
}
done
();
firstRun
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment