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
52177a45
Commit
52177a45
authored
Aug 31, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
influxdb: use paranthesis for influxdb queries in frontend query builder, #9131
parent
bdfbc245
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
public/app/plugins/datasource/influxdb/influx_query.ts
+5
-2
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
+5
-5
No files found.
public/app/plugins/datasource/influxdb/influx_query.ts
View file @
52177a45
...
...
@@ -229,8 +229,11 @@ export default class InfluxQuery {
return this.renderTagCondition(tag, index, interpolate);
});
query += conditions.join(' ');
query += (conditions.length > 0 ? ' AND ' : '') + '$timeFilter';
if (conditions.length > 0) {
query += '(' + conditions.join(' ') + ') AND ';
}
query += '$timeFilter';
var groupBySection = "";
for (i = 0; i < this.groupByParts.length; i++) {
...
...
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
View file @
52177a45
...
...
@@ -57,7 +57,7 @@ describe('InfluxQuery', function() {
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
"hostname" =
\'
server
\\\\
1
\'
AND $timeFilter'
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
("hostname" =
\'
server
\\\\
1
\'
)
AND $timeFilter'
+
' GROUP BY time($__interval)'
);
});
...
...
@@ -69,7 +69,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
"app" =~ /e.*/
AND $timeFilter GROUP BY time($__interval)'
);
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
("app" =~ /e.*/)
AND $timeFilter GROUP BY time($__interval)'
);
});
});
...
...
@@ -82,7 +82,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
"hostname" =
\'
server1
\'
AND "app" =
\'
email
\'
AND '
+
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
("hostname" =
\'
server1
\'
AND "app" =
\'
email
\'
)
AND '
+
'$timeFilter GROUP BY time($__interval)'
);
});
});
...
...
@@ -96,7 +96,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
"hostname" =
\'
server1
\'
OR "hostname" =
\'
server2
\'
AND '
+
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
("hostname" =
\'
server1
\'
OR "hostname" =
\'
server2
\'
)
AND '
+
'$timeFilter GROUP BY time($__interval)'
);
});
});
...
...
@@ -110,7 +110,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
"value" > 5
AND $timeFilter'
);
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE
("value" > 5)
AND $timeFilter'
);
});
});
...
...
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