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
f122da58
Commit
f122da58
authored
Apr 21, 2014
by
Marco Vito Moscaritolo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support to coustom where conditions
parent
69b91892
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
src/app/controllers/influxTargetCtrl.js
+1
-2
src/app/partials/influxdb/editor.html
+17
-1
src/app/services/influxdb/influxdbDatasource.js
+12
-2
No files found.
src/app/controllers/influxTargetCtrl.js
View file @
f122da58
...
...
@@ -64,4 +64,4 @@ function (angular) {
});
});
\ No newline at end of file
});
src/app/partials/influxdb/editor.html
View file @
f122da58
...
...
@@ -74,7 +74,23 @@
function
</li>
<li>
<select
class=
"input-medium grafana-target-segment-input"
ng-change=
"get_data()"
ng-model=
"target.function"
ng-options=
"f for f in ['mean', 'sum', 'min', 'max', 'median', 'derivative', 'stddev']"
></select>
<select
class=
"input-medium grafana-target-segment-input"
ng-change=
"get_data()"
ng-model=
"target.function"
ng-options=
"f for f in functions"
></select>
</li>
<li
class=
"grafana-target-segment"
>
condition
</li>
<li>
<input
type=
"text"
class=
"input-medium grafana-target-segment-input"
ng-model=
"target.condition"
placeholder=
"value condition"
spellcheck=
'false'
bs-typeahead=
"listColumns"
data-min-length=
0
ng-blur=
"get_data()"
>
</li>
<li
class=
"grafana-target-segment"
>
group by time
...
...
src/app/services/influxdb/influxdbDatasource.js
View file @
f122da58
...
...
@@ -30,12 +30,16 @@ function (angular, _, kbn) {
return
[];
}
var
template
=
"select [[func]]([[column]]) from [[series]] where [[timeFilter]] group by time([[interval]]) order asc"
;
// var template = "select [[func]]([[column]]) as [[column]]_[[func]] from [[series]] where [[timeFilter]] group by time([[interval]]) order asc";
var
template
=
"select [[func]]([[column]]) from [[series]] where [[condition]] [[timeFilter]] group by time([[interval]]) order asc"
;
target
.
condition_joined
=
(
target
.
condition
!==
undefined
?
target
.
condition
+
' AND '
:
''
);
var
templateData
=
{
series
:
target
.
series
,
column
:
target
.
column
,
func
:
target
.
function
,
condition
:
target
.
condition_joined
,
timeFilter
:
getTimeFilter
(
options
),
interval
:
target
.
interval
||
options
.
interval
};
...
...
@@ -96,6 +100,12 @@ function (angular, _, kbn) {
function
handleInfluxQueryResponse
(
results
)
{
var
output
=
[];
var
getKey
=
function
(
str
)
{
var
key1
=
str
.
split
(
' where '
);
var
key2
=
key1
[
1
].
split
(
' AND '
);
return
(
key2
[
0
]
!==
key1
[
1
]
?
'.'
+
key2
[
0
]
:
''
);
}
_
.
each
(
results
.
data
,
function
(
series
)
{
var
timeCol
=
series
.
columns
.
indexOf
(
'time'
);
...
...
@@ -106,7 +116,7 @@ function (angular, _, kbn) {
console
.
log
(
"series:"
+
series
.
name
+
": "
+
series
.
points
.
length
+
" points"
);
var
target
=
series
.
name
+
"."
+
column
;
var
target
=
series
.
name
+
"."
+
column
+
getKey
(
results
.
config
.
params
.
q
)
;
var
datapoints
=
[];
for
(
var
i
=
0
;
i
<
series
.
points
.
length
;
i
++
)
{
...
...
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