Commit 5555cb44 authored by Matija Obreza's avatar Matija Obreza
Browse files

Accession filters: SAMPSTAT, MLSSTATUS, AVAILABLE

- Added missing key to mapped <PropertiesItem
parent e779d8ac
......@@ -107,17 +107,17 @@
"f": {
"accessions": {
"crops": "Crop name",
"acceNumb": "Accession number contains",
"acceNumb": "Accession number",
"seqNo": "Sequential number",
"sampStat": "Biological status",
"storage": "Type of germplasm storage",
"storage": "Storage",
"geo": {
"latitude": "Latitude",
"longitude": "Longitude",
"elevation": "Elevation"
},
"holder": {
"code" : "Institute code"
"code" : "Holder"
},
"taxa": {
"genus": "Genus",
......@@ -131,7 +131,10 @@
"genus": "Genus",
"species": "Species",
"subtaxa": "Subtaxon"
}
},
"sgsv": "Svalbard",
"mlsStatus": "MLS",
"available": "Available"
},
"subsets": {
"title": "Title"
......
......@@ -26,8 +26,8 @@ class PropertiesCard extends React.Component<IBundledProps, any> {
<Grid item md={ children ? 7 : 12 } sm={ 12 } style={ {width: '100%'} }>
<Properties>
{
propertiesList.map((property) => (
<PropertiesItem numeric title={ property.title }>
propertiesList.map((property, i) => (
<PropertiesItem key={ `${i}-${property.title}` } numeric title={ property.title }>
{ property.value && typeof property.value === 'number' ? t(`common:label.prettyNumber`, {value: property.value}) : property.value }
</PropertiesItem>
))
......
......@@ -25,7 +25,7 @@ class BooleanFilterInternal extends React.Component<IBooleanFilterInternal, any>
private handleChange = (event, value) => {
const { input } = this.props;
this.setState({ value });
input.onChange(value === '' ? null : value);
input.onChange(value === '' ? null : value === 'true');
}
public componentWillReceiveProps(nextProps) {
......
......@@ -112,15 +112,11 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
{ overviewsTerms && overviewsTerms.get('institute.country.code3') && overviewsTerms.get('institute.country.code3').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('institute.country.code3').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.institute country code3`) } small/>
}
{ overviewsTerms && overviewsTerms.get('cropName') && overviewsTerms.get('cropName').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('cropName').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.cropName`) } small/>
}
{ overviewsTerms && overviewsTerms.get('crop.shortName') && overviewsTerms.get('crop.shortName').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('crop.shortName').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.crop shortName`) } small/>
}
{ overviewsTerms && overviewsTerms.get('sampStat') && overviewsTerms.get('sampStat').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('sampStat')
.filter((term) => term.term !== 'other').map((term) => ({title: t(`accession.sampleStatus.${term.term}`), value: term.count })) } title={ t(`accession.overview.sampStat`) } small/>
{ overviewsTerms && overviewsTerms.get('cropName') && overviewsTerms.get('cropName').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('cropName').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.cropName`) } small/>
}
{ overviewsTerms && overviewsTerms.get('taxonomy.genus') && overviewsTerms.get('taxonomy.genus').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('taxonomy.genus').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.taxonomy genus`) } small/>
......@@ -128,30 +124,34 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
{ overviewsTerms && overviewsTerms.get('taxonomy.genusSpecies') && overviewsTerms.get('taxonomy.genusSpecies').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('taxonomy.genusSpecies').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.taxonomy genusSpecies`) } small/>
}
{ overviewsTerms && overviewsTerms.get('sampStat') && overviewsTerms.get('sampStat').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('sampStat')
.filter((term) => term.term !== 'other').map((term) => ({title: t(`accession.sampleStatus.${term.term}`), value: term.count })) } title={ t(`accession.overview.sampStat`) } small/>
}
{ overviewsTerms && overviewsTerms.get('storage') && overviewsTerms.get('storage').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('storage').map((term) => ({title: t(`accession.storage.${term.term}`), value: term.count })) } title={ t(`accession.overview.storage`) } small/>
}
{ overviewsTerms && overviewsTerms.get('countryOfOrigin.code3') && overviewsTerms.get('countryOfOrigin.code3').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('countryOfOrigin.code3').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.countryOfOrigin code3`) } small/>
}
{ overviewsTerms && overviewsTerms.get('donorCode') && overviewsTerms.get('donorCode').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('donorCode').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.donorCode`) } small/>
}
{ overviewsTerms && overviewsTerms.get('duplSite') && overviewsTerms.get('duplSite').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('duplSite').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.duplSite`) } small/>
}
{ overviewsTerms && overviewsTerms.get('breederCode') && overviewsTerms.get('breederCode').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('breederCode').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.breederCode`) } small/>
}
{ overviewsTerms && overviewsTerms.get('mlsStatus') && overviewsTerms.get('mlsStatus').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('mlsStatus').map((term) => ({title: term.term === '1' ? 'Yes' : 'No', value: term.count })) } title={ t(`accession.overview.mlsStatus`) } small/>
}
{ overviewsTerms && overviewsTerms.get('available') && overviewsTerms.get('available').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('available').map((term) => ({title: term.term === '1' ? 'Yes' : 'No', value: term.count })) } title={ t(`accession.overview.available`) } small/>
}
{ overviewsTerms && overviewsTerms.get('duplSite') && overviewsTerms.get('duplSite').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('duplSite').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.duplSite`) } small/>
}
{ overviewsTerms && overviewsTerms.get('sgsv') && overviewsTerms.get('sgsv').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('sgsv').map((term) => ({title: term.term === '1' ? 'Yes' : 'No', value: term.count })) } title={ t(`accession.overview.sgsv`) } small/>
}
{ overviewsTerms && overviewsTerms.get('storage') && overviewsTerms.get('storage').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('storage').map((term) => ({title: t(`accession.storage.${term.term}`), value: term.count })) } title={ t(`accession.overview.storage`) } small/>
}
{ overviewsTerms && overviewsTerms.get('breederCode') && overviewsTerms.get('breederCode').length > 2 &&
<PropertiesCard propertiesList={ overviewsTerms.get('breederCode').map((term) => ({title: term.term, value: term.count })) } title={ t(`accession.overview.breederCode`) } small/>
}
</GridLayout>
</PageContents>
</div>
......
......@@ -5,6 +5,7 @@ import { ACCESSION_FILTERFORM } from 'constants/accessions';
import FiltersBlock from 'ui/common/filter/FiltersBlock';
import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSearch';
import BooleanFilter from 'ui/common/filter/BooleanFilter';
import NumberFilter from 'ui/common/filter/NumberFilter';
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
......@@ -36,6 +37,11 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, ...other}) =
<CollapsibleComponentSearch title="Type of germplasm storage">
<StringArrFilter name="storage" options={ Accession.STORAGE } />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title="Status">
<BooleanFilter name="available" label="Available for distribution" />
<BooleanFilter name="mlsStatus" label="Included in MLS" />
<BooleanFilter name="sgsv" label="Backed up in SGSV" />
</CollapsibleComponentSearch>
</FiltersBlock>
);
};
......
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