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
7e106b0f
Unverified
Commit
7e106b0f
authored
Jan 10, 2019
by
Torkel Ödegaard
Committed by
GitHub
Jan 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14805 from SamuelToh/11503_prevent_end_of_regexpr
11503: escape measurement filter regex value
parents
0f82fffe
9e3ab71e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
public/app/plugins/datasource/influxdb/query_builder.ts
+2
-1
public/app/plugins/datasource/influxdb/specs/query_builder.test.ts
+6
-0
No files found.
public/app/plugins/datasource/influxdb/query_builder.ts
View file @
7e106b0f
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
kbn
from
'app/core/utils/kbn'
;
function
renderTagCondition
(
tag
,
index
)
{
function
renderTagCondition
(
tag
,
index
)
{
let
str
=
''
;
let
str
=
''
;
...
@@ -43,7 +44,7 @@ export class InfluxQueryBuilder {
...
@@ -43,7 +44,7 @@ export class InfluxQueryBuilder {
}
else
if
(
type
===
'MEASUREMENTS'
)
{
}
else
if
(
type
===
'MEASUREMENTS'
)
{
query
=
'SHOW MEASUREMENTS'
;
query
=
'SHOW MEASUREMENTS'
;
if
(
withMeasurementFilter
)
{
if
(
withMeasurementFilter
)
{
query
+=
' WITH MEASUREMENT =~ /'
+
withMeasurementFilter
+
'/'
;
query
+=
' WITH MEASUREMENT =~ /'
+
kbn
.
regexEscape
(
withMeasurementFilter
)
+
'/'
;
}
}
}
else
if
(
type
===
'FIELDS'
)
{
}
else
if
(
type
===
'FIELDS'
)
{
measurement
=
this
.
target
.
measurement
;
measurement
=
this
.
target
.
measurement
;
...
...
public/app/plugins/datasource/influxdb/specs/query_builder.test.ts
View file @
7e106b0f
...
@@ -50,6 +50,12 @@ describe('InfluxQueryBuilder', () => {
...
@@ -50,6 +50,12 @@ describe('InfluxQueryBuilder', () => {
expect
(
query
).
toBe
(
'SHOW MEASUREMENTS WITH MEASUREMENT =~ /something/ LIMIT 100'
);
expect
(
query
).
toBe
(
'SHOW MEASUREMENTS WITH MEASUREMENT =~ /something/ LIMIT 100'
);
});
});
it
(
'should escape the regex value in measurement query'
,
()
=>
{
const
builder
=
new
InfluxQueryBuilder
({
measurement
:
''
,
tags
:
[]
});
const
query
=
builder
.
buildExploreQuery
(
'MEASUREMENTS'
,
undefined
,
'abc/edf/'
);
expect
(
query
).
toBe
(
'SHOW MEASUREMENTS WITH MEASUREMENT =~ /abc
\\
/edf
\\
// LIMIT 100'
);
});
it
(
'should have WITH MEASUREMENT WHERE in measurement query for non-empty query with tags'
,
()
=>
{
it
(
'should have WITH MEASUREMENT WHERE in measurement query for non-empty query with tags'
,
()
=>
{
const
builder
=
new
InfluxQueryBuilder
({
const
builder
=
new
InfluxQueryBuilder
({
measurement
:
''
,
measurement
:
''
,
...
...
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