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
1adb7b28
Commit
1adb7b28
authored
Jan 18, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated
parent
a8e3f731
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
15 deletions
+11
-15
pkg/api/frontendsettings.go
+4
-0
public/app/plugins/datasource/influxdb/influx_query.ts
+1
-1
public/app/plugins/datasource/influxdb/query_builder.js
+3
-11
public/app/plugins/datasource/influxdb/query_ctrl.js
+1
-1
public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts
+2
-2
No files found.
pkg/api/frontendsettings.go
View file @
1adb7b28
...
@@ -89,6 +89,10 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
...
@@ -89,6 +89,10 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
dsMap
[
"index"
]
=
ds
.
Database
dsMap
[
"index"
]
=
ds
.
Database
}
}
if
ds
.
Type
==
m
.
DS_INFLUXDB
{
dsMap
[
"database"
]
=
ds
.
Database
}
if
ds
.
Type
==
m
.
DS_PROMETHEUS
{
if
ds
.
Type
==
m
.
DS_PROMETHEUS
{
// add unproxied server URL for link to Prometheus web UI
// add unproxied server URL for link to Prometheus web UI
dsMap
[
"directUrl"
]
=
ds
.
Url
dsMap
[
"directUrl"
]
=
ds
.
Url
...
...
public/app/plugins/datasource/influxdb/influx_query.ts
View file @
1adb7b28
...
@@ -179,7 +179,7 @@ export default class InfluxQuery {
...
@@ -179,7 +179,7 @@ export default class InfluxQuery {
var
measurement
=
target
.
measurement
;
var
measurement
=
target
.
measurement
;
if
(
!
measurement
.
match
(
'^/.*/'
)
&&
!
measurement
.
match
(
/^merge
\(
.*
\)
/
))
{
if
(
!
measurement
.
match
(
'^/.*/'
)
&&
!
measurement
.
match
(
/^merge
\(
.*
\)
/
))
{
measurement
=
'"'
+
measurement
+
'"'
;
measurement
=
'"'
+
measurement
+
'"'
;
}
}
query
+=
' FROM '
+
measurement
+
' WHERE '
;
query
+=
' FROM '
+
measurement
+
' WHERE '
;
...
...
public/app/plugins/datasource/influxdb/query_builder.js
View file @
1adb7b28
...
@@ -4,17 +4,9 @@ define([
...
@@ -4,17 +4,9 @@ define([
function
(
_
)
{
function
(
_
)
{
'use strict'
;
'use strict'
;
function
InfluxQueryBuilder
(
target
,
queryModel
)
{
function
InfluxQueryBuilder
(
target
,
database
)
{
this
.
target
=
target
;
this
.
target
=
target
;
this
.
model
=
queryModel
;
this
.
database
=
database
;
if
(
target
.
groupByTags
)
{
target
.
groupBy
=
[{
type
:
'time'
,
interval
:
'auto'
}];
for
(
var
i
in
target
.
groupByTags
)
{
target
.
groupBy
.
push
({
type
:
'tag'
,
key
:
target
.
groupByTags
[
i
]});
}
delete
target
.
groupByTags
;
}
}
}
function
renderTagCondition
(
tag
,
index
)
{
function
renderTagCondition
(
tag
,
index
)
{
...
@@ -63,7 +55,7 @@ function (_) {
...
@@ -63,7 +55,7 @@ function (_) {
query
=
'SHOW FIELD KEYS FROM "'
+
this
.
target
.
measurement
+
'"'
;
query
=
'SHOW FIELD KEYS FROM "'
+
this
.
target
.
measurement
+
'"'
;
return
query
;
return
query
;
}
else
if
(
type
===
'RETENTION POLICIES'
)
{
}
else
if
(
type
===
'RETENTION POLICIES'
)
{
query
=
'SHOW RETENTION POLICIES'
;
query
=
'SHOW RETENTION POLICIES
on "'
+
this
.
database
+
'"
'
;
return
query
;
return
query
;
}
}
...
...
public/app/plugins/datasource/influxdb/query_ctrl.js
View file @
1adb7b28
...
@@ -21,7 +21,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) {
...
@@ -21,7 +21,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) {
$scope
.
target
=
$scope
.
target
;
$scope
.
target
=
$scope
.
target
;
$scope
.
queryModel
=
new
InfluxQuery
(
$scope
.
target
);
$scope
.
queryModel
=
new
InfluxQuery
(
$scope
.
target
);
$scope
.
queryBuilder
=
new
InfluxQueryBuilder
(
$scope
.
target
);
$scope
.
queryBuilder
=
new
InfluxQueryBuilder
(
$scope
.
target
,
$scope
.
datasource
.
database
);
$scope
.
groupBySegment
=
uiSegmentSrv
.
newPlusButton
();
$scope
.
groupBySegment
=
uiSegmentSrv
.
newPlusButton
();
$scope
.
resultFormats
=
[
$scope
.
resultFormats
=
[
{
text
:
'Time series'
,
value
:
'time_series'
},
{
text
:
'Time series'
,
value
:
'time_series'
},
...
...
public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts
View file @
1adb7b28
...
@@ -71,9 +71,9 @@ describe('InfluxQueryBuilder', function() {
...
@@ -71,9 +71,9 @@ describe('InfluxQueryBuilder', function() {
});
});
it
(
'should build show retention policies query'
,
function
()
{
it
(
'should build show retention policies query'
,
function
()
{
var
builder
=
new
InfluxQueryBuilder
({
measurement
:
'cpu'
,
tags
:
[]});
var
builder
=
new
InfluxQueryBuilder
({
measurement
:
'cpu'
,
tags
:
[]}
,
'site'
);
var
query
=
builder
.
buildExploreQuery
(
'RETENTION POLICIES'
);
var
query
=
builder
.
buildExploreQuery
(
'RETENTION POLICIES'
);
expect
(
query
).
to
.
be
(
'SHOW RETENTION POLICIES'
);
expect
(
query
).
to
.
be
(
'SHOW RETENTION POLICIES
on "site"
'
);
});
});
});
});
});
});
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