Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ICAT
Datahub
Commits
a8e04ed2
Commit
a8e04ed2
authored
Sep 01, 2020
by
Loic Huder
Browse files
Investigations now match when the selected date for filtering is between the start and the end
parent
5d032476
Pipeline
#32445
passed with stage
in 3 minutes and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/components/Investigation/InvestigationDateFilter.js
View file @
a8e04ed2
...
...
@@ -13,11 +13,14 @@ function InvestigationDateFilter(props) {
<
DayPickerInput
inputProps
=
{{
className
:
styles
.
dateFilterInput
}}
value
=
{
value
}
placeholder
=
"
Filter by
start
date
"
placeholder
=
"
Filter by date
"
format
=
{
INVESTIGATION_DATE_FORMAT
}
formatDate
=
{
formatDate
}
parseDate
=
{
parseDate
}
onDayChange
=
{
onDayChange
}
dayPickerProps
=
{{
todayButton
:
'
Today
'
,
}}
/
>
<
Button
disabled
=
{
!
value
}
...
...
src/components/Investigation/InvestigationTable.js
View file @
a8e04ed2
...
...
@@ -231,7 +231,7 @@ function getColumns(props) {
function
InvestigationTable
(
props
)
{
const
{
expanded
,
user
,
investigations
}
=
props
;
const
[
dateFilter
,
setDateFilter
]
=
useState
();
const
[
selectedDate
,
setSelectedDate
]
=
useState
();
const
expandRow
=
{
showExpandColumn
:
true
,
...
...
@@ -265,20 +265,29 @@ function InvestigationTable(props) {
),
};
function
dateFilter
(
investigation
)
{
return
investigation
.
endDate
?
selectedDate
.
isBetween
(
investigation
.
startDate
,
investigation
.
endDate
,
'
day
'
,
'
[]
'
)
:
selectedDate
.
isSame
(
investigation
.
startDate
,
'
day
'
);
}
return
(
<>
<
div
className
=
{
styles
.
wrapper
}
>
<
InvestigationDateFilter
rootClassName
=
{
styles
.
filter
}
value
=
{
dateFilter
&&
dateFilter
.
toDate
()}
onDayChange
=
{(
date
)
=>
set
DateFilter
(
moment
(
date
))}
onClear
=
{()
=>
set
DateFilter
(
undefined
)}
value
=
{
selectedDate
&&
selectedDate
.
toDate
()}
onDayChange
=
{(
date
)
=>
set
SelectedDate
(
moment
(
date
))}
onClear
=
{()
=>
set
SelectedDate
(
undefined
)}
/
>
<
/div
>
<
ResponsiveTable
data
=
{
investigations
.
filter
(
(
inv
)
=>
!
dateFilter
||
dateFilter
.
isSame
(
inv
.
startDate
,
'
day
'
)
)}
data
=
{
selectedDate
?
investigations
.
filter
(
dateFilter
)
:
investigations
}
columns
=
{
getColumns
(
props
)}
expandRow
=
{
expandRow
}
/
>
...
...
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