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
d16b3488
Unverified
Commit
d16b3488
authored
Dec 03, 2018
by
Torkel Ödegaard
Committed by
GitHub
Dec 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14257 from grafana/davkal/fix-14250
Explore: Fix logging query parser for regex with quantifiers
parents
246c1ca7
11a53763
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
public/app/plugins/datasource/logging/query_utils.test.ts
+11
-0
public/app/plugins/datasource/logging/query_utils.ts
+2
-2
No files found.
public/app/plugins/datasource/logging/query_utils.test.ts
View file @
d16b3488
...
...
@@ -42,4 +42,15 @@ describe('parseQuery', () => {
regexp
:
''
,
});
});
it
(
'returns query and regexp with quantifiers'
,
()
=>
{
expect
(
parseQuery
(
'{foo="bar"}
\\
.java:[0-9]{1,5}'
)).
toEqual
({
query
:
'{foo="bar"}'
,
regexp
:
'
\\
.java:[0-9]{1,5}'
,
});
expect
(
parseQuery
(
'
\\
.java:[0-9]{1,5} {foo="bar"}'
)).
toEqual
({
query
:
'{foo="bar"}'
,
regexp
:
'
\\
.java:[0-9]{1,5}'
,
});
});
});
public/app/plugins/datasource/logging/query_utils.ts
View file @
d16b3488
const
selectorRegexp
=
/{
[^
{
]
*}/g
;
const
selectorRegexp
=
/
(?:
^|
\s)
{
[^
{
]
*}/g
;
export
function
parseQuery
(
input
:
string
)
{
const
match
=
input
.
match
(
selectorRegexp
);
let
query
=
''
;
let
regexp
=
input
;
if
(
match
)
{
query
=
match
[
0
];
query
=
match
[
0
]
.
trim
()
;
regexp
=
input
.
replace
(
selectorRegexp
,
''
).
trim
();
}
...
...
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