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
130eedc4
Commit
130eedc4
authored
Feb 12, 2019
by
Hugo Häggmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Found another input that was tied to a regexp
parent
5388541f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
public/app/core/components/RegExpSafeInput/RegExpSafeInput.tsx
+3
-4
public/app/core/components/TagFilter/TagFilter.tsx
+2
-1
No files found.
public/app/core/components/RegExpSafeInput/RegExpSafeInput.tsx
View file @
130eedc4
import
React
,
{
ChangeEvent
,
forwardRef
}
from
'react'
;
import
React
,
{
forwardRef
}
from
'react'
;
const
specialChars
=
[
'('
,
'['
,
'{'
,
'}'
,
']'
,
')'
,
'|'
,
'*'
,
'+'
,
'-'
,
'.'
,
'?'
,
'<'
,
'>'
,
'#'
,
'&'
,
'^'
,
'$'
];
export
const
escapeStringForRegex
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
value
=
event
.
target
.
value
;
export
const
escapeStringForRegex
=
(
value
:
string
)
=>
{
if
(
!
value
)
{
return
value
;
}
...
...
@@ -42,7 +41,7 @@ export const RegExpSafeInput = forwardRef<HTMLInputElement, Props>((props, ref)
type="text"
className={props.className}
value={unEscapeStringFromRegex(props.value)}
onChange={event => props.onChange(escapeStringForRegex(event))}
onChange={event => props.onChange(escapeStringForRegex(event
.target.value
))}
placeholder={props.placeholder ? props.placeholder : null}
/>
));
public/app/core/components/TagFilter/TagFilter.tsx
View file @
130eedc4
...
...
@@ -5,6 +5,7 @@ import AsyncSelect from '@torkelo/react-select/lib/Async';
import
{
TagOption
}
from
'./TagOption'
;
import
{
TagBadge
}
from
'./TagBadge'
;
import
{
components
}
from
'@torkelo/react-select'
;
import
{
escapeStringForRegex
}
from
'../RegExpSafeInput/RegExpSafeInput'
;
export
interface
Props
{
tags
:
string
[];
...
...
@@ -51,7 +52,7 @@ export class TagFilter extends React.Component<Props, any> {
value
:
tags
,
styles
:
resetSelectStyles
(),
filterOption
:
(
option
,
searchQuery
)
=>
{
const
regex
=
RegExp
(
searchQuery
,
'i'
);
const
regex
=
RegExp
(
escapeStringForRegex
(
searchQuery
)
,
'i'
);
return
regex
.
test
(
option
.
value
);
},
components
:
{
...
...
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