Commit b606b384 authored by Oleksii Savran's avatar Oleksii Savran Committed by Matija Obreza

DiversityTreeDisplay: Optional displaying of metadata

parent 78e55bb6
......@@ -12,17 +12,14 @@ import { applyFiltersAsync as applyFilters, loadAccessionsMapInfo as applyMapFil
// models
import DiversityTree from '@genesys/client/model/DiversityTree';
import DiversityTreeAccessionRef from '@genesys/client/model/DiversityTreeAccessionRef';
// import Accession from 'model/accession/Accession';
import AccessionFilter from '@genesys/client/model/accession/AccessionFilter';
import { IPageRequest } from '@genesys/client/model/FilteredPage';
import Page from '@genesys/client/model/Page';
// import {AccessionRef} from 'model/accession/AccessionRef';
import { PublishState } from '@genesys/client/model/common.model';
// ui
import Grid from '@material-ui/core/Grid';
import Loading from 'ui/common/Loading';
import PagedLoader from 'ui/common/PagedLoader';
// import DownloadDialog, { DOWNLOAD_AUTH_SLUG } 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';
......@@ -33,26 +30,20 @@ import Divider from '@material-ui/core/Divider/Divider';
import DiversityTreeCard from './DiversityTreeCard';
import Permissions from 'ui/common/permission/Permissions';
import DiversityTreeAccessionRefCard from './DiversityTreeAccessionRefCard';
// import ActionButton from 'ui/common/buttons/ActionButton';
const styles = (theme) => ({
section: {
marginTop: '16px',
},
accessionCard: {
// marginBottom: '8px',
},
buttonGreen: theme.buttons.green,
});
interface IDetailInfoProps extends React.ClassAttributes<any>, WithTranslation {
// listAccessions: (filter: string | AccessionFilter, page: IPageRequest) => Promise<Page<Accession>>;
unpublishDiversityTree: (divtree: DiversityTree) => void;
editDiversityTree: (divtree: DiversityTree) => void;
approveDiversityTree: (divtree: DiversityTree) => void;
deleteDiversityTree: (divtree: DiversityTree) => void;
// addAllToMyList: (divtree: DiversityTree) => Promise<any>;
classes: any;
divtree: DiversityTree;
......@@ -222,74 +213,71 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
</ButtonBar>
) }
/>
<Grid container spacing={ 0 } className={ classes.section }>
<Grid item xs={ 12 }>
<Section title={ t('divtree.public.c.diversityTreeDisplay.diversityTreeMetadata') }>
{ divtree.creators && divtree.creators.length > 0 &&
<div>
<div className="pt-15 pb-15 pl-20 pr-20">
<h4 className="font-bold m-0">{ t('divtree.public.c.diversityTreeDisplay.divTreeContributors') }</h4>
</div>
<Divider/>
<Grid container spacing={ 0 } className="p-20">
<Grid item xs={ 12 }>
<Properties>
{ divtree.creators && divtree.creators.map((creator) => creator && (
<PropertiesItem key={ creator.id }>
<span>
<b>{ creator.fullName }</b>
{ creator.institutionalAffiliation && <span> { creator.institutionalAffiliation }</span> }
</span>
</PropertiesItem>
)) }
</Properties>
</Grid>
</Grid>
<Divider/>
</div>
}
<div>
<div className="pt-15 pb-15 pl-20 pr-20">
<h4 className="font-bold m-0">
{ t('divtree.public.c.diversityTreeDisplay.dataAndResources') }
</h4>
</div>
<Divider/>
<Grid container spacing={ 0 } className="p-20">
<Grid item xs={ 12 }>
<Properties>
{ /* <PropertiesItem key={ divtree.uuid } title={
<Authorize role="ROLE_USER" withTooltip>
<DownloadDialog
downloadUrl={ `${apiUrl}/api/v1/subset/${subset.uuid}/download` }
slug={ DOWNLOAD_AUTH_SLUG }
postParams={ {mcpd: 'mcpd'} }
buttonTitle={ `${t('common:action.download')} ${t('subsets.public.p.display.MCPD')}` }
variant="contained"
btnClasses={ classes.buttonGreen }
/>
</Authorize>
}>
<p>{ t(`subsets.public.c.subsetDisplay.mcpdPasportData`) }</p>
<p>{ `MCPD - ${subset.uuid}.xlsx` }</p>
</PropertiesItem> */ }
<PropertiesItem title={
<Button onClick={ this.onBrowseAccessions } variant="contained">{ t('divtree.public.c.diversityTreeDisplay.browse') }</Button>
}>
<p>{ t(`divtree.public.c.diversityTreeDisplay.browseDescription`) }</p>
</PropertiesItem>
<PropertiesItem title={
<Button onClick={ this.onShowMap } variant="contained">{ t('divtree.public.c.diversityTreeDisplay.map') }</Button>
}>
<p>{ t(`divtree.public.c.diversityTreeDisplay.mapDescription`) }</p>
</PropertiesItem>
</Properties>
</Grid>
</Grid>
</div>
</Section>
{ ((accessions && accessions.content && accessions.content.length !== 0) || (divtree.creators && divtree.creators.length > 0)) &&
<Grid container spacing={ 0 } className={ classes.section }>
<Grid item xs={ 12 }>
<Section title={ t('divtree.public.c.diversityTreeDisplay.diversityTreeMetadata') }>
{ divtree.creators && divtree.creators.length > 0 &&
<div>
<div className="pt-15 pb-15 pl-20 pr-20">
<h4 className="font-bold m-0">{t('divtree.public.c.diversityTreeDisplay.divTreeContributors')}</h4>
</div>
<Divider/>
<Grid container spacing={0} className="p-20">
<Grid item xs={12}>
<Properties>
{ divtree.creators && divtree.creators.map((creator) => creator && (
<PropertiesItem key={ creator.id }>
<span>
<b>{ creator.fullName }</b>
{ creator.institutionalAffiliation && <span> { creator.institutionalAffiliation }</span> }
</span>
</PropertiesItem>
)) }
</Properties>
</Grid>
</Grid>
<Divider/>
</div>
}
{ accessions && accessions.content && accessions.content.length !== 0 &&
<div>
<div className="pt-15 pb-15 pl-20 pr-20">
<h4 className="font-bold m-0">
{ t('divtree.public.c.diversityTreeDisplay.dataAndResources') }
</h4>
</div>
<Divider/>
<Grid container spacing={ 0 } className="p-20">
<Grid item xs={ 12 }>
<Properties>
<PropertiesItem
title={
<Button onClick={ this.onBrowseAccessions } variant="contained">
{ t('divtree.public.c.diversityTreeDisplay.browse') }
</Button>
}
>
<p>{ t(`divtree.public.c.diversityTreeDisplay.browseDescription`) }</p>
</PropertiesItem>
<PropertiesItem
title={
<Button onClick={ this.onShowMap } variant="contained">
{ t('divtree.public.c.diversityTreeDisplay.map') }
</Button>
}
>
<p>{ t(`divtree.public.c.diversityTreeDisplay.mapDescription`) }</p>
</PropertiesItem>
</Properties>
</Grid>
</Grid>
</div>
}
</Section>
</Grid>
</Grid>
</Grid>
}
<Grid container spacing={ 2 } className="mt-5" justify={ 'space-between' }>
{ ! accessions ? <Loading /> :
<Grid item xs={ 12 } className="p-10">
......@@ -297,9 +285,6 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<SectionHeader
title={ t('divtree.public.c.diversityTreeDisplay.accessions') }
subTitle={ t('divtree.public.c.diversityTreeDisplay.listOfAccessions') }
// actions={
// <ActionButton variant="contained" sync action={ this.addAllToMyListHandler } title={ t('accessions.public.c.accessionCard.addToMyList') } />
// }
/>
}
<PagedLoader
......
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