GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 4f94d870 authored by Loic Huder's avatar Loic Huder

Added date filter to InvestigationTable

parent 145b91d2
Pipeline #32046 passed with stage
in 3 minutes and 10 seconds
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}
/>
</>
);
}
......
.wrapper {
position: relative;
}
@media (min-width: 50em) {
.filter {
display: flex;
align-items: center;
position: absolute;
left: 0;
top: 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment