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
9b415050
Commit
9b415050
authored
Nov 24, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(influxdb): minor progress on new editor
parent
c68cd7d1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
40 deletions
+23
-40
public/app/plugins/datasource/influxdb/datasource.js
+5
-4
public/app/plugins/datasource/influxdb/influx_query.ts
+2
-1
public/app/plugins/datasource/influxdb/partials/query.editor.html
+1
-30
public/app/plugins/datasource/influxdb/query_part.ts
+13
-4
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
+2
-1
No files found.
public/app/plugins/datasource/influxdb/datasource.js
View file @
9b415050
...
...
@@ -3,11 +3,11 @@ define([
'lodash'
,
'app/core/utils/datemath'
,
'./influx_series'
,
'./
query_builder
'
,
'./
influx_query
'
,
'./directives'
,
'./query_ctrl'
,
],
function
(
angular
,
_
,
dateMath
,
InfluxSeries
,
InfluxQuery
Builder
)
{
function
(
angular
,
_
,
dateMath
,
InfluxSeries
,
InfluxQuery
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
...
...
@@ -41,8 +41,9 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) {
queryTargets
.
push
(
target
);
// build query
var
queryBuilder
=
new
InfluxQueryBuilder
(
target
);
var
query
=
queryBuilder
.
build
();
var
queryModel
=
new
InfluxQuery
(
target
);
var
query
=
queryModel
.
render
();
console
.
log
(
query
);
query
=
query
.
replace
(
/
\$
interval/g
,
(
target
.
interval
||
options
.
interval
));
return
query
;
...
...
public/app/plugins/datasource/influxdb/influx_query.ts
View file @
9b415050
...
...
@@ -18,7 +18,8 @@ class InfluxQuery {
target
.
tags
=
target
.
tags
||
[];
target
.
groupBy
=
target
.
groupBy
||
[{
type
:
'time'
,
interval
:
'auto'
}];
target
.
select
=
target
.
select
||
[[
{
name
:
'mean'
,
params
:
[
'value'
]},
{
name
:
'field'
,
params
:
[
'value'
]},
{
name
:
'mean'
,
params
:
[]},
]];
this
.
updateSelectParts
();
...
...
public/app/plugins/datasource/influxdb/partials/query.editor.html
View file @
9b415050
...
...
@@ -87,42 +87,13 @@
<li>
<influx-query-part-editor
part=
"part"
class=
"tight-form-item tight-form-func"
></influx-query-part-editor>
</li>
<!-- <li class="dropdown" ng-if="groupBy.type === 'time'"> -->
<!-- <a class="tight-form-item pointer" data-toggle="dropdown" bs-tooltip="'Insert missing values, important when stacking'" data-placement="right"> -->
<!-- <span ng-show="target.fill"> -->
<!-- fill ({{target.fill}}) -->
<!-- </span> -->
<!-- <span ng-show="!target.fill"> -->
<!-- no fill -->
<!-- </span> -->
<!-- </a> -->
<!-- <ul class="dropdown-menu"> -->
<!-- <li><a ng-click="setFill('')">no fill</a></li> -->
<!-- <li><a ng-click="setFill('0')">fill (0)</a></li> -->
<!-- <li><a ng-click="setFill('null')">fill (null)</a></li> -->
<!-- <li><a ng-click="setFill('none')">fill (none)</a></li> -->
<!-- <li><a ng-click="setFill('previous')">fill (previous)</a></li> -->
<!-- </ul> -->
<!-- </li> -->
<!-- <li ng-if="groupBy.type === 'tag'"> -->
<!-- <metric-segment-model property="groupBy.key" get-options="getTagOptions()" on-change="get_data()"></metric-segment> -->
<!-- </li> -->
</ul>
<ul
class=
"tight-form-list pull-right"
>
<li
class=
"tight-form-item last"
ng-show=
"$index === 0"
>
<a
class=
"pointer"
ng-click=
"addGroupBy()"
><i
class=
"fa fa-plus"
></i></a>
</li>
<li
class=
"tight-form-item last"
ng-show=
"$index > 0"
>
<a
class=
"pointer"
ng-click=
"removeGroupBy($index)"
><i
class=
"fa fa-minus"
></i></a>
<li
class=
"dropdown"
dropdown-typeahead=
"groupByMenu"
dropdown-typeahead-on-select=
"groupByMenuAction(parts, $item, $subItem)"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item query-keyword tight-form-align"
style=
"width: 75px;"
>
...
...
public/app/plugins/datasource/influxdb/query_part.ts
View file @
9b415050
...
...
@@ -8,6 +8,7 @@ var categories = {
Transformations
:
[],
Math
:
[],
Aliasing
:
[],
Fields
:
[],
};
class
QueryPartDef
{
...
...
@@ -65,18 +66,26 @@ function quotedIdentityRenderer(part, innerExpr) {
}
QueryPartDef
.
register
({
name
:
'field'
,
category
:
categories
.
Fields
,
params
:
[{
type
:
'field'
}],
defaultParams
:
[
'value'
],
renderer
:
quotedIdentityRenderer
,
});
QueryPartDef
.
register
({
name
:
'mean'
,
category
:
categories
.
Aggregations
,
params
:
[
{
type
:
'field'
,
quote
:
'double'
}
],
defaultParams
:
[
'value'
],
params
:
[],
defaultParams
:
[],
renderer
:
functionRenderer
,
});
QueryPartDef
.
register
({
name
:
'sum'
,
category
:
categories
.
Aggregations
,
params
:
[
{
type
:
'field'
,
quote
:
'double'
}
],
defaultParams
:
[
'value'
],
params
:
[],
defaultParams
:
[],
renderer
:
functionRenderer
,
});
...
...
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
View file @
9b415050
...
...
@@ -21,7 +21,8 @@ describe.only('InfluxQuery', function() {
measurement
:
'cpu'
,
select
:
[
[
{
name
:
'mean'
,
params
:
[
'value'
]},
{
name
:
'field'
,
params
:
[
'value'
]},
{
name
:
'mean'
,
params
:
[]},
{
name
:
'math'
,
params
:
[
'/100'
]},
{
name
:
'alias'
,
params
:
[
'text'
]},
]
...
...
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