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
f065af32
Unverified
Commit
f065af32
authored
Nov 08, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix switching from es raw document metric breaks query editor
parent
dcb50150
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
+29
-2
public/app/plugins/datasource/elasticsearch/metric_agg.ts
+6
-0
public/app/plugins/datasource/elasticsearch/query_builder.ts
+2
-2
public/app/plugins/datasource/elasticsearch/query_ctrl.ts
+13
-0
public/app/plugins/datasource/elasticsearch/query_def.ts
+8
-0
No files found.
public/app/plugins/datasource/elasticsearch/metric_agg.ts
View file @
f065af32
...
@@ -160,6 +160,12 @@ export class ElasticMetricAggCtrl {
...
@@ -160,6 +160,12 @@ export class ElasticMetricAggCtrl {
$scope
.
agg
.
settings
=
{};
$scope
.
agg
.
settings
=
{};
$scope
.
agg
.
meta
=
{};
$scope
.
agg
.
meta
=
{};
$scope
.
showOptions
=
false
;
$scope
.
showOptions
=
false
;
// reset back to metric/group by query
if
(
$scope
.
target
.
bucketAggs
.
length
===
0
&&
$scope
.
agg
.
type
!==
'raw_document'
)
{
$scope
.
target
.
bucketAggs
=
[
queryDef
.
defaultBucketAgg
()];
}
$scope
.
updatePipelineAggOptions
();
$scope
.
updatePipelineAggOptions
();
$scope
.
onChange
();
$scope
.
onChange
();
};
};
...
...
public/app/plugins/datasource/elasticsearch/query_builder.ts
View file @
f065af32
...
@@ -181,8 +181,8 @@ export class ElasticQueryBuilder {
...
@@ -181,8 +181,8 @@ export class ElasticQueryBuilder {
build
(
target
,
adhocFilters
?,
queryString
?)
{
build
(
target
,
adhocFilters
?,
queryString
?)
{
// make sure query has defaults;
// make sure query has defaults;
target
.
metrics
=
target
.
metrics
||
[
{
type
:
'count'
,
id
:
'1'
}
];
target
.
metrics
=
target
.
metrics
||
[
queryDef
.
defaultMetricAgg
()
];
target
.
bucketAggs
=
target
.
bucketAggs
||
[
{
type
:
'date_histogram'
,
id
:
'2'
,
settings
:
{
interval
:
'auto'
}
}
];
target
.
bucketAggs
=
target
.
bucketAggs
||
[
queryDef
.
defaultBucketAgg
()
];
target
.
timeField
=
this
.
timeField
;
target
.
timeField
=
this
.
timeField
;
let
i
,
nestedAggs
,
metric
;
let
i
,
nestedAggs
,
metric
;
...
...
public/app/plugins/datasource/elasticsearch/query_ctrl.ts
View file @
f065af32
...
@@ -17,6 +17,19 @@ export class ElasticQueryCtrl extends QueryCtrl {
...
@@ -17,6 +17,19 @@ export class ElasticQueryCtrl extends QueryCtrl {
super
(
$scope
,
$injector
);
super
(
$scope
,
$injector
);
this
.
esVersion
=
this
.
datasource
.
esVersion
;
this
.
esVersion
=
this
.
datasource
.
esVersion
;
this
.
target
=
this
.
target
||
{};
this
.
target
.
metrics
=
this
.
target
.
metrics
||
[
queryDef
.
defaultMetricAgg
()];
this
.
target
.
bucketAggs
=
this
.
target
.
bucketAggs
||
[
queryDef
.
defaultBucketAgg
()];
if
(
this
.
target
.
bucketAggs
.
length
===
0
)
{
const
metric
=
this
.
target
.
metrics
[
0
];
if
(
!
metric
||
metric
.
type
!==
'raw_document'
)
{
this
.
target
.
bucketAggs
=
[
queryDef
.
defaultBucketAgg
()];
}
this
.
refresh
();
}
this
.
queryUpdated
();
this
.
queryUpdated
();
}
}
...
...
public/app/plugins/datasource/elasticsearch/query_def.ts
View file @
f065af32
...
@@ -228,3 +228,11 @@ export function describeOrderBy(orderBy, target) {
...
@@ -228,3 +228,11 @@ export function describeOrderBy(orderBy, target) {
return
'metric not found'
;
return
'metric not found'
;
}
}
}
}
export
function
defaultMetricAgg
()
{
return
{
type
:
'count'
,
id
:
'1'
};
}
export
function
defaultBucketAgg
()
{
return
{
type
:
'date_histogram'
,
id
:
'2'
,
settings
:
{
interval
:
'auto'
}
};
}
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