Commit 9b814921 authored by Matija Obreza's avatar Matija Obreza

Merge branch '602-colors-for-filter-sections' into 'master'

Resolve "Colors for filter sections"

Closes #602

See merge request genesys-pgr/genesys-ui!591
parents c2d4f187 aa6548df
......@@ -25,16 +25,17 @@ import Validators from 'utilities/Validators';
const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode, autocomplete, terms, crops, countryCodes, t, ...other}) => {
// console.log('AccessionFilters', initialValues);
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('accessions.public.f.filtersTitle') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('accessions.public.f.historic') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.public.f.historic') }>
<BooleanFilter
name="historic"
terms={ terms && terms.get('historic') }
notNull
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('accessions.public.f._textPlaceholder') }
......@@ -71,11 +72,11 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
<StringFilter name="accessionNumber" searchType="contains" label={ t('accessions.common.acceNumb') } placeholder="IRGC"/>
<NumberFilter name="seqNo" label={ t('accessions.public.f.seqNumber') } />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('common:f.dateSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.dateSearch') }>
<DateFilter name="createdDate" label={ t('common:f.createdDate') }/>
<DateFilter name="lastModifiedDate" label={ t('common:f.lastModifiedDate') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.public.f.crop') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.public.f.crop') }>
<StringArrFilter
name="crop"
valueField="shortName"
......@@ -84,7 +85,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
terms={ terms && terms.get('crop.shortName') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.common.taxonomy') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.common.taxonomy') }>
<AutocompleteFilter
filterCode={ filterCode }
autocomplete={ autocomplete }
......@@ -110,7 +111,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
/>
<StringFilter name="taxonomy.subtaxa" searchType="contains" label={ t('accessions.public.f.subtaxon') } placeholder=""/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.public.f.originOfMaterial') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.public.f.originOfMaterial') }>
<AutocompleteFilter
filterCode={ filterCode }
autocomplete={ autocomplete }
......@@ -125,7 +126,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
<NumberFilter name="geo.longitude" label={ t('geo.common.longitude') } />
<NumberFilter name="geo.elevation" label={ t('accessions.public.f.elevation') } />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.common.sampStat') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.common.sampStat') }>
<StringArrFilter
name="sampStat"
options={ Accession.SAMPSTAT }
......@@ -134,7 +135,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
terms={ terms && terms.get('sampStat') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.common.storageType') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.common.storageType') }>
<StringArrFilter
name="storage"
options={ Accession.STORAGE }
......@@ -143,7 +144,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
terms={ terms && terms.get('storage') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.public.f.status') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.public.f.status') }>
<BooleanFilter
name="available"
label={ t('accessions.public.f.available') }
......@@ -173,7 +174,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
notNull
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.public.f.referenced') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.public.f.referenced') }>
<StringArrFilter
name="subsets"
label={ t('accessions.model.subsets') }
......@@ -187,7 +188,7 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
validate={ [Validators.uuid] }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.public.f.climate') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('accessions.public.f.climate') }>
<NumberFilter name="geo.climate.bio1" label={ t('accessions.climate.bio1') } />
<NumberFilter name="geo.climate.bio2" label={ t('accessions.climate.bio2') } />
<NumberFilter name="geo.climate.bio3" label={ t('accessions.climate.bio3') } />
......
......@@ -10,12 +10,13 @@ import TextFilter from 'ui/common/filter/TextFilter';
import DateFilter from 'ui/common/filter/DateFilter';
const ActivityPostFilters = ({ handleSubmit, initialValues, initialize, t, ...other }) => {
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('cms.admin.f.filterTitle') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<TextFilter name="_text" label={ t('common:f.keyword') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('common:f.dateSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.dateSearch') }>
<DateFilter name="lastModifiedDate" label={ t('common:f.lastModifiedDate') }/>
</CollapsibleComponentSearch>
</FiltersBlock>
......
......@@ -12,9 +12,10 @@ import BooleanFilter from 'ui/common/filter/BooleanFilter';
import TextFilter from 'ui/common/filter/TextFilter';
const ArticleFilters = ({ handleSubmit, initialValues, initialize, t, ...other }) => {
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('cms.admin.f.filterTitle') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('accessions.public.f._textPlaceholder') }
......@@ -22,10 +23,10 @@ const ArticleFilters = ({ handleSubmit, initialValues, initialize, t, ...other }
/>
<StringFilter name="title" label={ t('cms.admin.f.title') } searchType="contains"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('cms.admin.f.isTemplate') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('cms.admin.f.isTemplate') }>
<BooleanFilter name="template"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('cms.admin.f.meta') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('cms.admin.f.meta') }>
<StringArrFilter name="slug" label="cms.admin.f.slug" placeholder="blurb"/>
<StringArrFilter name="lang" label="cms.admin.f.lang" placeholder="en"/>
</CollapsibleComponentSearch>
......
......@@ -19,55 +19,58 @@ import InputAdornment from '@material-ui/core/InputAdornment';
// <StringArrFilter name="language" label="Language" placeholder="Language"/>
const DatasetFilters = ({ handleSubmit, initialize, t, terms, crops, ...other }) => (
<FiltersBlock title={ t('datasets.common.modelName_plural') } handleSubmit={ handleSubmit } initialize={ initialize }{ ...other }>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('datasets.public.f._textPlaceholder') }
hint={ t('public.f._textHint') }
endAdornment={
<InputAdornment position="end">
<Link to="/content/help/how-to-use-genesys">
<IconButton type="button">
<HelpOutlineIcon style={ { fontSize: '1.5rem' } }/>
</IconButton>
</Link>
</InputAdornment>
}
/>
</CollapsibleComponentSearch>
{ /*<TextFilter name="_text" label={ t('datasets.public.f.keywordSearch') } placeholder={ t('datasets.public.f.rice') } className="pb-10 pr-20 pl-20 pt-10"/> */ }
{ /*<TextFilter name="descriptors._text" label={ t('datasets.public.f.traitKeywords') } placeholder={ t('datasets.public.f.rice') } className="pt-10 pr-20 pl-20 pb-20"/> */ }
<CollapsibleComponentSearch title={ t('datasets.public.f.partner') }>
<StringArrFilter name="owner.wiewsCodes" label={ t('datasets.public.f.faoWiews') } placeholder="COL003"/>
<PartnerFilter name="owner" label="datasets.public.f.partner"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('datasets.public.f.evaluationSite') }>
<StringArrFilter name="locations.userCountry" label={ t('datasets.public.f.countryEv') } placeholder={ t('datasets.public.f.countryPlaceholder') }/>
<NumberFilter name="locations.decimalLatitude" label={ t('datasets.public.f.latitude') }/>
<NumberFilter name="locations.decimalLongitude" label={ t('datasets.public.f.longitude') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('datasets.public.f.crop') }>
<StringArrFilter
name="crops"
valueField="shortName"
labelField="name"
options={ crops }
terms={ terms && terms.get('crops') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('datasets.public.f.accession') }>
<StringArrFilter name="accessionRefs.genus" label={ t('datasets.public.f.genus') } placeholder={ t('datasets.public.f.genusPlaceholder') }/>
<StringFilter name="accessionRefs.acceNumb" searchType="contains" label={ t('datasets.public.f.accNumber') } placeholder="IRGC100"/>
<StringArrFilter name="accessionRefs.instCode" label={ t('datasets.public.f.faoWiews') } placeholder="PHL001"/>
<StringArrFilter name="accessionRefs.doi" label={ t('datasets.public.f.accDoi') } placeholder="10.xxxx/yyyyy"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('datasets.public.f.licence') }>
<LicenceFilter name={ t('datasets.public.f.rights') } className="p-20"/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
const DatasetFilters = ({ handleSubmit, initialize, t, terms, crops, ...other }) => {
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('datasets.common.modelName_plural') } handleSubmit={ handleSubmit } initialize={ initialize }{ ...other }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('datasets.public.f._textPlaceholder') }
hint={ t('public.f._textHint') }
endAdornment={
<InputAdornment position="end">
<Link to="/content/help/how-to-use-genesys">
<IconButton type="button">
<HelpOutlineIcon style={ { fontSize: '1.5rem' } }/>
</IconButton>
</Link>
</InputAdornment>
}
/>
</CollapsibleComponentSearch>
{ /*<TextFilter name="_text" label={ t('datasets.public.f.keywordSearch') } placeholder={ t('datasets.public.f.rice') } className="pb-10 pr-20 pl-20 pt-10"/> */ }
{ /*<TextFilter name="descriptors._text" label={ t('datasets.public.f.traitKeywords') } placeholder={ t('datasets.public.f.rice') } className="pt-10 pr-20 pl-20 pb-20"/> */ }
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('datasets.public.f.partner') }>
<StringArrFilter name="owner.wiewsCodes" label={ t('datasets.public.f.faoWiews') } placeholder="COL003"/>
<PartnerFilter name="owner" label="datasets.public.f.partner"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('datasets.public.f.evaluationSite') }>
<StringArrFilter name="locations.userCountry" label={ t('datasets.public.f.countryEv') } placeholder={ t('datasets.public.f.countryPlaceholder') }/>
<NumberFilter name="locations.decimalLatitude" label={ t('datasets.public.f.latitude') }/>
<NumberFilter name="locations.decimalLongitude" label={ t('datasets.public.f.longitude') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('datasets.public.f.crop') }>
<StringArrFilter
name="crops"
valueField="shortName"
labelField="name"
options={ crops }
terms={ terms && terms.get('crops') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('datasets.public.f.accession') }>
<StringArrFilter name="accessionRefs.genus" label={ t('datasets.public.f.genus') } placeholder={ t('datasets.public.f.genusPlaceholder') }/>
<StringFilter name="accessionRefs.acceNumb" searchType="contains" label={ t('datasets.public.f.accNumber') } placeholder="IRGC100"/>
<StringArrFilter name="accessionRefs.instCode" label={ t('datasets.public.f.faoWiews') } placeholder="PHL001"/>
<StringArrFilter name="accessionRefs.doi" label={ t('datasets.public.f.accDoi') } placeholder="10.xxxx/yyyyy"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('datasets.public.f.licence') }>
<LicenceFilter name={ t('datasets.public.f.rights') } className="p-20"/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
};
export default translate()(reduxForm({
destroyOnUnmount: false,
......
......@@ -16,42 +16,45 @@ import InputAdornment from '@material-ui/core/InputAdornment';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
const DescriptorListFilters = ({ handleSubmit, initialize, t, terms, crops, ...other }) => (
<FiltersBlock title={ t('descriptorlists.public.f.title') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('descriptorlists.public.f._textPlaceholder') }
hint={ t('public.f._textHint') }
endAdornment={
<InputAdornment position="end">
<Link to="/content/help/how-to-use-genesys">
<IconButton type="button">
<HelpOutlineIcon style={ { fontSize: '1.5rem' } }/>
</IconButton>
</Link>
</InputAdornment>
}
/>
</CollapsibleComponentSearch>
{ /*<TextFilter name="_text" label={ t('descriptorlists.public.f.keywordSearch') } placeholder="mardi rice" className="p-20"/>*/ }
<CollapsibleComponentSearch title={ t('descriptorlists.public.common.partner') }>
<PartnerFilter name="owner" label={ t('descriptorlists.public.common.partner') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptorlists.public.common.crop') }>
<StringArrFilter
name="crop"
valueField="shortName"
labelField="name"
options={ crops }
terms={ terms && terms.get('crop') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptorlists.public.common.publisher') }>
<StringFilter name="publisher" label={ t('descriptorlists.public.f.originalPublisher') } placeholder="IBPGR" searchType="contains"/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
const DescriptorListFilters = ({ handleSubmit, initialize, t, terms, crops, ...other }) => {
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('descriptorlists.public.f.title') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('descriptorlists.public.f._textPlaceholder') }
hint={ t('public.f._textHint') }
endAdornment={
<InputAdornment position="end">
<Link to="/content/help/how-to-use-genesys">
<IconButton type="button">
<HelpOutlineIcon style={ { fontSize: '1.5rem' } }/>
</IconButton>
</Link>
</InputAdornment>
}
/>
</CollapsibleComponentSearch>
{ /*<TextFilter name="_text" label={ t('descriptorlists.public.f.keywordSearch') } placeholder="mardi rice" className="p-20"/>*/ }
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptorlists.public.common.partner') }>
<PartnerFilter name="owner" label={ t('descriptorlists.public.common.partner') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptorlists.public.common.crop') }>
<StringArrFilter
name="crop"
valueField="shortName"
labelField="name"
options={ crops }
terms={ terms && terms.get('crop') }
/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptorlists.public.common.publisher') }>
<StringFilter name="publisher" label={ t('descriptorlists.public.f.originalPublisher') } placeholder="IBPGR" searchType="contains"/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
};
export default translate()(reduxForm({
destroyOnUnmount: false,
......
......@@ -13,34 +13,37 @@ import Descriptor from 'model/catalog/Descriptor';
import DescriptorListPicker from './DescriptorListPicker';
import PartnerFilter from 'partners/ui/c/PartnerFilter';
const DescriptorFilters = ({ handleSubmit, initialize, t, ...other }) => (
<FiltersBlock title={ t('descriptors.common.modelName_plural') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<TextFilter name="_text" label={ t('common:f.keyword') } placeholder={ t('descriptors.public.f.rice') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptors.public.f.partner') }>
<PartnerFilter name="owner" label={ t('descriptors.public.f.partner') } />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptors.public.f.metadata') }>
<StringArrFilter name="columnName" label={ t('descriptors.public.f.columnName') } placeholder={ t('descriptors.public.f.columnName') }/>
<StringArrFilter name="versionTag" label={ t('descriptors.public.f.versionTag') } placeholder={ t('descriptors.public.f.versionTag') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptors.public.f.descriptorList') }>
<DescriptorListPicker name="descriptorLists.uuid" label={ t('descriptors.public.f.select') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptors.public.f.crop') }>
<CropFilter/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptors.public.f.category') }>
<StringArrFilter name="category" options={ Descriptor.CATEGORIES } byKey/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('descriptors.public.f.tidbits') }>
<BooleanFilter name="used" label={ t('descriptors.public.f.isUsed') } notNull/>
<BooleanFilter name="key" label={ t('descriptors.public.f.key') }/>
<StringArrFilter name="uom" label={ t('descriptors.public.f.uom') } placeholder={ t('descriptors.public.f.unitOfMeasurement') }/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
const DescriptorFilters = ({ handleSubmit, initialize, t, ...other }) => {
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('descriptors.common.modelName_plural') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<TextFilter name="_text" label={ t('common:f.keyword') } placeholder={ t('descriptors.public.f.rice') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptors.public.f.partner') }>
<PartnerFilter name="owner" label={ t('descriptors.public.f.partner') } />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptors.public.f.metadata') }>
<StringArrFilter name="columnName" label={ t('descriptors.public.f.columnName') } placeholder={ t('descriptors.public.f.columnName') }/>
<StringArrFilter name="versionTag" label={ t('descriptors.public.f.versionTag') } placeholder={ t('descriptors.public.f.versionTag') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptors.public.f.descriptorList') }>
<DescriptorListPicker name="descriptorLists.uuid" label={ t('descriptors.public.f.select') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptors.public.f.crop') }>
<CropFilter/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptors.public.f.category') }>
<StringArrFilter name="category" options={ Descriptor.CATEGORIES } byKey/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('descriptors.public.f.tidbits') }>
<BooleanFilter name="used" label={ t('descriptors.public.f.isUsed') } notNull/>
<BooleanFilter name="key" label={ t('descriptors.public.f.key') }/>
<StringArrFilter name="uom" label={ t('descriptors.public.f.uom') } placeholder={ t('descriptors.public.f.unitOfMeasurement') }/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
};
export default translate()(reduxForm({
enableReinitialize: true,
......
......@@ -12,18 +12,18 @@ import BooleanFilter from 'ui/common/filter/BooleanFilter';
import PartnerFilter from 'partners/ui/c/PartnerFilter';
const AccessionFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => {
// console.log('AccessionFilters', initialValues);
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('institutes.public.f.title') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('institutes.common.accessionsInGenesys') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('institutes.common.accessionsInGenesys') }>
<BooleanFilter name="accessions" notNull/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('common:f.textSearch') }>
<StringArrFilter name="code" label={ t('institutes.common.instituteCode') } placeholder="NGA039"/>
<StringFilter name="fullName" label={ t('institutes.public.f.instituteName') } searchType="contains" placeholder={ t('institutes.public.f.instituteNamePlaceholder') }/>
<PartnerFilter name="owner" label="institutes.public.f.partner"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('geo.common.location') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('geo.common.location') }>
<StringArrFilter name="country.code3" label="geo.common.country" placeholder={ t('institutes.public.f.locationPlaceholder') }/>
</CollapsibleComponentSearch>
</FiltersBlock>
......
......@@ -16,13 +16,14 @@ import InputAdornment from '@material-ui/core/InputAdornment';
const SubsetFilters = ({handleSubmit, initialValues, initialize, t, terms, crops, ...other}) => {
// console.log('SubsetFilters', initialValues);
let sectionIndex: number = 0;
return (
<FiltersBlock title={ t('subsets.public.f.filterTitle') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title={ t('subsets.public.f.partner') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('subsets.public.f.partner') }>
<StringArrFilter name="institutes" label={ t('subsets.public.f.institute') } placeholder={ t('subsets.public.f.institutePlaceholder') }/>
<PartnerFilter name="owner" label="subsets.public.f.partner"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('subsets.public.f.textSearch') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('subsets.public.f.textSearch') }>
<TextFilter name="_text"
label={ t('public.f._text') }
placeholder={ t('subsets.public.f._textPlaceholder') }
......@@ -40,7 +41,7 @@ const SubsetFilters = ({handleSubmit, initialValues, initialize, t, terms, crops
<StringFilter name="title" searchType="contains" label={ t('subsets.public.f.title') } placeholder={ t('subsets.public.f.titlePlaceholder') }/>
<StringFilter name="description" searchType="contains" label={ t('subsets.public.f.description') } placeholder={ t('subsets.public.f.descriptionPlaceholder') }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('subsets.public.f.crop') }>
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title={ t('subsets.public.f.crop') }>
<StringArrFilter
name="crops"
valueField="shortName"
......
......@@ -4,10 +4,23 @@ import PlayArrow from '@material-ui/icons/PlayArrow';
import {withStyles} from '@material-ui/core/styles';
import Collapse from '@material-ui/core/Collapse';
import Divider from '@material-ui/core/Divider';
import SECTION_COLORS from 'ui/common/filter/Colors';
/**
* Darken RGBA color by increasing opacity
* @param rgba `#006db410`
*/
const darken = (rgba: string): string => {
const rgb: string = rgba.substring(0, 7);
const a: number = parseInt(rgba.substring(7, 9), 16);
// console.log(`RGBA=${rgba} RGB=${rgb} alpha=${a}`);
return `${ rgb }${ (a + 10).toString(16) }`;
};
interface ICollapsibleComponentSearch extends React.ClassAttributes<any> {
classes: any;
title: string;
sectionIndex?: number;
onToggleCollapsed?: (show: boolean) => void;
collapsed?: boolean;
t: any;
......@@ -50,11 +63,12 @@ class CollapsibleComponentSearch extends React.Component<ICollapsibleComponentSe
public render() {
const {classes, title, children, t, titleClassName = ''} = this.props;
const {classes, title, children, sectionIndex, t, titleClassName = ''} = this.props;
const style = sectionIndex !== undefined ? { backgroundColor: SECTION_COLORS[sectionIndex % SECTION_COLORS.length] } : undefined;
const headerStyle = sectionIndex !== undefined ? { backgroundColor: darken(SECTION_COLORS[sectionIndex % SECTION_COLORS.length]) } : undefined;
return (
<div>
<div className={ `pl-20 pr-15 ${titleClassName}` } onClick={ this.toggleCollapsed }>
<div style={ style }>
<div className={ `pl-20 pr-15 ${titleClassName}` } style={ headerStyle } onClick={ this.toggleCollapsed }>
<span className={ classes.title }>{ t(title) }</span>
<PlayArrow className={ `${ classes.collapseArrow } ${ this.state.show ? classes.arrowOpened : classes.arrowClosed }` } />
</div>
......
/**
* We're using these colors for different sections of filters.
*/
const SECTION_COLORS = [
'#006db408', // '#ffffb340',
'#88ba4208', // '#bebada40',
// '#fbb4ae50', // '#8dd3c740',
// '#decbe450', // '#fb807240',
// '#fed9a650', // '#80b1d340',
// '#ffffcc50', // '#fdb46240',
// '#e5d8bd50', // '#b3de6940',
// '#fddaec50', // '#fccde540',
// '#f2f2f250', // '#d9d9d940',
];
export default SECTION_COLORS;
......@@ -13,20 +13,21 @@ import DateFilter from 'ui/common/filter/DateFilter';
import Validators from 'utilities/Validators';
const UserFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => {
let sectionIndex: number = 0;
return (
<FiltersBlock title="user.admin.f.title" handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
<CollapsibleComponentSearch title="common:f.textSearch">
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title="common:f.textSearch">
<StringFilter name="email" searchType="contains" label="user.common.emailAddress" placeholder="name@domain.com"/>
<StringArrFilter name="uuid" label="common:label.UUID" placeholder="ihope-youk-noww-hatyouredoing" validate={ [Validators.uuid] }/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title="user.common.roleLabel">
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title="user.common.roleLabel">
<StringArrFilter name="role" options={ User.USERROLES } byKey />
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title="common:f.dateSearch">
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title="common:f.dateSearch">
<DateFilter name="createdDate" label="common:f.createdDate"/>
<DateFilter name="lastLogin" label="user.admin.f.lastLogin"/>
</CollapsibleComponentSearch>
<CollapsibleComponentSearch title="user.common.statusLabel">
<CollapsibleComponentSearch sectionIndex={ sectionIndex++ } title="user.common.statusLabel">
<BooleanFilter name="locked" label="user.admin.f.locked" notNull/>
<BooleanFilter name="active" label="user.admin.f.enabled" notNull/>
<BooleanFilter name="expired" label="user.admin.f.expired" notNull/>
......
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