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
2ebda4bf
Commit
2ebda4bf
authored
Jun 12, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make suggestions an object
parent
4113f7db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
public/app/containers/Explore/QueryField.tsx
+3
-1
public/app/containers/Explore/Typeahead.tsx
+11
-3
No files found.
public/app/containers/Explore/QueryField.tsx
View file @
2ebda4bf
...
...
@@ -545,7 +545,9 @@ class QueryField extends React.Component<any, any> {
let
selectedIndex
=
Math
.
max
(
this
.
state
.
typeaheadIndex
,
0
);
const
flattenedSuggestions
=
flattenSuggestions
(
suggestions
);
selectedIndex
=
selectedIndex
%
flattenedSuggestions
.
length
||
0
;
const
selectedKeys
=
flattenedSuggestions
.
length
>
0
?
[
flattenedSuggestions
[
selectedIndex
]]
:
[];
const
selectedKeys
=
(
flattenedSuggestions
.
length
>
0
?
[
flattenedSuggestions
[
selectedIndex
]]
:
[]).
map
(
i
=>
(
typeof
i
===
'object'
?
i
.
text
:
i
)
);
// Create typeahead in DOM root so we can later position it absolutely
return
(
...
...
public/app/containers/Explore/Typeahead.tsx
View file @
2ebda4bf
...
...
@@ -41,9 +41,17 @@ class TypeaheadGroup extends React.PureComponent<any, any> {
<
li
className=
"typeahead-group"
>
<
div
className=
"typeahead-group__title"
>
{
label
}
</
div
>
<
ul
className=
"typeahead-group__list"
>
{
items
.
map
(
item
=>
(
<
TypeaheadItem
key=
{
item
}
onClickItem=
{
onClickItem
}
isSelected=
{
selected
.
indexOf
(
item
)
>
-
1
}
label=
{
item
}
/>
))
}
{
items
.
map
(
item
=>
{
const
text
=
typeof
item
===
'object'
?
item
.
text
:
item
;
return
(
<
TypeaheadItem
key=
{
text
}
onClickItem=
{
onClickItem
}
isSelected=
{
selected
.
indexOf
(
text
)
>
-
1
}
label=
{
text
}
/>
);
})
}
</
ul
>
</
li
>
);
...
...
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