Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
public
Mímir
Commits
a8dc7970
Commit
a8dc7970
authored
Aug 13, 2020
by
Aron Fiechter
Browse files
Change QueryResult info to only display count
It cannot display "No results" because that will be handled differently.
parent
649baf31
Changes
1
Show whitespace changes
Inline
Side-by-side
client/src/components/queryResult/QueryResult.js
View file @
a8dc7970
import
React
from
'
react
'
;
import
{
selectResult
}
from
'
../navbar/querySlice
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
selectQuery
,
selectResult
}
from
'
../navbar/querySlice
'
;
import
Container
from
'
react-bootstrap/Container
'
;
import
{
useSelector
}
from
'
react-redux
'
;
export
default
function
QueryResult
(
props
)
{
const
{
nResults
}
=
useSelector
(
selectResult
);
const
query
=
useSelector
(
selectQuery
);
const
allDataText
=
query
?.
fields
?.
find
((
f
)
=>
f
.
key
===
'
allData
'
)?.
value
;
const
queryText
=
allDataText
||
query
?.
fields
?.
find
((
f
)
=>
f
.
value
)?.
value
;
const
text
=
nResults
>
0
?
(
<
h5
className
=
'
card-title text-sm-right
'
>
{
nResults
}
results
<
/h5
>
)
:
(
<
h5
className
=
'
card-title text-sm-right text-danger
'
>
No
results
!<
/h5
>
);
const
displayText
=
<
h5
className
=
"
card-title text-sm-right
"
>
{
nResults
}
results
<
/h5>
;
return
(
<
div
className
=
'
mt-sm-2 mb-sm-1
'
>
<
Container
>
{
t
ext
}
<
/Container
>
<
div
className
=
"
mt-sm-2 mb-sm-1
"
>
<
Container
>
{
displayT
ext
}
<
/Container
>
<
/div
>
);
}
Write
Preview
Supports
Markdown
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