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
d563505d
Commit
d563505d
authored
Mar 25, 2019
by
Hugo Häggmark
Committed by
Hugo Häggmark
Mar 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: added missing event to function signature
Fixes: #16055
parent
e578e8d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
public/app/features/explore/QueryField.tsx
+21
-12
No files found.
public/app/features/explore/QueryField.tsx
View file @
d563505d
// @ts-ignore
import
_
from
'lodash'
;
import
React
from
'react'
;
import
React
,
{
Context
}
from
'react'
;
import
ReactDOM
from
'react-dom'
;
// @ts-ignore
import
{
Change
,
Value
}
from
'slate'
;
// @ts-ignore
import
{
Editor
}
from
'slate-react'
;
// @ts-ignore
import
Plain
from
'slate-plain-serializer'
;
import
classnames
from
'classnames'
;
...
...
@@ -75,7 +79,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
resetTimer
:
any
;
mounted
:
boolean
;
constructor
(
props
:
QueryFieldProps
,
context
)
{
constructor
(
props
:
QueryFieldProps
,
context
:
Context
<
any
>
)
{
super
(
props
,
context
);
this
.
placeholdersBuffer
=
new
PlaceholdersBuffer
(
props
.
initialQuery
||
''
);
...
...
@@ -137,7 +141,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
}
onChange
=
({
value
},
invokeParentOnValueChanged
?:
boolean
)
=>
{
onChange
=
({
value
}
:
Change
,
invokeParentOnValueChanged
?:
boolean
)
=>
{
const
documentChanged
=
value
.
document
!==
this
.
state
.
value
.
document
;
const
prevValue
=
this
.
state
.
value
;
...
...
@@ -227,7 +231,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
if
(
!
group
.
skipSort
)
{
group
.
items
=
_
.
sortBy
(
group
.
items
,
item
=>
item
.
sortText
||
item
.
label
);
group
.
items
=
_
.
sortBy
(
group
.
items
,
(
item
:
CompletionItem
)
=>
item
.
sortText
||
item
.
label
);
}
}
return
group
;
...
...
@@ -294,7 +298,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
.
focus
();
}
handleEnterAndTabKey
=
change
=>
{
handleEnterAndTabKey
=
(
event
:
KeyboardEvent
,
change
:
Change
)
=>
{
const
{
typeaheadIndex
,
suggestions
}
=
this
.
state
;
if
(
this
.
menuEl
)
{
// Dont blur input
...
...
@@ -306,7 +310,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
const
suggestion
=
getSuggestionByIndex
(
suggestions
,
typeaheadIndex
);
const
nextChange
=
this
.
applyTypeahead
(
change
,
suggestion
);
const
insertTextOperation
=
nextChange
.
operations
.
find
(
operation
=>
operation
.
type
===
'insert_text'
);
const
insertTextOperation
=
nextChange
.
operations
.
find
(
(
operation
:
any
)
=>
operation
.
type
===
'insert_text'
);
if
(
insertTextOperation
)
{
const
suggestionText
=
insertTextOperation
.
text
;
this
.
placeholdersBuffer
.
setNextPlaceholderValue
(
suggestionText
);
...
...
@@ -323,7 +327,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
};
onKeyDown
=
(
event
,
c
hange
)
=>
{
onKeyDown
=
(
event
:
KeyboardEvent
,
change
:
C
hange
)
=>
{
const
{
typeaheadIndex
}
=
this
.
state
;
switch
(
event
.
key
)
{
...
...
@@ -347,7 +351,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
case
'Enter'
:
case
'Tab'
:
{
return
this
.
handleEnterAndTabKey
(
change
);
return
this
.
handleEnterAndTabKey
(
event
,
change
);
break
;
}
...
...
@@ -384,7 +388,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
};
handleBlur
=
(
event
,
c
hange
)
=>
{
handleBlur
=
(
event
:
FocusEvent
,
change
:
C
hange
)
=>
{
const
{
lastExecutedValue
}
=
this
.
state
;
const
previousValue
=
lastExecutedValue
?
Plain
.
serialize
(
this
.
state
.
lastExecutedValue
)
:
null
;
const
currentValue
=
Plain
.
serialize
(
change
.
value
);
...
...
@@ -441,7 +445,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
};
menuRef
=
el
=>
{
menuRef
=
(
el
:
HTMLElement
)
=>
{
this
.
menuEl
=
el
;
};
...
...
@@ -504,10 +508,15 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
}
}
class
Portal
extends
React
.
PureComponent
<
{
index
?:
number
;
origin
:
string
},
{}
>
{
interface
PortalProps
{
index
?:
number
;
origin
:
string
;
}
class
Portal
extends
React
.
PureComponent
<
PortalProps
,
{}
>
{
node
:
HTMLElement
;
constructor
(
props
)
{
constructor
(
props
:
PortalProps
)
{
super
(
props
);
const
{
index
=
0
,
origin
=
'query'
}
=
props
;
this
.
node
=
document
.
createElement
(
'div'
);
...
...
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