Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
be4f56c3
Commit
be4f56c3
authored
Apr 30, 2020
by
Markus Scheidgen
Browse files
Minor fixes.
parent
259c2019
Changes
2
Hide whitespace changes
Inline
Side-by-side
gui/src/components/search/SearchBar.js
View file @
be4f56c3
...
...
@@ -26,7 +26,7 @@ const Options = {
*/
export
default
function
SearchBar
()
{
const
suggestionsTimerRef
=
useRef
(
null
)
const
{
response
:
{
statistics
,
pagination
},
domain
,
query
,
setQuery
}
=
useContext
(
searchContext
)
const
{
response
:
{
statistics
,
pagination
},
domain
,
query
,
apiQuery
,
setQuery
}
=
useContext
(
searchContext
)
const
defaultOptions
=
useMemo
(()
=>
{
return
Object
.
keys
(
searchQuantities
)
.
map
(
quantity
=>
searchQuantities
[
quantity
].
name
)
...
...
@@ -81,7 +81,7 @@ export default function SearchBar() {
}
suggestionsTimerRef
.
current
=
setTimeout
(()
=>
{
setLoading
(
true
)
api
.
suggestions_search
(
quantity
,
q
uery
,
size
?
null
:
value
,
size
||
20
,
true
)
api
.
suggestions_search
(
quantity
,
apiQ
uery
,
size
?
null
:
value
,
size
||
20
,
true
)
.
then
(
response
=>
{
setLoading
(
false
)
const
options
=
response
.
suggestions
.
map
(
value
=>
Options
.
join
(
quantity
,
value
))
...
...
nomad/app/api/repo.py
View file @
be4f56c3
...
...
@@ -680,9 +680,12 @@ class RepoSuggestionsResource(Resource):
try
:
search_request
.
statistic
(
quantity
,
size
=
size
,
include
=
include
,
order
=
dict
(
_key
=
'desc'
))
results
=
search_request
.
execute
()
values
=
results
[
'statistics'
][
quantity
]
values
=
{
value
:
metric
[
'code_runs'
]
for
value
,
metric
in
results
[
'statistics'
][
quantity
].
items
()
if
metric
[
'code_runs'
]
>
0
}
results
[
'suggestions'
]
=
sorted
(
values
.
keys
(),
key
=
lambda
value
:
values
[
value
]
[
'code_runs'
]
,
reverse
=
True
)
values
.
keys
(),
key
=
lambda
value
:
values
[
value
],
reverse
=
True
)
return
results
,
200
except
KeyError
as
e
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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