Commit 47495791 authored by Matija Obreza's avatar Matija Obreza

PGRFA Networks: Restored browse and overview buttons

- API call is fast enough
parent 8cf150ed
......@@ -44,6 +44,7 @@ class AccessionFilter {
public aegis?: boolean;
public subsets?: string[];
public datasets?: string[];
public networks?: string[];
public NOT?: AccessionFilter;
public NULL?: string[];
......
......@@ -6,7 +6,7 @@ import { withTranslation } from 'react-i18next';
// actions
import {loadMoreNetworkInstitutes, loadNetwork} from 'networks/actions/public';
import { deleteNetwork } from 'networks/actions/admin';
import { applyOverviewFiltersAsync as applyOverviewFilters } from 'accessions/actions/public';
import { applyFiltersAsync as applyFilters, applyOverviewFiltersAsync as applyOverviewFilters } from 'accessions/actions/public';
import { navigateTo } from 'actions/navigation';
// model
import ApiCall from 'model/ApiCall';
......@@ -82,10 +82,21 @@ class DisplayPage extends React.Component<IDisplayPageProps> {
return <InstituteCard key={ s.code } index={ index } institute={ s }/>;
}
private clickNetworkBrowse = () => {
const { networkCall: { data: networkDetails }, applyFilters} = this.props;
const filter: AccessionFilter = { networks: [networkDetails.network.slug] };
applyFilters(filter);
}
private clickNetworkOverview = () => {
const { networkCall: { data: networkDetails }, applyOverviewFilters} = this.props;
const filter: AccessionFilter = { networks: [networkDetails.network.slug] };
applyOverviewFilters(filter);
}
private applyNetworkOverviewFilter = (filters: AccessionFilter) => {
private applyNetworkOverviewFilter = (filters?: AccessionFilter) => {
const { networkCall: { data: networkDetails }, applyOverviewFilters} = this.props;
const filter = { ...filters, networks: [networkDetails.network.slug] };
const filter: AccessionFilter = { ...filters, networks: [networkDetails.network.slug] };
applyOverviewFilters(filter);
}
......@@ -120,6 +131,8 @@ class DisplayPage extends React.Component<IDisplayPageProps> {
title={ network.title || network.slug }
cardActions={
<ButtonBar barLabelText={ t('networks.public.p.display.actions') }>
<Button onClick={ this.clickNetworkBrowse }>{ t('networks.public.p.display.browseAccessions') }</Button>
<Button onClick={ this.clickNetworkOverview }>{ t('networks.public.p.display.overview') }</Button>
<Authorize role="ROLE_ADMINISTRATOR">
<NetworkLink to={ network } edit><Button>{ t('common:action.edit') }</Button></NetworkLink>
</Authorize>
......@@ -182,6 +195,7 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
loadMoreNetworkInstitutes,
deleteNetwork,
applyOverviewFilters,
applyFilters,
navigateTo,
}, dispatch);
......
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