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
ac4d8cb4
Commit
ac4d8cb4
authored
Aug 16, 2020
by
Aron Fiechter
Browse files
Add component to show last query
parent
f7ac935a
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/components/voronoi/entity/LastQuery.js
0 → 100644
View file @
ac4d8cb4
import
React
from
'
react
'
;
import
{
useSelector
}
from
'
react-redux
'
;
import
{
selectQuery
}
from
'
../../navbar/querySlice
'
;
import
Card
from
'
react-bootstrap/Card
'
;
export
default
function
LastQuery
()
{
const
lastQuery
=
useSelector
(
selectQuery
);
const
isLastQueryAdvanced
=
lastQuery
?.
advanced
||
false
;
const
lastSimpleQueryText
=
lastQuery
?.
fields
?.
find
((
f
)
=>
f
.
key
===
'
allData
'
)?.
value
;
const
lastAdvancedQuery
=
lastQuery
?.
fields
?.
filter
((
f
)
=>
f
.
value
)
?.
map
((
f
)
=>
`
${
f
.
key
}
=
${
f
.
value
}
`
)
?.
join
(
'
,
'
);
const
text
=
(
<
span
className
=
"
text-info
"
>
{
isLastQueryAdvanced
?
lastAdvancedQuery
:
lastSimpleQueryText
}
<
/span
>
);
return
lastQuery
?
(
<
Card
.
Body
className
=
"
border-top
"
>
<
Card
.
Text
>
Showing
results
for
{
isLastQueryAdvanced
?
<
em
>
advanced
<
/em> : ''} query {text
}
<
/Card.Text
>
<
/Card.Body
>
)
:
(
''
);
}
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