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
ICAT
Datahub
Commits
4f94d870
Commit
4f94d870
authored
Aug 27, 2020
by
Loic Huder
Browse files
Added date filter to InvestigationTable
parent
145b91d2
Pipeline
#32046
passed with stage
in 3 minutes and 10 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/components/Investigation/InvestigationTable.js
View file @
4f94d870
import
React
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
Col
,
Glyphicon
,
Grid
,
Row
}
from
'
react-bootstrap
'
;
import
moment
from
'
moment
'
;
import
{
DATASET_COUNT
,
FILE_COUNT
,
...
...
@@ -10,6 +11,8 @@ import ResponsiveTable from '../Table/ResponsiveTable';
import
InvestigationWidget
from
'
./InvestigationWidget
'
;
import
{
beamlineFormatter
,
dateFormatter
,
nameFormatter
}
from
'
./utils
'
;
import
{
stringifyBytesSize
}
from
'
../../helpers
'
;
import
InvestigationDateFilter
from
'
./InvestigationDateFilter
'
;
import
styles
from
'
./InvestigationTable.module.css
'
;
function
volumeFormatter
(
cell
,
investigation
)
{
const
volume
=
investigation
.
parameters
.
find
((
o
)
=>
o
.
name
===
VOLUME
);
...
...
@@ -228,6 +231,7 @@ function getColumns(props) {
function
InvestigationTable
(
props
)
{
const
{
expanded
,
user
,
investigations
}
=
props
;
const
[
dateFilter
,
setDateFilter
]
=
useState
();
const
expandRow
=
{
showExpandColumn
:
true
,
...
...
@@ -262,11 +266,23 @@ function InvestigationTable(props) {
};
return
(
<
ResponsiveTable
data
=
{
investigations
}
columns
=
{
getColumns
(
props
)}
expandRow
=
{
expandRow
}
/
>
<>
<
div
className
=
{
styles
.
wrapper
}
>
<
InvestigationDateFilter
rootClassName
=
{
styles
.
filter
}
value
=
{
dateFilter
&&
dateFilter
.
toDate
()}
onDayChange
=
{(
date
)
=>
setDateFilter
(
moment
(
date
))}
onClear
=
{()
=>
setDateFilter
(
undefined
)}
/
>
<
/div
>
<
ResponsiveTable
data
=
{
investigations
.
filter
(
(
inv
)
=>
!
dateFilter
||
dateFilter
.
isSame
(
inv
.
startDate
,
'
day
'
)
)}
columns
=
{
getColumns
(
props
)}
expandRow
=
{
expandRow
}
/
>
<
/
>
);
}
...
...
src/components/Investigation/InvestigationTable.module.css
0 → 100644
View file @
4f94d870
.wrapper
{
position
:
relative
;
}
@media
(
min-width
:
50em
)
{
.filter
{
display
:
flex
;
align-items
:
center
;
position
:
absolute
;
left
:
0
;
top
:
0
;
}
}
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