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
150fd869
Commit
150fd869
authored
Jul 09, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finalized work on influxdb field and func selection, #2311
parent
50795adc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
public/app/plugins/datasource/influxdb/funcEditor.js
+1
-1
public/app/plugins/datasource/influxdb/partials/query.editor.html
+4
-1
public/app/plugins/datasource/influxdb/queryCtrl.js
+26
-1
No files found.
public/app/plugins/datasource/influxdb/funcEditor.js
View file @
150fd869
...
...
@@ -124,7 +124,7 @@ function (angular, _, $) {
function
addElementsAndCompile
()
{
$funcLink
.
appendTo
(
elem
);
var
$paramLink
=
$
(
'<a ng-click="" class="graphite-func-param-link">
value
</a>'
);
var
$paramLink
=
$
(
'<a ng-click="" class="graphite-func-param-link">
'
+
$scope
.
field
.
name
+
'
</a>'
);
var
$input
=
$
(
paramTemplate
);
$paramLink
.
appendTo
(
elem
);
...
...
public/app/plugins/datasource/influxdb/partials/query.editor.html
View file @
150fd869
...
...
@@ -66,9 +66,12 @@
SELECT
</li>
<li
class=
"dropdown"
ng-repeat=
"field in target.fields"
>
<span
influxdb-func-editor
field=
"field"
get-fields=
"getFields()"
on-change=
"
get_data(
)"
class=
"tight-form-item"
>
<span
influxdb-func-editor
field=
"field"
get-fields=
"getFields()"
on-change=
"
fieldChanged(field
)"
class=
"tight-form-item"
>
</span>
</li>
<li>
<metric-segment
segment=
"addFieldSegment"
get-alt-segments=
"getFieldSegments()"
on-value-changed=
"addField()"
></metric-segment>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
public/app/plugins/datasource/influxdb/queryCtrl.js
View file @
150fd869
...
...
@@ -27,6 +27,8 @@ function (angular, _, InfluxQueryBuilder) {
$scope
.
measurementSegment
=
new
MetricSegment
(
target
.
measurement
);
}
$scope
.
addFieldSegment
=
MetricSegment
.
newPlusButton
();
$scope
.
tagSegments
=
[];
_
.
each
(
target
.
tags
,
function
(
tag
)
{
if
(
tag
.
condition
)
{
...
...
@@ -92,7 +94,11 @@ function (angular, _, InfluxQueryBuilder) {
var
fieldsQuery
=
$scope
.
queryBuilder
.
buildExploreQuery
(
'FIELDS'
);
return
$scope
.
datasource
.
metricFindQuery
(
fieldsQuery
)
.
then
(
function
(
results
)
{
return
_
.
pluck
(
results
,
'text'
);
var
values
=
_
.
pluck
(
results
,
'text'
);
if
(
$scope
.
target
.
fields
.
length
>
1
)
{
values
.
splice
(
0
,
0
,
"-- remove from select --"
);
}
return
values
;
});
};
...
...
@@ -161,6 +167,25 @@ function (angular, _, InfluxQueryBuilder) {
.
then
(
null
,
$scope
.
handleQueryError
);
};
$scope
.
getFieldSegments
=
function
()
{
var
fieldsQuery
=
$scope
.
queryBuilder
.
buildExploreQuery
(
'FIELDS'
);
return
$scope
.
datasource
.
metricFindQuery
(
fieldsQuery
)
.
then
(
$scope
.
transformToSegments
)
.
then
(
null
,
$scope
.
handleQueryError
);
};
$scope
.
addField
=
function
()
{
$scope
.
target
.
fields
.
push
({
name
:
$scope
.
addFieldSegment
.
value
,
func
:
'mean'
});
_
.
extend
(
$scope
.
addFieldSegment
,
MetricSegment
.
newPlusButton
());
};
$scope
.
fieldChanged
=
function
(
field
)
{
if
(
field
.
name
===
'-- remove from select --'
)
{
$scope
.
target
.
fields
=
_
.
without
(
$scope
.
target
.
fields
,
field
);
}
$scope
.
get_data
();
};
$scope
.
getGroupByTagSegments
=
function
(
segment
)
{
var
query
=
$scope
.
queryBuilder
.
buildExploreQuery
(
'TAG_KEYS'
);
...
...
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