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
bba76cac
Commit
bba76cac
authored
Apr 21, 2014
by
Marco Vito Moscaritolo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added conditions management
parent
72ab721f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
21 deletions
+35
-21
src/app/partials/influxdb/editor.html
+28
-10
src/app/services/influxdb/influxdbDatasource.js
+7
-11
No files found.
src/app/partials/influxdb/editor.html
View file @
bba76cac
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
<li
ng-hide=
"target.rawQuery"
>
<li
ng-hide=
"target.rawQuery"
>
<input
type=
"text"
<input
type=
"text"
class=
"input-
medium
grafana-target-segment-input"
class=
"input-
small
grafana-target-segment-input"
ng-model=
"target.series"
ng-model=
"target.series"
spellcheck=
'false'
spellcheck=
'false'
bs-typeahead=
"listSeries"
bs-typeahead=
"listSeries"
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
<li
ng-hide=
"target.rawQuery"
>
<li
ng-hide=
"target.rawQuery"
>
<input
type=
"text"
<input
type=
"text"
class=
"input-
medium
grafana-target-segment-input"
class=
"input-
small
grafana-target-segment-input"
ng-model=
"target.column"
ng-model=
"target.column"
placeholder=
"value column"
placeholder=
"value column"
spellcheck=
'false'
spellcheck=
'false'
...
@@ -85,25 +85,43 @@
...
@@ -85,25 +85,43 @@
function
function
</li>
</li>
<li
ng-hide=
"target.rawQuery"
>
<li
ng-hide=
"target.rawQuery"
>
<select
class=
"input-
medium
grafana-target-segment-input"
<select
class=
"input-
small
grafana-target-segment-input"
ng-change=
"get_data()"
ng-change=
"get_data()"
ng-model=
"target.function"
ng-model=
"target.function"
ng-options=
"f for f in functions"
></select>
ng-options=
"f for f in functions"
></select>
</li>
</li>
<li
class=
"grafana-target-segment"
>
<li
ng-hide=
"target.rawQuery"
>
condition
<a
class=
"grafana-target-segment"
ng-click=
"target.condiction_filter = !target.condiction_filter; get_data();"
role=
"menuitem"
>
<i
class=
"icon-filter"
></i>
</a>
</li>
</li>
<li>
<li
ng-hide=
"target.rawQuery"
ng-show=
"target.condiction_filter"
>
<select
class=
"input-small grafana-target-segment-input"
ng-change=
"get_data()"
ng-model=
"target.condition_add"
ng-options=
"f for f in ['and', 'or']"
></select>
<input
type=
"text"
<input
type=
"text"
class=
"input-
medium
grafana-target-segment-input"
class=
"input-
small
grafana-target-segment-input"
ng-model=
"target.condition"
ng-model=
"target.condition
_key
"
placeholder=
"
value condition
"
placeholder=
"
key
"
spellcheck=
'false'
spellcheck=
'false'
bs-typeahead=
"listColumns"
bs-typeahead=
"listColumns"
data-min-length=
0
data-min-length=
0
ng-blur=
"get_data()"
>
ng-blur=
"get_data()"
>
<select
class=
"input-small grafana-target-segment-input"
ng-change=
"get_data()"
ng-model=
"target.condition_op"
ng-options=
"f for f in operators"
></select>
<input
type=
"text"
class=
"input-small grafana-target-segment-input"
ng-model=
"target.condition_value"
placeholder=
"value"
spellcheck=
'false'
data-min-length=
0
ng-blur=
"get_data()"
>
</li>
</li>
<li
class=
"grafana-target-segment"
ng-hide=
"target.rawQuery"
>
<li
class=
"grafana-target-segment"
ng-hide=
"target.rawQuery"
>
group by time
group by time
</li>
</li>
...
...
src/app/services/influxdb/influxdbDatasource.js
View file @
bba76cac
...
@@ -72,17 +72,19 @@ function (angular, _, kbn) {
...
@@ -72,17 +72,19 @@ function (angular, _, kbn) {
}
}
else
{
else
{
var
template
=
"select [[func]]([[column]]) as [[column]]_[[func]] from [[series]] "
+
var
template
=
"select [[func]]([[column]]) as [[column]]_[[func]] from [[series]] "
+
"where [[condition]] [[timeFilter]]"
+
"where [[timeFilter]] [[condition_add]] [[condition_key]] [[condition_op]] [[condition_value]] "
+
" group by time([[interval]]) order asc"
;
"group by time([[interval]]) order asc"
;
target
.
condition_joined
=
(
target
.
condition
!==
undefined
?
target
.
condition
+
' AND '
:
''
);
var
templateData
=
{
var
templateData
=
{
series
:
target
.
series
,
series
:
target
.
series
,
column
:
target
.
column
,
column
:
target
.
column
,
func
:
target
.
function
,
func
:
target
.
function
,
timeFilter
:
timeFilter
,
timeFilter
:
timeFilter
,
interval
:
target
.
interval
||
options
.
interval
interval
:
target
.
interval
||
options
.
interval
,
condition_add
:
target
.
condiction_filter
?
target
.
condition_add
:
''
,
condition_key
:
target
.
condiction_filter
?
target
.
condition_key
:
''
,
condition_op
:
target
.
condiction_filter
?
target
.
condition_op
:
''
,
condition_value
:
target
.
condiction_filter
?
target
.
condition_value
:
''
};
};
query
=
_
.
template
(
template
,
templateData
,
this
.
templateSettings
);
query
=
_
.
template
(
template
,
templateData
,
this
.
templateSettings
);
...
@@ -159,12 +161,6 @@ function (angular, _, kbn) {
...
@@ -159,12 +161,6 @@ function (angular, _, kbn) {
function
handleInfluxQueryResponse
(
data
)
{
function
handleInfluxQueryResponse
(
data
)
{
var
output
=
[];
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
(
data
,
function
(
series
)
{
_
.
each
(
data
,
function
(
series
)
{
var
timeCol
=
series
.
columns
.
indexOf
(
'time'
);
var
timeCol
=
series
.
columns
.
indexOf
(
'time'
);
...
...
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