Commit 28de79de authored by Oleksii Savran's avatar Oleksii Savran Committed by Viacheslav Pavlov

Genesys partners

- removed PartnerFilters
- removed'Applying filters...'/`Filters applied.` snackbar on partnerBrowsePage loading
- removed filterCode from routes
parent 69c23a12
......@@ -24,7 +24,7 @@ class Partner implements IUserPermissions {
public version: number;
public static DEFAULT_SORT = {
property: 'title',
property: 'name',
direction: SortDirection.ASC,
};
public static SORT_OPTIONS = {
......
......@@ -2,7 +2,6 @@
import { loadPartnerNames } from 'actions/uuidDecoder';
import { addFilterCode } from 'actions/filterCode';
import navigateTo from 'actions/navigation';
import { showSnackbar } from 'actions/snackbar';
import {createApiCaller} from 'actions/ApiCall';
// Constants
......@@ -73,10 +72,12 @@ export const updateRoute = (paged: FilteredPage<Partner>) => (dispatch) => {
export const applyFilters = (filters: string | PartnerFilter, page: IPageRequest = { page: 0 }) => (dispatch) => {
console.log('Applying new filter', filters, page);
dispatch(showSnackbar('Applying filters...'));
return dispatch(apiListPartners(filters, page))
return dispatch(apiListPartners(filters, {
direction: Partner.DEFAULT_SORT.direction,
properties: Partner.DEFAULT_SORT.property,
...page,
}))
.then((paged) => {
dispatch(updateRoute(paged));
dispatch(showSnackbar(`Filters applied.`));
});
};
......@@ -6,7 +6,6 @@ export const RECEIVE_PARTNER_INSTITUTES = 'App/Partner/RECEIVE_PARTNER_INSTITUTE
// export const DELETE_PARTNER = 'App/DELETE_PARTNER';
// Listing
export const PARTNER_FILTERFORM = 'Form/Partner/PARTNER_FILTERFORM';
export const APPEND_PARTNERS = 'App/Partner/APPEND_PARTNERS';
// Action to update user's own list of partners
......
......@@ -4,7 +4,7 @@ import { ROLE_ADMINISTRATOR, ROLE_USER } from 'constants/userRoles';
const publicRoutes = [
{
path: '/partners/:filterCode(v.+)?',
path: '/partners',
component: Loadable({
loader: () => import(/* webpackMode:"lazy", webpackChunkName: "partners" */'partners/ui/BrowsePage'),
}),
......
......@@ -11,7 +11,6 @@ import PagedLoader from 'ui/common/PagedLoader';
import Loading from 'ui/common/Loading';
import PaginationComponent from 'ui/common/pagination';
import PartnerFilters from './c/Filters';
import PartnerCard from './c/PartnerCard';
import PrettyFilters from 'ui/common/filter/PrettyFilters';
import Authorize from 'ui/common/authorized/Authorize';
......@@ -35,9 +34,7 @@ class PartnerListPage extends BrowsePageTemplate<Partner> {
const stillLoading: boolean = (!paged || !paged.content);
return (
<PageLayout sidebar={
<PartnerFilters initialValues={ paged && paged.filter || {} } onSubmit={ this.myApplyFilters } t={ t }/>
}>
<PageLayout>
<ScrollToTopOnMount/>
<PageTitle title={ t('partners.public.p.browse.title') }/>
<ContentHeader title={ t('partners.public.p.browse.title') } subtitle={ t('partners.public.p.browse.subtitle') }/>
......
import * as React from 'react';
import { reduxForm } from 'redux-form';
import { PARTNER_FILTERFORM } from 'partners/constants';
import FiltersBlock from 'ui/common/filter/FiltersBlock';
import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSearch';
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
const PartnerFilters = ({ handleSubmit, initialValues, initialize, t, ...other }) => (
<FiltersBlock title={ t('partners.common.modelName_plural') } handleSubmit={ handleSubmit } initialize={ initialize } t={ t } { ...other }>
<CollapsibleComponentSearch title={ t('common:f.textSearch') }>
<StringArrFilter
name="shortName"
label={ t('partners.public.f.acronym') }
placeholder={ t('partners.public.f.ICRISAT') }
/>
<StringFilter
name="name"
searchType="contains"
label={ t('common:label.title') }
placeholder={ t('partners.public.f.international') }
/>
<StringFilter
name="description"
searchType="contains"
label={ t('common:label.description') }
placeholder={ t('partners.public.f.partnerDescription') }
/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
export default reduxForm({
enableReinitialize: true,
form: PARTNER_FILTERFORM,
})(PartnerFilters);
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