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
7d3146ed
Commit
7d3146ed
authored
Nov 05, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tablepanel): fixed header, and pagination styling
parent
0a1af65a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
13 deletions
+56
-13
public/app/panels/table/table_model.ts
+5
-0
public/app/plugins/datasource/elasticsearch/datasource.js
+3
-2
public/app/plugins/datasource/elasticsearch/metric_agg.js
+6
-2
public/app/plugins/datasource/elasticsearch/partials/metricAgg.html
+1
-1
public/app/plugins/datasource/elasticsearch/query_def.js
+9
-8
public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts
+32
-0
No files found.
public/app/panels/table/table_model.ts
View file @
7d3146ed
...
...
@@ -4,6 +4,11 @@ export class TableModel {
columns
:
any
[];
rows
:
any
[];
constructor
()
{
this
.
columns
=
[];
this
.
rows
=
[];
}
static
transform
(
data
,
panel
)
{
var
model
=
new
TableModel
();
...
...
public/app/plugins/datasource/elasticsearch/datasource.js
View file @
7d3146ed
...
...
@@ -170,7 +170,8 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
target
=
options
.
targets
[
i
];
if
(
target
.
hide
)
{
return
;}
var
esQuery
=
angular
.
toJson
(
this
.
queryBuilder
.
build
(
target
));
var
queryObj
=
this
.
queryBuilder
.
build
(
target
);
var
esQuery
=
angular
.
toJson
(
queryObj
);
var
luceneQuery
=
angular
.
toJson
(
target
.
query
||
'*'
);
// remove inner quotes
luceneQuery
=
luceneQuery
.
substr
(
1
,
luceneQuery
.
length
-
2
);
...
...
@@ -185,7 +186,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
payload
=
payload
.
replace
(
/
\$
timeTo/g
,
options
.
range
.
to
.
valueOf
());
payload
=
templateSrv
.
replace
(
payload
,
options
.
scopedVars
);
return
this
.
_post
(
'/_msearch
?search_type=count
'
,
payload
).
then
(
function
(
res
)
{
return
this
.
_post
(
'/_msearch'
,
payload
).
then
(
function
(
res
)
{
return
new
ElasticResponse
(
sentTargets
,
res
).
getTimeSeries
();
});
};
...
...
public/app/plugins/datasource/elasticsearch/metric_agg.js
View file @
7d3146ed
...
...
@@ -28,6 +28,7 @@ function (angular, _, queryDef) {
$scope
.
isFirst
=
$scope
.
index
===
0
;
$scope
.
isSingle
=
metricAggs
.
length
===
1
;
$scope
.
settingsLinkText
=
''
;
$scope
.
aggDef
=
_
.
findWhere
(
$scope
.
metricAggTypes
,
{
value
:
$scope
.
agg
.
type
});
if
(
!
$scope
.
agg
.
field
)
{
$scope
.
agg
.
field
=
'select field'
;
...
...
@@ -53,6 +54,11 @@ function (angular, _, queryDef) {
$scope
.
agg
.
meta
.
std_deviation_bounds_lower
=
true
;
$scope
.
agg
.
meta
.
std_deviation_bounds_upper
=
true
;
}
break
;
}
case
'raw_document'
:
{
$scope
.
target
.
metrics
=
[
$scope
.
agg
];
$scope
.
target
.
bucketAggs
=
[];
}
}
};
...
...
@@ -65,8 +71,6 @@ function (angular, _, queryDef) {
$scope
.
agg
.
settings
=
{};
$scope
.
agg
.
meta
=
{};
$scope
.
showOptions
=
false
;
$scope
.
validateModel
();
$scope
.
onChange
();
};
...
...
public/app/plugins/datasource/elasticsearch/partials/metricAgg.html
View file @
7d3146ed
...
...
@@ -6,7 +6,7 @@
<li>
<metric-segment-model
property=
"agg.type"
options=
"metricAggTypes"
on-change=
"onTypeChange()"
custom=
"false"
css-class=
"tight-form-item-large"
></metric-segment-model>
</li>
<li
ng-if=
"agg
.type !== 'count'
"
>
<li
ng-if=
"agg
Def.requiresField
"
>
<metric-segment-model
property=
"agg.field"
get-options=
"getFieldsInternal()"
on-change=
"onChange()"
css-class=
"tight-form-item-xxlarge"
></metric-segment>
</li>
<li
class=
"tight-form-item last"
ng-if=
"settingsLinkText"
>
...
...
public/app/plugins/datasource/elasticsearch/query_def.js
View file @
7d3146ed
...
...
@@ -6,14 +6,15 @@ function (_) {
return
{
metricAggTypes
:
[
{
text
:
"Count"
,
value
:
'count'
},
{
text
:
"Average"
,
value
:
'avg'
},
{
text
:
"Sum"
,
value
:
'sum'
},
{
text
:
"Max"
,
value
:
'max'
},
{
text
:
"Min"
,
value
:
'min'
},
{
text
:
"Extended Stats"
,
value
:
'extended_stats'
},
{
text
:
"Percentiles"
,
value
:
'percentiles'
},
{
text
:
"Unique Count"
,
value
:
"cardinality"
}
{
text
:
"Count"
,
value
:
'count'
,
requiresField
:
false
},
{
text
:
"Average"
,
value
:
'avg'
,
requiresField
:
true
},
{
text
:
"Sum"
,
value
:
'sum'
,
requiresField
:
true
},
{
text
:
"Max"
,
value
:
'max'
,
requiresField
:
true
},
{
text
:
"Min"
,
value
:
'min'
,
requiresField
:
true
},
{
text
:
"Extended Stats"
,
value
:
'extended_stats'
,
requiresField
:
true
},
{
text
:
"Percentiles"
,
value
:
'percentiles'
,
requiresField
:
true
},
{
text
:
"Unique Count"
,
value
:
"cardinality"
,
requiresField
:
true
},
{
text
:
"Raw Document"
,
value
:
"raw_document"
,
requiresField
:
false
}
],
bucketAggTypes
:
[
...
...
public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts
View file @
7d3146ed
...
...
@@ -80,4 +80,36 @@ describe('ElasticDatasource', function() {
expect
(
body
.
query
.
filtered
.
query
.
query_string
.
query
).
to
.
be
(
'escape
\\
:test'
);
});
});
describe
(
'When issueing document query'
,
function
()
{
var
requestOptions
,
parts
,
header
;
beforeEach
(
function
()
{
ctx
.
ds
=
new
ctx
.
service
({
url
:
'http://es.com'
,
index
:
'test'
,
jsonData
:
{}});
ctx
.
backendSrv
.
datasourceRequest
=
function
(
options
)
{
requestOptions
=
options
;
return
ctx
.
$q
.
when
({
data
:
{
responses
:
[]}});
};
ctx
.
ds
.
query
({
range
:
{
from
:
moment
([
2015
,
4
,
30
,
10
]),
to
:
moment
([
2015
,
5
,
1
,
10
])
},
targets
:
[{
bucketAggs
:
[],
metrics
:
[{
type
:
'raw_document'
}],
query
:
'test'
}]
});
ctx
.
$rootScope
.
$apply
();
parts
=
requestOptions
.
data
.
split
(
'
\
n'
);
header
=
angular
.
fromJson
(
parts
[
0
]);
});
it
(
'should set search type to query_then_fetch'
,
function
()
{
expect
(
header
.
search_type
).
to
.
eql
(
'query_then_fetch'
);
});
it
(
'should set size'
,
function
()
{
var
body
=
angular
.
fromJson
(
parts
[
1
]);
expect
(
body
.
query
.
size
).
to
.
be
(
500
);
});
});
});
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