Commit 0d1ced6f authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '85-genesys-ui-missing-buttons-etc' into 'master'

Added missing buttons

Closes #85

See merge request genesys-pgr/genesys-ui!122
parents 2787d9ea 4685e1b0
......@@ -477,7 +477,11 @@
"lastUpdates": "Last updates of passport data",
"PDCI": "PDCI: Passport data completeness index",
"readPDCI": "Read about Passport Data Completeness Index",
"pdciScore": "Average PDCI score for {{count, number}} accessions is {{avg, number}}, with minimum score of {{min, number}} and maximum score of {{max, number}}."
"pdciScore": "Average PDCI score for {{count, number}} accessions is {{avg, number}}, with minimum score of {{min, number}} and maximum score of {{max, number}}.",
"browseAccessions": "Browse accessions",
"MCPD": "MCPD",
"PDCI_short": "PDCI",
"zip": "ZIP"
}
}
},
......@@ -613,7 +617,9 @@
"subTitle": "As you explore the millions of accessions held in Genesys, you can create your own list to keep track of the results of your search. Your selections are stored here so you can return to them at any time.",
"sendRequest": "Send request",
"clearMyList": "Clear list",
"noAccessions": "You have not added any accessions to the list."
"noAccessions": "You have not added any accessions to the list.",
"zip": "ZIP",
"MCPD": "MCPD"
}
}
},
......
......@@ -26,7 +26,11 @@
"lastUpdates": "Last updates of passport data",
"PDCI": "PDCI: Passport data completeness index",
"readPDCI": "Read about Passport Data Completeness Index",
"pdciScore": "Average PDCI score for {{count, number}} accessions is {{avg, number}}, with minimum score of {{min, number}} and maximum score of {{max, number}}."
"pdciScore": "Average PDCI score for {{count, number}} accessions is {{avg, number}}, with minimum score of {{min, number}} and maximum score of {{max, number}}.",
"browseAccessions": "Browse accessions",
"MCPD": "MCPD",
"PDCI_short": "PDCI",
"zip": "ZIP"
}
}
},
......
......@@ -6,7 +6,7 @@ import { Link } from 'react-router-dom';
// Actions
import { loadInstitute } from 'institutes/actions/public';
import { applyFilters } from 'accessions/actions/public';
import { applyFilters, applyOverviewFilters } from 'accessions/actions/public';
// Models
import FaoInstituteDetails from 'model/genesys/InstituteDetails';
......@@ -41,6 +41,7 @@ interface IDisplayPageProps extends React.ClassAttributes<any> {
error: any;
loadInstitute: any;
applyFilters: any;
applyOverviewFilters: any;
}
const mobile = ['sm', 'xs'] as Breakpoint[];
......@@ -61,6 +62,12 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
applyFilters(filter);
}
private applyFilterForOverview = () => {
const { institute, applyOverviewFilters } = this.props;
const filter = {holder: {code: [ institute.details.code ]}};
applyOverviewFilters(filter);
}
private applyLastModifyDateFilter = (lastUpdateDate) => {
const { institute, applyFilters} = this.props;
const startOfDay = new Date(`${lastUpdateDate[0]}-${lastUpdateDate[1]}-${lastUpdateDate[2]}`);
......@@ -132,14 +139,20 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
</PropertiesItem>
</Properties>
{ institute.details._permissions.manage &&
<CardActions className="container-spacing-vertical mt-15">
<CardActions className="container-spacing-vertical mt-15">
<Button onClick={ this.applyInstituteCodeFilter }>{ t('institutes.public.p.display.browseAccessions') }</Button>
<Button onClick={ this.applyFilterForOverview }>{ t('accessions.tab.overview') }</Button>
<Button onClick={ () => null }>{ `${t('common:action.download')} ${t('institutes.public.p.display.MCPD')}` }</Button>
<Button onClick={ () => null }>{ `${t('common:action.download')} ${t('institutes.public.p.display.PDCI_short')}` }</Button>
<Button onClick={ () => null }>{ `${t('common:action.download')} ${t('institutes.public.p.display.zip')}` }</Button>
{ institute.details._permissions.manage &&
<Link to={ `/dashboard/wiews/${institute.details.code}/edit` }>
<Button variant="contained">{ t('common:action.edit') }</Button>
</Link>
</Link> }
{ institute.details._permissions.manage &&
<Permissions clazz={ FaoInstitute.clazz } id={ institute.details.id }/>
</CardActions>
}
}
</CardActions>
</MainSection>
{ institute.blurb && institute.blurb.body &&
......@@ -268,6 +281,7 @@ const mapStateToProps = (state, ownProps) => ({
const mapDispatchToProps = (dispatch) => bindActionCreators({
loadInstitute,
applyFilters,
applyOverviewFilters,
}, dispatch);
......
......@@ -6,7 +6,9 @@
"subTitle": "As you explore the millions of accessions held in Genesys, you can create your own list to keep track of the results of your search. Your selections are stored here so you can return to them at any time.",
"sendRequest": "Send request",
"clearMyList": "Clear list",
"noAccessions": "You have not added any accessions to the list."
"noAccessions": "You have not added any accessions to the list.",
"zip": "ZIP",
"MCPD": "MCPD"
}
}
},
......
......@@ -77,6 +77,8 @@ class MyListPage extends React.Component<IMyListPageProps> {
<div>
<ActionButton title={ t('list.public.p.browse.sendRequest') } action={ this.sendRequestAction }/>
<ActionButton title={ t('list.public.p.browse.clearMyList') } action={ this.clearListAction }/>
<ActionButton title={ `${t('common:action.download')} ${t('list.public.p.browse.zip')}` } action={ () => null }/>
<ActionButton title={ `${t('common:action.download')} ${t('list.public.p.browse.MCPD')}` } action={ () => null }/>
</div>
}
/>
......
......@@ -6,14 +6,15 @@ interface IActionButtonProps extends React.ClassAttributes<any> {
title: string;
action: any;
style?: any;
className?: string;
}
class ActionButton extends React.Component<IActionButtonProps, any> {
public render() {
const { title, action, variant = 'contained', style } = this.props;
const { title, action, variant = 'contained', style, className } = this.props;
return (
<Button style={ style } variant={ variant } onClick={ action }>
<Button className={ className } style={ style } variant={ variant } onClick={ action }>
{ title }
</Button>
);
......
......@@ -16,6 +16,7 @@ const styles = (theme) => ({
[theme.breakpoints.down('sm')]: {
display: 'flex' as 'flex',
width: '100%',
marginRight: '1em',
},
},
},
......
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