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
c8c9e0a7
Commit
c8c9e0a7
authored
Dec 10, 2015
by
carl bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(elasticsearch): improve pipeline aggs structure
parent
0f65cb2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
public/app/plugins/datasource/elasticsearch/metric_agg.js
+5
-4
public/app/plugins/datasource/elasticsearch/partials/metricAgg.html
+12
-14
public/app/plugins/datasource/elasticsearch/query_def.js
+9
-8
No files found.
public/app/plugins/datasource/elasticsearch/metric_agg.js
View file @
c8c9e0a7
...
...
@@ -13,15 +13,12 @@ function (angular, _, queryDef) {
$scope
.
metricAggTypes
=
queryDef
.
metricAggTypes
;
$scope
.
extendedStats
=
queryDef
.
extendedStats
;
$scope
.
pipelineSettings
=
[];
$scope
.
pipelineAggOptions
=
[];
$scope
.
init
=
function
()
{
$scope
.
agg
=
metricAggs
[
$scope
.
index
];
$scope
.
validateModel
();
$scope
.
updatePipelineAggOptions
();
$scope
.
pipelineSettings
=
queryDef
.
getPipelineSettings
(
$scope
.
agg
);
};
$scope
.
updatePipelineAggOptions
=
function
()
{
...
...
@@ -44,7 +41,11 @@ function (angular, _, queryDef) {
$scope
.
agg
.
pipelineAgg
=
$scope
.
agg
.
pipelineAgg
||
'select metric'
;
$scope
.
agg
.
field
=
$scope
.
agg
.
pipelineAgg
;
$scope
.
settingsLinkText
=
'Options'
;
delete
$scope
.
agg
.
field
;
_
.
each
(
queryDef
.
getPipelineOptions
(
$scope
.
agg
),
function
(
opt
)
{
$scope
.
agg
.
settings
[
opt
.
text
]
=
$scope
.
agg
.
settings
[
opt
.
text
]
||
opt
.
default
;
});
}
else
if
(
!
$scope
.
agg
.
field
)
{
$scope
.
agg
.
field
=
'select field'
;
}
...
...
public/app/plugins/datasource/elasticsearch/partials/metricAgg.html
View file @
c8c9e0a7
...
...
@@ -34,9 +34,9 @@
<div
class=
"tight-form"
ng-if=
"showOptions"
>
<div
class=
"tight-form-inner-box"
>
<div
class=
"tight-form
la
st"
ng-if=
"agg.pipelineAgg !== undefined"
>
<div
class=
"tight-form
fir
st"
ng-if=
"agg.pipelineAgg !== undefined"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
>
<li
class=
"tight-form-item"
style=
"width: 75px;"
>
Based on
</li>
<li>
...
...
@@ -45,18 +45,16 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
ng-if=
"agg.pipelineAgg !== undefined"
>
<div
class=
"tight-form"
ng-repeat=
"setting in agg.pipelineSettings"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 100px"
>
{{stat.text}}
</li>
<li
class=
"tight-form-item last"
>
<editor-checkbox
text=
""
model=
"agg.meta.{{stat.value}}"
change=
"onChange()"
></editor-checkbox>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form last"
ng-if=
"agg.settings.window !== undefined"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 75px;"
>
Window
</li>
<li>
<input
type=
"number"
class=
"input-medium tight-form-input"
ng-change=
"onChangeInternal()"
ng-model=
"agg.settings.window"
blur=
"onChange()"
spellcheck=
'false'
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form last"
ng-if=
"agg.type === 'percentiles'"
>
<ul
class=
"tight-form-list"
>
...
...
public/app/plugins/datasource/elasticsearch/query_def.js
View file @
c8c9e0a7
...
...
@@ -68,24 +68,25 @@ function (_) {
{
text
:
'1d'
,
value
:
'1d'
},
],
pipeline
Aggs
:
[
'moving_avg'
,
'derivative'
],
pipelineSettings
:
{
'moving_avg'
:
[
'model'
,
'gap_policy'
,
'window'
,
'minimize'
],
pipeline
Options
:
{
'moving_avg'
:
[
{
text
:
'window'
,
default
:
5
}
],
'derivative'
:
[]
},
getPipeline
Setting
s
:
function
(
metric
)
{
if
(
this
.
isPipelineAgg
(
metric
)
===
false
)
{
getPipeline
Option
s
:
function
(
metric
)
{
if
(
!
this
.
isPipelineAgg
(
metric
)
)
{
return
[];
}
return
this
.
pipeline
Setting
s
[
metric
.
type
];
return
this
.
pipeline
Option
s
[
metric
.
type
];
},
isPipelineAgg
:
function
(
metric
)
{
if
(
metric
.
type
)
{
return
this
.
pipelineAggs
.
indexOf
(
metric
.
type
)
>
-
1
;
var
po
=
this
.
pipelineOptions
[
metric
.
type
];
return
po
!==
null
&&
po
!==
undefined
;
}
return
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