Commit 84e485e2 authored by Maxym Borodenko's avatar Maxym Borodenko

Subset and Dataset accession lists

Updated actions and reducers

Added sort
parent 4ef70934
Pipeline #7710 passed with stages
in 3 minutes and 58 seconds
...@@ -4,7 +4,8 @@ import { push } from 'react-router-redux'; ...@@ -4,7 +4,8 @@ import { push } from 'react-router-redux';
import { addFilterCode } from 'actions/filterCode'; import { addFilterCode } from 'actions/filterCode';
// Constants // Constants
import { DASHBOARD_REMOVE_DATASET, DASHBOARD_RECEIVE_DATASET_PAGE, CREATE_DATASET, DASHBOARD_APPEND_DATASET_PAGE, RECEIVE_DATASET } from 'datasets/constants'; import { DASHBOARD_REMOVE_DATASET, DASHBOARD_RECEIVE_DATASET_PAGE, CREATE_DATASET, DASHBOARD_APPEND_DATASET_PAGE,
RECEIVE_DATASET, DASHBOARD_APPEND_ACCESSIONS_PAGE, DASHBOARD_RECEIVE_ACCESSIONS_PAGE } from 'datasets/constants';
// Models // Models
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
...@@ -17,6 +18,7 @@ import DatasetService from 'service/DatasetService'; ...@@ -17,6 +18,7 @@ import DatasetService from 'service/DatasetService';
// Utility // Utility
import { log } from 'utilities/debug'; import { log } from 'utilities/debug';
import { dereferenceReferences } from 'utilities'; import { dereferenceReferences } from 'utilities';
import AccessionRef from 'model/accession/AccessionRef';
const removeDataset = (dataset: Dataset) => ({ const removeDataset = (dataset: Dataset) => ({
type: DASHBOARD_REMOVE_DATASET, payload: dataset, type: DASHBOARD_REMOVE_DATASET, payload: dataset,
...@@ -35,6 +37,14 @@ const receiveDatasetPage = (paged: Page<Dataset>, page, results, sortBy, filter: ...@@ -35,6 +37,14 @@ const receiveDatasetPage = (paged: Page<Dataset>, page, results, sortBy, filter:
payload: { paged, query: { page, results, sortBy, filter, order } }, payload: { paged, query: { page, results, sortBy, filter, order } },
}); });
const appendAccessions = (accessionRefs: Page<AccessionRef>) => ({
type: DASHBOARD_APPEND_ACCESSIONS_PAGE, payload: { accessionRefs },
});
const receiveAccessions = (accessionRefs: Page<AccessionRef>, currentUuid: string) => ({
type: DASHBOARD_RECEIVE_ACCESSIONS_PAGE,
payload: { accessionRefs, currentUuid },
});
const createDataset = () => (dispatch) => { const createDataset = () => (dispatch) => {
dispatch({ type: CREATE_DATASET }); dispatch({ type: CREATE_DATASET });
...@@ -62,6 +72,23 @@ function listMyDatasets(page?, results?, sortBy?: string[], filter?: string | Da ...@@ -62,6 +72,23 @@ function listMyDatasets(page?, results?, sortBy?: string[], filter?: string | Da
}; };
} }
function loadAccessions(uuid: string, page: number = 0, results: number = 50) {
return (dispatch, getState) => {
return DatasetService.listAccessions(uuid, { page, size: results })
.then((paged) => {
if (paged.number === 0) {
dispatch(receiveAccessions(paged, uuid));
} else {
dispatch(appendAccessions(paged));
}
})
.catch((error) => {
log('Error', error);
});
};
}
export {listMyDatasets}; export {listMyDatasets};
const getOneFromStateByUUID = (uuid: string, state): Dataset => { const getOneFromStateByUUID = (uuid: string, state): Dataset => {
...@@ -120,4 +147,4 @@ function deleteDataset(datasetUuid: string) { ...@@ -120,4 +147,4 @@ function deleteDataset(datasetUuid: string) {
} }
// Dashboard action section exports // Dashboard action section exports
export {publishDataset, approveDataset, unpublishDataset, deleteDataset}; export {publishDataset, approveDataset, unpublishDataset, deleteDataset, loadAccessions};
...@@ -3,6 +3,7 @@ import * as _ from 'lodash'; ...@@ -3,6 +3,7 @@ import * as _ from 'lodash';
// Actions // Actions
import { navigateTo } from 'actions/navigation'; import { navigateTo } from 'actions/navigation';
import {loadAccessions} from 'datasets/actions/dashboard';
// Constants // Constants
import { ADD_CREATOR_TO_DATASET, ADD_LOCATION, RECEIVE_LOCATION, REMOVE_CREATOR_FROM_DATASET, REMOVE_LOCATION, UPDATE_DATASET_CREATOR, RECEIVE_DATASET, DASHBOARD_REMOVE_DATASET } from 'datasets/constants'; import { ADD_CREATOR_TO_DATASET, ADD_LOCATION, RECEIVE_LOCATION, REMOVE_CREATOR_FROM_DATASET, REMOVE_LOCATION, UPDATE_DATASET_CREATOR, RECEIVE_DATASET, DASHBOARD_REMOVE_DATASET } from 'datasets/constants';
...@@ -113,6 +114,7 @@ export const updateDatasetAccessionRefs = (dataset: Dataset, accessionRefs: Acce ...@@ -113,6 +114,7 @@ export const updateDatasetAccessionRefs = (dataset: Dataset, accessionRefs: Acce
return DatasetService.upsertAccessions(dataset.uuid, dataset.version, accessionRefs) return DatasetService.upsertAccessions(dataset.uuid, dataset.version, accessionRefs)
.then((saved) => { .then((saved) => {
dispatch(receiveDataset(saved)); dispatch(receiveDataset(saved));
dispatch(loadAccessions(saved.uuid));
return saved; return saved;
}).catch((error) => { }).catch((error) => {
log('Publish error', error); log('Publish error', error);
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
import {addFilterCode} from 'actions/filterCode'; import {addFilterCode} from 'actions/filterCode';
// Constants // Constants
import {RECEIVE_DATASET, RECEIVE_DATASET_PAGE, APPEND_DATASET_PAGE} from 'datasets/constants'; import {RECEIVE_DATASET, RECEIVE_DATASET_PAGE, APPEND_DATASET_PAGE, APPEND_ACCESSIONS_PAGE, RECEIVE_ACCESSIONS_PAGE} from 'datasets/constants';
// Model // Model
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
import DatasetFilter from 'model/catalog/DatasetFilter'; import DatasetFilter from 'model/catalog/DatasetFilter';
import {Page} from 'model/common.model'; import {Page} from 'model/common.model';
import AccessionRef from 'model/accession/AccessionRef';
// Service // Service
import DatasetService from 'service/DatasetService'; import DatasetService from 'service/DatasetService';
...@@ -16,7 +17,6 @@ import DatasetService from 'service/DatasetService'; ...@@ -16,7 +17,6 @@ import DatasetService from 'service/DatasetService';
import {log} from 'utilities/debug'; import {log} from 'utilities/debug';
import { dereferenceReferences } from 'utilities'; import { dereferenceReferences } from 'utilities';
const appendDatasetPage = (paged: Page<Dataset>, page, results, sortBy, filter: DatasetFilter, order) => ({ const appendDatasetPage = (paged: Page<Dataset>, page, results, sortBy, filter: DatasetFilter, order) => ({
type: APPEND_DATASET_PAGE, type: APPEND_DATASET_PAGE,
payload: { paged, query: { page, results, sortBy, filter, order } }, payload: { paged, query: { page, results, sortBy, filter, order } },
...@@ -32,6 +32,15 @@ const receiveDataset = (dataset: Dataset) => ({ ...@@ -32,6 +32,15 @@ const receiveDataset = (dataset: Dataset) => ({
type: RECEIVE_DATASET, payload: dataset, type: RECEIVE_DATASET, payload: dataset,
}); });
const appendAccessions = (accessionRefs: Page<AccessionRef>) => ({
type: APPEND_ACCESSIONS_PAGE, payload: { accessionRefs },
});
const receiveAccessions = (accessionRefs: Page<AccessionRef>, currentUuid: string) => ({
type: RECEIVE_ACCESSIONS_PAGE,
payload: { accessionRefs, currentUuid },
});
function loadDataset(uuid: string) { function loadDataset(uuid: string) {
return (dispatch, getState) => { return (dispatch, getState) => {
...@@ -45,6 +54,23 @@ function loadDataset(uuid: string) { ...@@ -45,6 +54,23 @@ function loadDataset(uuid: string) {
}; };
} }
function loadAccessions(uuid: string, page: number, results: number) {
return (dispatch, getState) => {
return DatasetService.listAccessions(uuid, { page, size: results })
.then((paged) => {
if (paged.number === 0) {
dispatch(receiveAccessions(paged, uuid));
} else {
dispatch(appendAccessions(paged));
}
})
.catch((error) => {
log('Error', error);
});
};
}
function listDatasetsRequest(page?, results?, sortBy?: string[], filter?, order?) { function listDatasetsRequest(page?, results?, sortBy?: string[], filter?, order?) {
return (dispatch, getState) => { return (dispatch, getState) => {
...@@ -77,4 +103,4 @@ const promiselistDatasets = (page?, results?, sortBy?: string[], filter?, order? ...@@ -77,4 +103,4 @@ const promiselistDatasets = (page?, results?, sortBy?: string[], filter?, order?
}); });
}; };
export {listDatasetsRequest, promiselistDatasets, loadDataset}; export {listDatasetsRequest, promiselistDatasets, loadDataset, loadAccessions};
...@@ -7,6 +7,11 @@ export const REMOVE_DATASET = 'App/DELETE_DATASET'; ...@@ -7,6 +7,11 @@ export const REMOVE_DATASET = 'App/DELETE_DATASET';
export const RECEIVE_DATASET_PAGE = 'App/RECEIVE_DATASET_PAGE'; export const RECEIVE_DATASET_PAGE = 'App/RECEIVE_DATASET_PAGE';
export const APPEND_DATASET_PAGE = 'App/APPEND_DATASET_PAGE'; export const APPEND_DATASET_PAGE = 'App/APPEND_DATASET_PAGE';
export const RECEIVE_ACCESSIONS_PAGE = 'App/RECEIVE_ACCESSIONS_PAGE';
export const APPEND_ACCESSIONS_PAGE = 'App/APPEND_ACCESSIONS_PAGE';
export const DASHBOARD_RECEIVE_ACCESSIONS_PAGE = 'App/DASHBOARD_RECEIVE_ACCESSIONS_PAGE';
export const DASHBOARD_APPEND_ACCESSIONS_PAGE = 'App/DASHBOARD_APPEND_ACCESSIONS_PAGE';
// dashboard // dashboard
export const DASHBOARD_REMOVE_DATASET = 'dataset/dashboard/REMOVE_DATASET'; export const DASHBOARD_REMOVE_DATASET = 'dataset/dashboard/REMOVE_DATASET';
export const DASHBOARD_RECEIVE_DATASET_PAGE = 'dataset/dashboard/RECEIVE_DATASET_PAGE'; export const DASHBOARD_RECEIVE_DATASET_PAGE = 'dataset/dashboard/RECEIVE_DATASET_PAGE';
......
...@@ -2,29 +2,25 @@ import update from 'immutability-helper'; ...@@ -2,29 +2,25 @@ import update from 'immutability-helper';
import { log } from 'utilities/debug'; import { log } from 'utilities/debug';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { import { CREATE_DATASET, ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UPDATE_DATASET_CREATOR, ADD_LOCATION,
CREATE_DATASET, RECEIVE_LOCATION, REMOVE_LOCATION, DASHBOARD_REMOVE_DATASET, DASHBOARD_RECEIVE_DATASET_PAGE, RECEIVE_DATASET,
ADD_CREATOR_TO_DATASET, DASHBOARD_APPEND_DATASET_PAGE, DASHBOARD_RECEIVE_ACCESSIONS_PAGE, DASHBOARD_APPEND_ACCESSIONS_PAGE,
REMOVE_CREATOR_FROM_DATASET,
UPDATE_DATASET_CREATOR,
ADD_LOCATION,
RECEIVE_LOCATION,
REMOVE_LOCATION,
DASHBOARD_REMOVE_DATASET,
DASHBOARD_RECEIVE_DATASET_PAGE,
RECEIVE_DATASET,
DASHBOARD_APPEND_DATASET_PAGE,
} from 'datasets/constants'; } from 'datasets/constants';
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
import AccessionRef from 'model/accession/AccessionRef';
import { Page } from 'model/common.model'; import { Page } from 'model/common.model';
const INITIAL_STATE: { const INITIAL_STATE: {
currentUuid: string,
dataset: Dataset, dataset: Dataset,
accessionRefs: Page<AccessionRef>
paged: Page<Dataset>, paged: Page<Dataset>,
pagedQuery: any, pagedQuery: any,
} = { } = {
currentUuid: null,
dataset: null, dataset: null,
accessionRefs: null,
paged: null, paged: null,
pagedQuery: null, pagedQuery: null,
}; };
...@@ -45,6 +41,7 @@ function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, paylo ...@@ -45,6 +41,7 @@ function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, paylo
if (receivedIndex !== -1) { if (receivedIndex !== -1) {
return update(state, { return update(state, {
dataset: { $set: action.payload }, dataset: { $set: action.payload },
accessionRefs: { $set: action.payload.uuid === state.currentUuid ? state.accessionRefs : null },
paged: { paged: {
content: { content: {
[receivedIndex]: { $set: action.payload }, [receivedIndex]: { $set: action.payload },
...@@ -59,6 +56,28 @@ function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, paylo ...@@ -59,6 +56,28 @@ function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, paylo
} }
} }
case DASHBOARD_RECEIVE_ACCESSIONS_PAGE: {
return update(state, {
accessionRefs: { $set: action.payload.accessionRefs },
currentUuid: { $set: action.payload.currentUuid },
});
}
case DASHBOARD_APPEND_ACCESSIONS_PAGE: {
const {accessionRefs} = action.payload;
return !state.accessionRefs ? update(state, {
accessionRefs: { $set: accessionRefs },
}) :
update(state, {
accessions: {
content: {$push: accessionRefs.content},
number: {$set: accessionRefs.number},
last: {$set: accessionRefs.last},
},
});
}
case DASHBOARD_REMOVE_DATASET: { case DASHBOARD_REMOVE_DATASET: {
if (state.paged) { if (state.paged) {
const removeIndex = _.findIndex(state.paged.content, (item) => item.uuid === action.payload.uuid); const removeIndex = _.findIndex(state.paged.content, (item) => item.uuid === action.payload.uuid);
......
import update from 'immutability-helper'; import update from 'immutability-helper';
import * as _ from 'lodash'; import * as _ from 'lodash';
import {APPEND_DATASET_PAGE, RECEIVE_DATASET, RECEIVE_DATASET_PAGE} from 'datasets/constants'; import {APPEND_DATASET_PAGE, RECEIVE_DATASET, RECEIVE_DATASET_PAGE, RECEIVE_ACCESSIONS_PAGE, APPEND_ACCESSIONS_PAGE} from 'datasets/constants';
import {LOGIN_APP, LOGIN_USER, LOGOUT} from 'constants/login'; import {LOGIN_APP, LOGIN_USER, LOGOUT} from 'constants/login';
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
import AccessionRef from 'model/accession/AccessionRef';
import {Page} from 'model/common.model'; import {Page} from 'model/common.model';
const INITIAL_STATE: { const INITIAL_STATE: {
currentUuid: string,
dataset: Dataset, dataset: Dataset,
accessionRefs: Page<AccessionRef>
paged: Page<Dataset>, paged: Page<Dataset>,
pagedQuery: any, pagedQuery: any,
} = { } = {
currentUuid: null,
dataset: null, dataset: null,
accessionRefs: null,
paged: null, paged: null,
pagedQuery: null, pagedQuery: null,
}; };
...@@ -33,6 +38,7 @@ function datasetsPublic(state = INITIAL_STATE, action: { type?: string, payload? ...@@ -33,6 +38,7 @@ function datasetsPublic(state = INITIAL_STATE, action: { type?: string, payload?
if (receivedIndex !== -1) { if (receivedIndex !== -1) {
return update(state, { return update(state, {
dataset: { $set: action.payload }, dataset: { $set: action.payload },
accessionRefs: { $set: action.payload.uuid === state.currentUuid ? state.accessionRefs : null },
paged: { paged: {
content: { content: {
[receivedIndex]: {$set: action.payload}, [receivedIndex]: {$set: action.payload},
...@@ -54,6 +60,28 @@ function datasetsPublic(state = INITIAL_STATE, action: { type?: string, payload? ...@@ -54,6 +60,28 @@ function datasetsPublic(state = INITIAL_STATE, action: { type?: string, payload?
}); });
} }
case RECEIVE_ACCESSIONS_PAGE: {
return update(state, {
accessionRefs: { $set: action.payload.accessionRefs },
currentUuid: { $set: action.payload.currentUuid },
});
}
case APPEND_ACCESSIONS_PAGE: {
const {accessionRefs} = action.payload;
return !state.accessionRefs ? update(state, {
accessionRefs: { $set: accessionRefs },
}) :
update(state, {
accessions: {
content: {$push: accessionRefs.content},
number: {$set: accessionRefs.number},
last: {$set: accessionRefs.last},
},
});
}
case APPEND_DATASET_PAGE: { case APPEND_DATASET_PAGE: {
const {paged, query} = action.payload; const {paged, query} = action.payload;
......
...@@ -5,7 +5,7 @@ import { withStyles } from '@material-ui/core/styles'; ...@@ -5,7 +5,7 @@ import { withStyles } from '@material-ui/core/styles';
import { translate } from 'react-i18next'; import { translate } from 'react-i18next';
import { deleteDataset, publishDataset, rejectDataset, approveDataset } from 'datasets/actions/editor'; import { deleteDataset, publishDataset, rejectDataset, approveDataset } from 'datasets/actions/editor';
import { loadDataset } from 'datasets/actions/public'; import {loadAccessions, loadDataset} from 'datasets/actions/public';
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
import PageLayout from 'ui/layout/PageLayout'; import PageLayout from 'ui/layout/PageLayout';
...@@ -13,6 +13,8 @@ import BackButton from 'ui/common/buttons/BackButton'; ...@@ -13,6 +13,8 @@ import BackButton from 'ui/common/buttons/BackButton';
import Loading from 'ui/common/Loading'; import Loading from 'ui/common/Loading';
import DatasetDisplay from './c/DatasetDisplay'; import DatasetDisplay from './c/DatasetDisplay';
import Grid from '@material-ui/core/Grid'; import Grid from '@material-ui/core/Grid';
import AccessionRef from 'model/accession/AccessionRef';
import {Page} from 'model/common.model';
interface IDatasetDetailProps extends React.ClassAttributes<any> { interface IDatasetDetailProps extends React.ClassAttributes<any> {
classes: any; classes: any;
...@@ -20,11 +22,13 @@ interface IDatasetDetailProps extends React.ClassAttributes<any> { ...@@ -20,11 +22,13 @@ interface IDatasetDetailProps extends React.ClassAttributes<any> {
uuid: string; uuid: string;
dataset: Dataset; dataset: Dataset;
accessionRefs: Page<AccessionRef>;
loadDataset: (uuid: string) => Promise<Dataset>; loadDataset: (uuid: string) => Promise<Dataset>;
deleteDataset: (dataset: Dataset) => Promise<Dataset>; deleteDataset: (dataset: Dataset) => Promise<Dataset>;
publishDataset: (dataset: Dataset, needToRedirect?: boolean) => void; publishDataset: (dataset: Dataset, needToRedirect?: boolean) => void;
approveDataset: (dataset: Dataset) => void; approveDataset: (dataset: Dataset) => void;
rejectDataset: (dataset: Dataset, needToRedirect?: boolean) => void; rejectDataset: (dataset: Dataset, needToRedirect?: boolean) => void;
loadAccessions: (uuid: string, page?: number, pageSize?: number) => any;
} }
const styles = (theme) => ({ const styles = (theme) => ({
...@@ -40,16 +44,22 @@ const styles = (theme) => ({ ...@@ -40,16 +44,22 @@ const styles = (theme) => ({
class DatasetDetail extends React.Component<IDatasetDetailProps, any> { class DatasetDetail extends React.Component<IDatasetDetailProps, any> {
protected static needs = [ protected static needs = [
({ params: { uuid } }) => loadDataset(uuid), ({ params: { uuid } }) => loadDataset(uuid),
({ params: { uuid } }) => loadAccessions(uuid, 0, 50),
]; ];
public componentDidMount() { public componentDidMount() {
const { dataset, loadDataset, uuid } = this.props; const { dataset, loadDataset, uuid, loadAccessions} = this.props;
loadAccessions(uuid);
if (!dataset || dataset.uuid !== uuid) { if (!dataset || dataset.uuid !== uuid) {
loadDataset(uuid); loadDataset(uuid);
} }
} }
protected loadNextPageOfAcce = (page: number, pageSize: number) => {
this.props.loadAccessions(this.props.uuid, page, pageSize);
}
public render() { public render() {
const { t, classes, uuid, dataset, publishDataset, rejectDataset, approveDataset, deleteDataset } = this.props; const { t, classes, uuid, dataset, publishDataset, rejectDataset, approveDataset, deleteDataset } = this.props;
...@@ -71,6 +81,8 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> { ...@@ -71,6 +81,8 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> {
rejectDataset={ rejectDataset } rejectDataset={ rejectDataset }
approveDataset={ approveDataset } approveDataset={ approveDataset }
deleteDataset={ deleteDataset } deleteDataset={ deleteDataset }
loadAccessions={ this.loadNextPageOfAcce }
accessionRefs={ this.props.accessionRefs }
/> />
</Grid> </Grid>
} }
...@@ -88,6 +100,7 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> { ...@@ -88,6 +100,7 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> {
const mapStateToProps = (state, ownProps) => ({ const mapStateToProps = (state, ownProps) => ({
dataset: state.datasets.public.dataset, dataset: state.datasets.public.dataset,
accessionRefs: state.datasets.public.accessionRefs,
uuid: ownProps.match.params.uuid, uuid: ownProps.match.params.uuid,
}); });
...@@ -97,6 +110,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({ ...@@ -97,6 +110,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
deleteDataset, deleteDataset,
rejectDataset, rejectDataset,
approveDataset, approveDataset,
loadAccessions,
}, dispatch); }, dispatch);
export default translate()(connect(mapStateToProps, mapDispatchToProps)((withStyles as any)(styles)(DatasetDetail))); export default translate()(connect(mapStateToProps, mapDispatchToProps)((withStyles as any)(styles)(DatasetDetail)));
import * as React from 'react'; import * as React from 'react';
import { translate } from 'react-i18next'; import { translate } from 'react-i18next';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
...@@ -11,7 +10,7 @@ import Descriptor from 'model/catalog/Descriptor'; ...@@ -11,7 +10,7 @@ import Descriptor from 'model/catalog/Descriptor';
import RepositoryFile from 'model/repository/RepositoryFile'; import RepositoryFile from 'model/repository/RepositoryFile';
import DatasetCreator from 'model/catalog/DatasetCreator'; import DatasetCreator from 'model/catalog/DatasetCreator';
import { AVAILABLE_LICENSES } from 'model/License'; import { AVAILABLE_LICENSES } from 'model/License';
import { PublishState } from 'model/common.model'; import { PublishState, Page } from 'model/common.model';
import confirm from 'utilities/confirmAlert'; import confirm from 'utilities/confirmAlert';
import Authorize from 'ui/common/authorized/Authorize'; import Authorize from 'ui/common/authorized/Authorize';
...@@ -35,6 +34,7 @@ import CropChips from 'crops/ui/c/CropChips'; ...@@ -35,6 +34,7 @@ import CropChips from 'crops/ui/c/CropChips';
import Card, {CardHeader, CardContent, CardActions } from 'ui/common/Card'; import Card, {CardHeader, CardContent, CardActions } from 'ui/common/Card';
import McpdDate from 'ui/common/time/McpdDate'; import McpdDate from 'ui/common/time/McpdDate';
import AccessionRef from 'model/accession/AccessionRef';
const styles = (theme) => ({ const styles = (theme) => ({
root: { root: {
...@@ -134,6 +134,8 @@ interface IDetailInfoProps extends React.ClassAttributes<any> { ...@@ -134,6 +134,8 @@ interface IDetailInfoProps extends React.ClassAttributes<any> {
approveDataset?: (dataset: Dataset) => void; approveDataset?: (dataset: Dataset) => void;
rejectDataset?: (dataset: Dataset, needToRedirect?: boolean) => void; rejectDataset?: (dataset: Dataset, needToRedirect?: boolean) => void;
deleteDataset?: (dataset: Dataset) => any; deleteDataset?: (dataset: Dataset) => any;
loadAccessions: (page: number, pageSize: number) => void;
accessionRefs: Page<AccessionRef>;
} }
class DetailInfo extends React.Component<IDetailInfoProps, any> { class DetailInfo extends React.Component<IDetailInfoProps, any> {
...@@ -224,7 +226,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> { ...@@ -224,7 +226,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
} }
public render() { public render() {
const { classes, dataset, publishDataset, deleteDataset, t } = this.props; const { classes, dataset, publishDataset, deleteDataset, t, accessionRefs } = this.props;
if (! dataset) { if (! dataset) {
log('Waiting for dataset.'); log('Waiting for dataset.');
...@@ -453,11 +455,14 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> { ...@@ -453,11 +455,14 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
</Grid> </Grid>
) } ) }
{ dataset.accessionRefs && dataset.accessionRefs.length > 0 && ( { accessionRefs && accessionRefs.content && accessionRefs.content.length > 0 && (
<Grid item xs={ 12 } md={ 12 } lg={ 12 } className="p-10" id="dataset-accessions"> <Grid item xs={ 12 } md={ 12 } lg={ 12 } className="p-10" id="dataset-accessions">
<Section title={ t('datasets.public.c.datasetDisplay.accessionsEvaluated') }>