Commit 814f00c9 authored by Oleksii Savran's avatar Oleksii Savran
Browse files

Merge branch '233-dataset-subset-display-page-rematchaccessions' into 'master'

Dataset/Subset display page: rematchAccessions

Closes #233

See merge request genesys-pgr/genesys-ui!241
parents 7af39e83 05622bbc
...@@ -1100,6 +1100,7 @@ ...@@ -1100,6 +1100,7 @@
}, },
"datasetDisplay": { "datasetDisplay": {
"accessionsEvaluated": "Accessions evaluated", "accessionsEvaluated": "Accessions evaluated",
"rematch": "Rematch accessions",
"contact": "Data provider contact information", "contact": "Data provider contact information",
"creators": "Dataset creators", "creators": "Dataset creators",
"dataAndResources": "Data and resources", "dataAndResources": "Data and resources",
...@@ -1179,6 +1180,7 @@ ...@@ -1179,6 +1180,7 @@
"endDate": "Experiment end date" "endDate": "Experiment end date"
} }
} }
,"descriptorlists": { ,"descriptorlists": {
"common": { "common": {
"modelName": "Descriptor list", "modelName": "Descriptor list",
...@@ -1993,7 +1995,8 @@ ...@@ -1993,7 +1995,8 @@
"source": "Source" "source": "Source"
}, },
"subsetDisplay": { "subsetDisplay": {
"subsetCreators": "Subset creators" "subsetCreators": "Subset creators",
"rematch": "Rematch accessions"
} }
}, },
"f": { "f": {
......
...@@ -151,6 +151,7 @@ ...@@ -151,6 +151,7 @@
}, },
"datasetDisplay": { "datasetDisplay": {
"accessionsEvaluated": "Accessions evaluated", "accessionsEvaluated": "Accessions evaluated",
"rematch": "Rematch accessions",
"contact": "Data provider contact information", "contact": "Data provider contact information",
"creators": "Dataset creators", "creators": "Dataset creators",
"dataAndResources": "Data and resources", "dataAndResources": "Data and resources",
...@@ -229,4 +230,4 @@ ...@@ -229,4 +230,4 @@
"startDate": "Experiment start date", "startDate": "Experiment start date",
"endDate": "Experiment end date" "endDate": "Experiment end date"
} }
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ import { connect } from 'react-redux'; ...@@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles'; 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 { rematchDatasetAccessions, deleteDataset, publishDataset, rejectDataset, approveDataset } from 'datasets/actions/editor';
import {loadMoreAccessions, loadDataset} from 'datasets/actions/public'; import {loadMoreAccessions, loadDataset} from 'datasets/actions/public';
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
import { AccessionRef } from 'model/accession/AccessionRef'; import { AccessionRef } from 'model/accession/AccessionRef';
...@@ -34,6 +34,7 @@ interface IDatasetDetailProps extends React.ClassAttributes<any> { ...@@ -34,6 +34,7 @@ interface IDatasetDetailProps extends React.ClassAttributes<any> {
approveDataset: (dataset: Dataset) => void; approveDataset: (dataset: Dataset) => void;
rejectDataset: (dataset: Dataset, needToRedirect?: boolean) => void; rejectDataset: (dataset: Dataset, needToRedirect?: boolean) => void;
loadMoreAccessions: (uuid: string, page?: Page<AccessionRef>) => any; loadMoreAccessions: (uuid: string, page?: Page<AccessionRef>) => any;
rematchDatasetAccessions: (dataset: Dataset) => void;
mapLayers: MapLayer[]; mapLayers: MapLayer[];
} }
...@@ -66,7 +67,7 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> { ...@@ -66,7 +67,7 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> {
} }
public render() { public render() {
const { t, classes, loading, error, dataset, publishDataset, rejectDataset, approveDataset, deleteDataset, mapLayers } = this.props; const { t, classes, loading, error, dataset, publishDataset, rejectDataset, approveDataset, deleteDataset, rematchDatasetAccessions, mapLayers } = this.props;
return ( return (
<PageLayout> <PageLayout>
...@@ -87,6 +88,7 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> { ...@@ -87,6 +88,7 @@ class DatasetDetail extends React.Component<IDatasetDetailProps, any> {
approveDataset={ approveDataset } approveDataset={ approveDataset }
deleteDataset={ deleteDataset } deleteDataset={ deleteDataset }
loadAccessions={ this.loadMoreAccessions } loadAccessions={ this.loadMoreAccessions }
rematchDatasetAccessions={ rematchDatasetAccessions }
accessionRefs={ this.props.accessionRefs } accessionRefs={ this.props.accessionRefs }
mapLayers={ mapLayers } mapLayers={ mapLayers }
/> />
...@@ -120,6 +122,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({ ...@@ -120,6 +122,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
rejectDataset, rejectDataset,
approveDataset, approveDataset,
loadMoreAccessions, loadMoreAccessions,
rematchDatasetAccessions,
}, dispatch); }, dispatch);
export default translate()(connect(mapStateToProps, mapDispatchToProps)((withStyles as any)(styles)(DatasetDetail))); export default translate()(connect(mapStateToProps, mapDispatchToProps)((withStyles as any)(styles)(DatasetDetail)));
...@@ -140,6 +140,7 @@ interface IDetailInfoProps extends React.ClassAttributes<any> { ...@@ -140,6 +140,7 @@ interface IDetailInfoProps extends React.ClassAttributes<any> {
rejectDataset?: (dataset: Dataset, needToRedirect?: boolean) => void; rejectDataset?: (dataset: Dataset, needToRedirect?: boolean) => void;
deleteDataset?: (dataset: Dataset) => any; deleteDataset?: (dataset: Dataset) => any;
loadAccessions: (page: Page<AccessionRef>) => any; loadAccessions: (page: Page<AccessionRef>) => any;
rematchDatasetAccessions: (dataset: Dataset) => void;
accessionRefs: Page<AccessionRef>; accessionRefs: Page<AccessionRef>;
mapLayers: MapLayer[]; mapLayers: MapLayer[];
} }
...@@ -213,6 +214,14 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> { ...@@ -213,6 +214,14 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
rejectDataset(dataset, true); rejectDataset(dataset, true);
} }
private onRematch = (e) => {
e.preventDefault();
const {rematchDatasetAccessions, dataset} = this.props;
log('Rematching Accessions for dataset', dataset);
rematchDatasetAccessions(dataset);
}
private onDelete = (e) => { private onDelete = (e) => {
const { dataset, deleteDataset, t } = this.props; const { dataset, deleteDataset, t } = this.props;
...@@ -314,6 +323,11 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> { ...@@ -314,6 +323,11 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Button onClick={ this.onDelete } type="button">{ t('common:action.delete') }</Button> <Button onClick={ this.onDelete } type="button">{ t('common:action.delete') }</Button>
} }
{ dataset._permissions.manage && <Permissions clazz={ Dataset.clazz } id={ dataset.id }/> } { dataset._permissions.manage && <Permissions clazz={ Dataset.clazz } id={ dataset.id }/> }
<Authorize role="ROLE_ADMINISTRATOR">
<Button onClick={ this.onRematch } type="button">
{ t('datasets.public.c.datasetDisplay.rematch') }
</Button>
</Authorize>
</CardActions> </CardActions>
) } ) }
</Card> </Card>
......
...@@ -22,6 +22,7 @@ import {AccessionRef} from 'model/accession/AccessionRef'; ...@@ -22,6 +22,7 @@ import {AccessionRef} from 'model/accession/AccessionRef';
const apiListSubsets = createApiCaller(SubsetService.list, APPEND_SUBSETS); const apiListSubsets = createApiCaller(SubsetService.list, APPEND_SUBSETS);
const apiListSubsetAccessions = createApiCaller(SubsetService.listAccessions, APPEND_SUBSET_ACCESSIONS); const apiListSubsetAccessions = createApiCaller(SubsetService.listAccessions, APPEND_SUBSET_ACCESSIONS);
const apiLoadSubset = createApiCaller(SubsetService.get, RECEIVE_SUBSET); const apiLoadSubset = createApiCaller(SubsetService.get, RECEIVE_SUBSET);
const apiRematchAccessions = createApiCaller(SubsetService.rematchAccessions, RECEIVE_SUBSET);
export const loadMoreSubsets = (paged: FilteredPage<Subset>) => (dispatch, getState) => { export const loadMoreSubsets = (paged: FilteredPage<Subset>) => (dispatch, getState) => {
return dispatch(apiListSubsets(paged ? paged.filterCode : '', Page.nextPage(paged))) return dispatch(apiListSubsets(paged ? paged.filterCode : '', Page.nextPage(paged)))
...@@ -50,6 +51,16 @@ export const applyFilters = (filters: string | SubsetFilter, page: IPageRequest ...@@ -50,6 +51,16 @@ export const applyFilters = (filters: string | SubsetFilter, page: IPageRequest
}); });
}; };
export const rematchSubsetAccessions = (subset: Subset) => {
return (dispatch, getState) => {
return dispatch(apiRematchAccessions(subset.uuid, subset.version))
.then((saved) => {
dispatch(loadMoreAccessions(saved.uuid));
return saved;
});
};
};
export const loadSubset = (uuid: string) => (dispatch) => { export const loadSubset = (uuid: string) => (dispatch) => {
return dispatch(apiLoadSubset(uuid)); return dispatch(apiLoadSubset(uuid));
}; };
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
"source": "Source" "source": "Source"
}, },
"subsetDisplay": { "subsetDisplay": {
"subsetCreators": "Subset creators" "subsetCreators": "Subset creators",
"rematch": "Rematch accessions"
} }
}, },
"f": { "f": {
......
...@@ -3,7 +3,7 @@ import { translate } from 'react-i18next'; ...@@ -3,7 +3,7 @@ import { translate } from 'react-i18next';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {bindActionCreators} from 'redux'; import {bindActionCreators} from 'redux';
// Actions // Actions
import {loadMoreAccessions, loadSubset} from 'subsets/actions/public'; import {rematchSubsetAccessions, loadMoreAccessions, loadSubset} from 'subsets/actions/public';
import {unpublishSubset} from 'subsets/actions/editor'; import {unpublishSubset} from 'subsets/actions/editor';
import navigateTo from 'actions/navigation'; import navigateTo from 'actions/navigation';
// Models // Models
...@@ -29,6 +29,7 @@ interface IDisplayPageProps extends React.ClassAttributes<any> { ...@@ -29,6 +29,7 @@ interface IDisplayPageProps extends React.ClassAttributes<any> {
navigateTo: any; navigateTo: any;
unpublishSubset: (subset: Subset) => void; unpublishSubset: (subset: Subset) => void;
loadMoreAccessions: (uuid: string, page?: Page<AccessionRef>) => any; loadMoreAccessions: (uuid: string, page?: Page<AccessionRef>) => any;
rematchSubsetAccessions: (subset: Subset) => void;
accessionRefs: Page<AccessionRef>; accessionRefs: Page<AccessionRef>;
t: any; t: any;
} }
...@@ -70,7 +71,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> { ...@@ -70,7 +71,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
} }
public render() { public render() {
const { error, subset, loading, userRole, t, accessionRefs } = this.props; const { error, subset, loading, userRole, t, accessionRefs, rematchSubsetAccessions } = this.props;
const isActionsActive: boolean = userRole.findIndex((role) => role === 'ROLE_ADMINISTRATOR') !== -1 || (subset && subset.state === PublishState.REVIEWING); const isActionsActive: boolean = userRole.findIndex((role) => role === 'ROLE_ADMINISTRATOR') !== -1 || (subset && subset.state === PublishState.REVIEWING);
return ( return (
...@@ -92,6 +93,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> { ...@@ -92,6 +93,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
subset={ subset } subset={ subset }
accessions={ accessionRefs } accessions={ accessionRefs }
loadAccessions={ this.loadMoreAccessions } loadAccessions={ this.loadMoreAccessions }
rematchSubsetAccessions={ rematchSubsetAccessions }
/> />
} }
</div> </div>
...@@ -116,6 +118,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({ ...@@ -116,6 +118,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
navigateTo, navigateTo,
unpublishSubset, unpublishSubset,
loadMoreAccessions, loadMoreAccessions,
rematchSubsetAccessions,
}, dispatch); }, dispatch);
......
...@@ -19,6 +19,9 @@ import Loading from 'ui/common/Loading'; ...@@ -19,6 +19,9 @@ import Loading from 'ui/common/Loading';
import PagedLoader from 'ui/common/PagedLoader'; import PagedLoader from 'ui/common/PagedLoader';
import AccessionRefCard from 'accessions/ui/c/AccessionRefCard'; import AccessionRefCard from 'accessions/ui/c/AccessionRefCard';
import DownloadDialog from 'ui/common/download-dialog'; import DownloadDialog from 'ui/common/download-dialog';
import ButtonBar from 'ui/common/buttons/ButtonBar';
import {Button} from '@material-ui/core';
import Authorize from 'ui/common/authorized/Authorize';
const styles = (theme) => ({ const styles = (theme) => ({
accessionSection: { accessionSection: {
...@@ -37,6 +40,7 @@ interface IDetailInfoProps extends React.ClassAttributes<any> { ...@@ -37,6 +40,7 @@ interface IDetailInfoProps extends React.ClassAttributes<any> {
unpublishSubset?: (subset: Subset) => any; unpublishSubset?: (subset: Subset) => any;
deleteSubset?: (subset: Subset) => any; deleteSubset?: (subset: Subset) => any;
loadAccessions: (page: Page<AccessionRef>) => any; loadAccessions: (page: Page<AccessionRef>) => any;
rematchSubsetAccessions: (subset: Subset) => void;
accessions: Page<AccessionRef>; accessions: Page<AccessionRef>;
userRoles: string[]; userRoles: string[];
} }
...@@ -53,6 +57,13 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> { ...@@ -53,6 +57,13 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
this.setState({authenticated}); this.setState({authenticated});
} }
private onRematch = (e) => {
e.preventDefault();
const {subset, rematchSubsetAccessions} = this.props;
rematchSubsetAccessions(subset);
}
public render() { public render() {
const {classes, subset, t, accessions, loadAccessions} = this.props; const {classes, subset, t, accessions, loadAccessions} = this.props;
...@@ -73,11 +84,19 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> { ...@@ -73,11 +84,19 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<SubsetCard complete subset={ subset } <SubsetCard complete subset={ subset }
actions={ actions={
this.state.authenticated && this.state.authenticated &&
<DownloadDialog downloadUrl={ `/proxy/api/v1/subset/${subset.uuid}/download` } <ButtonBar>
slug="download-authenticated" <DownloadDialog
postParams={ { mcpd: 'mcpd' } } downloadUrl={ `/proxy/api/v1/subset/${subset.uuid}/download` }
buttonTitle={ `${t('common:action.download')} ${t('subsets.public.p.display.MCPD')}` } slug="download-authenticated"
/> postParams={ {mcpd: 'mcpd'} }
buttonTitle={ `${t('common:action.download')} ${t('subsets.public.p.display.MCPD')}` }
/>
<Authorize role="ROLE_ADMINISTRATOR">
<Button onClick={ this.onRematch } type="button">
{ t('subsets.public.c.subsetDisplay.rematch') }
</Button>
</Authorize>
</ButtonBar>
} }
/> />
<Grid container spacing={ 16 } className={ classes.accessionSection } justify={ 'space-between' }> <Grid container spacing={ 16 } className={ classes.accessionSection } justify={ 'space-between' }>
......
...@@ -8,14 +8,17 @@ import StepperTemplate from 'ui/common/stepper/StepperTemplate'; ...@@ -8,14 +8,17 @@ import StepperTemplate from 'ui/common/stepper/StepperTemplate';
// model // model
import Page from 'model/Page'; import Page from 'model/Page';
import Subset from 'model/subset/Subset';
import {AccessionRef} from 'model/accession/AccessionRef'; import {AccessionRef} from 'model/accession/AccessionRef';
// actions // actions
import {loadMoreAccessions} from 'subsets/actions/dashboard'; import {loadMoreAccessions} from 'subsets/actions/dashboard';
import {rematchSubsetAccessions} from 'subsets/actions/editor';
interface IReviewAndPublishStepProps extends React.ClassAttributes<any> { interface IReviewAndPublishStepProps extends React.ClassAttributes<any> {
loadMore: (uuid: string, page?: Page<AccessionRef>) => any; loadMore: (uuid: string, page?: Page<AccessionRef>) => any;
accessionRefs: Page<AccessionRef>; accessionRefs: Page<AccessionRef>;
rematchSubsetAccessions: (subset: Subset) => void;
uuid: string; uuid: string;
} }
...@@ -43,6 +46,7 @@ class ReviewAndPublishStep extends StepperTemplate<IReviewAndPublishStepProps> { ...@@ -43,6 +46,7 @@ class ReviewAndPublishStep extends StepperTemplate<IReviewAndPublishStepProps> {
<SubsetDisplay <SubsetDisplay
subset={ this.props.item } subset={ this.props.item }
accessions={ this.props.accessionRefs } accessions={ this.props.accessionRefs }
rematchSubsetAccessions={ this.props.rematchSubsetAccessions }
loadAccessions={ this.loadMoreAccessions } loadAccessions={ this.loadMoreAccessions }
/> />
) )
...@@ -54,6 +58,7 @@ const mapStateToProps = (state, ownProps) => ({ ...@@ -54,6 +58,7 @@ const mapStateToProps = (state, ownProps) => ({
const mapDispatchToProps = (dispatch) => bindActionCreators({ const mapDispatchToProps = (dispatch) => bindActionCreators({
loadMore: loadMoreAccessions, loadMore: loadMoreAccessions,
rematchSubsetAccessions,
}, dispatch); }, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(ReviewAndPublishStep); export default connect(mapStateToProps, mapDispatchToProps)(ReviewAndPublishStep);
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