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
f5eb54e5
Commit
f5eb54e5
authored
Dec 14, 2015
by
carl bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(elasticsearch): only show pipeline agg for es version >= 2
parent
56c3dd36
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
4 deletions
+37
-4
public/app/plugins/datasource/elasticsearch/directives.js
+1
-0
public/app/plugins/datasource/elasticsearch/metric_agg.js
+1
-1
public/app/plugins/datasource/elasticsearch/partials/query.editor.html
+2
-1
public/app/plugins/datasource/elasticsearch/query_ctrl.js
+1
-0
public/app/plugins/datasource/elasticsearch/query_def.js
+12
-2
public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts
+20
-0
No files found.
public/app/plugins/datasource/elasticsearch/directives.js
View file @
f5eb54e5
...
@@ -30,6 +30,7 @@ function (angular) {
...
@@ -30,6 +30,7 @@ function (angular) {
index
:
"="
,
index
:
"="
,
onChange
:
"&"
,
onChange
:
"&"
,
getFields
:
"&"
,
getFields
:
"&"
,
esVersion
:
'='
}
}
};
};
});
});
...
...
public/app/plugins/datasource/elasticsearch/metric_agg.js
View file @
f5eb54e5
...
@@ -11,7 +11,7 @@ function (angular, _, queryDef) {
...
@@ -11,7 +11,7 @@ function (angular, _, queryDef) {
module
.
controller
(
'ElasticMetricAggCtrl'
,
function
(
$scope
,
uiSegmentSrv
,
$q
,
$rootScope
)
{
module
.
controller
(
'ElasticMetricAggCtrl'
,
function
(
$scope
,
uiSegmentSrv
,
$q
,
$rootScope
)
{
var
metricAggs
=
$scope
.
target
.
metrics
;
var
metricAggs
=
$scope
.
target
.
metrics
;
$scope
.
metricAggTypes
=
queryDef
.
metricAggTypes
;
$scope
.
metricAggTypes
=
queryDef
.
getMetricAggTypes
(
$scope
.
esVersion
)
;
$scope
.
extendedStats
=
queryDef
.
extendedStats
;
$scope
.
extendedStats
=
queryDef
.
extendedStats
;
$scope
.
pipelineAggOptions
=
[];
$scope
.
pipelineAggOptions
=
[];
...
...
public/app/plugins/datasource/elasticsearch/partials/query.editor.html
View file @
f5eb54e5
...
@@ -65,7 +65,8 @@
...
@@ -65,7 +65,8 @@
<elastic-metric-agg
<elastic-metric-agg
target=
"target"
index=
"$index"
target=
"target"
index=
"$index"
get-fields=
"getFields($fieldType)"
get-fields=
"getFields($fieldType)"
on-change=
"queryUpdated()"
>
on-change=
"queryUpdated()"
es-version=
"esVersion"
>
</elastic-metric-agg>
</elastic-metric-agg>
</div>
</div>
...
...
public/app/plugins/datasource/elasticsearch/query_ctrl.js
View file @
f5eb54e5
...
@@ -7,6 +7,7 @@ function (angular) {
...
@@ -7,6 +7,7 @@ function (angular) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'ElasticQueryCtrl'
,
function
(
$scope
,
$timeout
,
uiSegmentSrv
)
{
module
.
controller
(
'ElasticQueryCtrl'
,
function
(
$scope
,
$timeout
,
uiSegmentSrv
)
{
$scope
.
esVersion
=
$scope
.
datasource
.
esVersion
;
$scope
.
init
=
function
()
{
$scope
.
init
=
function
()
{
var
target
=
$scope
.
target
;
var
target
=
$scope
.
target
;
...
...
public/app/plugins/datasource/elasticsearch/query_def.js
View file @
f5eb54e5
...
@@ -14,8 +14,8 @@ function (_) {
...
@@ -14,8 +14,8 @@ function (_) {
{
text
:
"Extended Stats"
,
value
:
'extended_stats'
,
requiresField
:
true
,
supportsMissing
:
true
,
supportsInlineScript
:
true
},
{
text
:
"Extended Stats"
,
value
:
'extended_stats'
,
requiresField
:
true
,
supportsMissing
:
true
,
supportsInlineScript
:
true
},
{
text
:
"Percentiles"
,
value
:
'percentiles'
,
requiresField
:
true
,
supportsMissing
:
true
,
supportsInlineScript
:
true
},
{
text
:
"Percentiles"
,
value
:
'percentiles'
,
requiresField
:
true
,
supportsMissing
:
true
,
supportsInlineScript
:
true
},
{
text
:
"Unique Count"
,
value
:
"cardinality"
,
requiresField
:
true
,
supportsMissing
:
true
},
{
text
:
"Unique Count"
,
value
:
"cardinality"
,
requiresField
:
true
,
supportsMissing
:
true
},
{
text
:
"Moving Average"
,
value
:
'moving_avg'
,
requiresField
:
false
,
isPipelineAgg
:
true
},
{
text
:
"Moving Average"
,
value
:
'moving_avg'
,
requiresField
:
false
,
isPipelineAgg
:
true
,
minVersion
:
2
},
{
text
:
"Derivative"
,
value
:
'derivative'
,
requiresField
:
false
,
isPipelineAgg
:
true
},
{
text
:
"Derivative"
,
value
:
'derivative'
,
requiresField
:
false
,
isPipelineAgg
:
true
,
minVersion
:
2
},
{
text
:
"Raw Document"
,
value
:
"raw_document"
,
requiresField
:
false
}
{
text
:
"Raw Document"
,
value
:
"raw_document"
,
requiresField
:
false
}
],
],
...
@@ -76,6 +76,16 @@ function (_) {
...
@@ -76,6 +76,16 @@ function (_) {
'derivative'
:
[]
'derivative'
:
[]
},
},
getMetricAggTypes
:
function
(
esVersion
)
{
return
_
.
filter
(
this
.
metricAggTypes
,
function
(
f
)
{
if
(
f
.
minVersion
)
{
return
f
.
minVersion
<=
esVersion
;
}
else
{
return
true
;
}
});
},
getPipelineOptions
:
function
(
metric
)
{
getPipelineOptions
:
function
(
metric
)
{
if
(
!
this
.
isPipelineAgg
(
metric
.
type
))
{
if
(
!
this
.
isPipelineAgg
(
metric
.
type
))
{
return
[];
return
[];
...
...
public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts
View file @
f5eb54e5
...
@@ -79,4 +79,24 @@ describe('ElasticQueryDef', function() {
...
@@ -79,4 +79,24 @@ describe('ElasticQueryDef', function() {
});
});
});
});
});
});
describe
(
'pipeline aggs depending on esverison'
,
function
()
{
describe
(
'using esversion undefined'
,
function
()
{
it
(
'should not get pipeline aggs'
,
function
()
{
expect
(
QueryDef
.
getMetricAggTypes
(
undefined
).
length
).
to
.
be
(
9
);
});
});
describe
(
'using esversion 1'
,
function
()
{
it
(
'should not get pipeline aggs'
,
function
()
{
expect
(
QueryDef
.
getMetricAggTypes
(
1
).
length
).
to
.
be
(
9
);
});
});
describe
(
'using esversion 2'
,
function
()
{
it
(
'should get pipeline aggs'
,
function
()
{
expect
(
QueryDef
.
getMetricAggTypes
(
2
).
length
).
to
.
be
(
11
);
});
});
});
});
});
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