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
a8e3f731
Commit
a8e3f731
authored
Jan 17, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(influxdb): began work on influxdb policy selector
parent
0cb68b86
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
1 deletions
+26
-1
public/app/plugins/datasource/influxdb/influx_query.ts
+1
-0
public/app/plugins/datasource/influxdb/partials/query.editor.html
+3
-0
public/app/plugins/datasource/influxdb/query_builder.js
+3
-0
public/app/plugins/datasource/influxdb/query_ctrl.js
+14
-0
public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts
+5
-1
No files found.
public/app/plugins/datasource/influxdb/influx_query.ts
View file @
a8e3f731
...
...
@@ -12,6 +12,7 @@ export default class InfluxQuery {
constructor
(
target
)
{
this
.
target
=
target
;
target
.
policy
=
target
.
policy
||
'default'
;
target
.
dsType
=
'influxdb'
;
target
.
resultFormat
=
target
.
resultFormat
||
'time_series'
;
target
.
tags
=
target
.
tags
||
[];
...
...
public/app/plugins/datasource/influxdb/partials/query.editor.html
View file @
a8e3f731
...
...
@@ -46,6 +46,9 @@
FROM
</li>
<li>
<metric-segment
segment=
"policySegment"
get-options=
"getPolicySegments()"
on-change=
"policyChanged()"
></metric-segment>
</li>
<li>
<metric-segment
segment=
"measurementSegment"
get-options=
"getMeasurements()"
on-change=
"measurementChanged()"
></metric-segment>
</li>
<li
class=
"tight-form-item query-keyword"
style=
"padding-left: 15px; padding-right: 15px;"
>
...
...
public/app/plugins/datasource/influxdb/query_builder.js
View file @
a8e3f731
...
...
@@ -62,6 +62,9 @@ function (_) {
}
else
if
(
type
===
'FIELDS'
)
{
query
=
'SHOW FIELD KEYS FROM "'
+
this
.
target
.
measurement
+
'"'
;
return
query
;
}
else
if
(
type
===
'RETENTION POLICIES'
)
{
query
=
'SHOW RETENTION POLICIES'
;
return
query
;
}
if
(
measurement
)
{
...
...
public/app/plugins/datasource/influxdb/query_ctrl.js
View file @
a8e3f731
...
...
@@ -28,6 +28,8 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) {
{
text
:
'Table'
,
value
:
'table'
},
];
$scope
.
policySegment
=
uiSegmentSrv
.
newSegment
(
$scope
.
target
.
policy
);
if
(
!
$scope
.
target
.
measurement
)
{
$scope
.
measurementSegment
=
uiSegmentSrv
.
newSelectMeasurement
();
}
else
{
...
...
@@ -131,6 +133,18 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) {
$scope
.
get_data
();
};
$scope
.
getPolicySegments
=
function
()
{
var
policiesQuery
=
$scope
.
queryBuilder
.
buildExploreQuery
(
'RETENTION POLICIES'
);
return
$scope
.
datasource
.
metricFindQuery
(
policiesQuery
)
.
then
(
$scope
.
transformToSegments
(
false
))
.
then
(
null
,
$scope
.
handleQueryError
);
};
$scope
.
policyChanged
=
function
()
{
$scope
.
target
.
policy
=
$scope
.
policySegment
.
value
;
$scope
.
get_data
();
};
$scope
.
toggleQueryMode
=
function
()
{
$scope
.
target
.
rawQuery
=
!
$scope
.
target
.
rawQuery
;
};
...
...
public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts
View file @
a8e3f731
...
...
@@ -70,6 +70,10 @@ describe('InfluxQueryBuilder', function() {
expect
(
query
).
to
.
be
(
'SHOW FIELD KEYS FROM "cpu"'
);
});
it
(
'should build show retention policies query'
,
function
()
{
var
builder
=
new
InfluxQueryBuilder
({
measurement
:
'cpu'
,
tags
:
[]});
var
query
=
builder
.
buildExploreQuery
(
'RETENTION POLICIES'
);
expect
(
query
).
to
.
be
(
'SHOW RETENTION POLICIES'
);
});
});
});
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