Commit 6d76148d authored by Alejandro De Maria Antolinos's avatar Alejandro De Maria Antolinos
Browse files

It fixes #534

parent 24316a4d
Pipeline #55259 passed with stage
in 3 minutes and 21 seconds
import React from 'react';
import { Panel } from 'react-bootstrap';
import BootstrapTable2 from 'react-bootstrap-table-next';
import Loader from '../../components/Loader';
function DatasetSummaryList(props) {
const { datasets, fetching } = props;
return (
<Panel bsStyle="info">
<Panel.Heading>
<strong>Dataset List</strong>
</Panel.Heading>
<Panel.Body>
{fetching ? (
<Loader message="Loading datasets..." inPanel />
) : (
<BootstrapTable2
keyField="id"
data={datasets}
columns={[
{ dataField: 'id', text: '', hidden: true },
{ dataField: 'name', text: 'Name' },
{
dataField: 'investigation.name',
text: 'Proposal',
headerStyle: () => ({ width: 120 }),
},
]}
pageOptions={{
paginationSize: 10,
sizePerPage: 25,
showTotal: true,
hidePageListOnlyOnePage: true,
}}
striped
condensed
noDataIndication="This is no data to display"
/>
)}
</Panel.Body>
</Panel>
);
}
export default DatasetSummaryList;
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { Col, Grid, Panel, Row } from 'react-bootstrap';
import BootstrapTable2 from 'react-bootstrap-table-next';
import { useDispatch, useSelector } from 'react-redux';
import {
getDatasetsById,
......@@ -10,6 +9,7 @@ import {
import DOIForm from '../../components/doi/DOIForm';
import Loader from '../../components/Loader';
import { setBreadCrumbs } from '../../actions/breadcrumbs';
import DatasetSummaryList from './DatasetSummaryList';
function MintSelectionPage() {
const sessionId = useSelector((state) => state.user.sessionId);
......@@ -78,39 +78,10 @@ function MintSelectionPage() {
</Panel>
</Col>
<Col md={5}>
<Panel bsStyle="info">
<Panel.Heading>
<strong>Dataset List</strong>
</Panel.Heading>
<Panel.Body>
{fetching ? (
<Loader message="Loading datasets..." inPanel />
) : (
<BootstrapTable2
keyField="id"
data={datasets}
columns={[
{ dataField: 'id', text: '', hidden: true },
{ dataField: 'name', text: 'Name' },
{
dataField: 'investigation.name',
text: 'Proposal',
headerStyle: () => ({ width: 120 }),
},
]}
pageOptions={{
paginationSize: 10,
sizePerPage: 25,
showTotal: true,
hidePageListOnlyOnePage: true,
}}
striped
condensed
noDataIndication="This is no data to display"
/>
)}
</Panel.Body>
</Panel>
<DatasetSummaryList
fetching={fetching}
datasets={datasets}
></DatasetSummaryList>
</Col>
</Row>
</Grid>
......
......@@ -10,7 +10,7 @@ import {
import { useSelector, useDispatch } from 'react-redux';
import { setBreadCrumbs } from '../../actions/breadcrumbs';
import { getDatasetsById } from '../../api/icat-plus/catalogue';
import DatasetTable from '../../components/Dataset/DatasetTable';
import DatasetSummaryList from './DatasetSummaryList';
import Loader from '../../components/Loader';
import { LinkContainer } from 'react-router-bootstrap';
import { getDownloadURLByDatasetId } from '../../api/ids';
......@@ -40,6 +40,7 @@ function SelectionPage() {
const { datasets, isFetching: fetching } = state;
const tooltip = (text) => <Tooltip id="tooltip">{text}</Tooltip>;
console.log(datasets);
return (
<div className="app__inner">
<ButtonToolbar>
......@@ -61,28 +62,37 @@ function SelectionPage() {
placement="bottom"
overlay={tooltip('Download all selected datasets')}
>
<a
style={{ color: 'black' }}
href={getDownloadURLByDatasetId(sessionId, initialSelectedDatasets)}
<Button
style={{ marginLeft: 5, color: 'white' }}
bsSize="small"
bsStyle="primary"
target="_blank"
disabled={selectedDatasets.length === 0}
>
<Button
style={{ marginLeft: 5 }}
bsSize="small"
bsStyle="primary"
target="_blank"
disabled={selectedDatasets.length === 0}
<a
style={{ color: 'white' }}
href={getDownloadURLByDatasetId(
sessionId,
initialSelectedDatasets
)}
>
<Glyphicon glyph="download" style={{ marginRight: 3 }} /> Download
all
</Button>
</a>
</a>
</Button>
</OverlayTrigger>
</ButtonToolbar>
{fetching ? (
<Loader message="Loading datasets..." spacedOut />
) : (
<DatasetTable datasets={datasets} />
<>
<br />
<DatasetSummaryList
fetching={fetching}
datasets={datasets}
></DatasetSummaryList>
</>
)}
</div>
);
......
......@@ -37,6 +37,7 @@ export default class DatasetResource extends Resource {
search
);
}
return getDatasetsByInvestigationIdURL(
sessionId,
investigationId,
......
Supports Markdown
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