Skip to content
Snippets Groups Projects
Commit a5e8cf78 authored by esikkala's avatar esikkala
Browse files

One action for setting facet options

parent 996cc6e8
No related branches found
No related tags found
No related merge requests found
Showing with 153 additions and 182 deletions
......@@ -11,8 +11,8 @@ export const FETCH_BY_URI_FAILED = 'FETCH_BY_URI_FAILED';
export const UPDATE_INSTANCE = 'UPDATE_INSTANCE';
export const FETCH_FACET = 'FETCH_FACET';
export const FETCH_FACET_FAILED = 'FETCH_FACET_FAILED';
export const UPDATE_FACET = 'UPDATE_FACET';
export const UPDATE_FILTER = 'UPDATE_FILTER';
export const UPDATE_FACET_VALUES = 'UPDATE_FACET_VALUES';
export const UPDATE_FACET_OPTION = 'UPDATE_FACET_OPTION';
export const OPEN_MARKER_POPUP = 'OPEN_MARKER_POPUP';
export const SHOW_ERROR = 'SHOW_ERROR';
......@@ -60,21 +60,21 @@ export const updateInstance = ({ resultClass, instance }) => ({
type: UPDATE_INSTANCE,
resultClass, instance
});
export const fetchFacet = ({ facetClass, id, sortBy, sortDirection }) => ({
export const fetchFacet = ({ facetClass, facetID }) => ({
type: FETCH_FACET,
facetClass, id, sortBy, sortDirection
facetClass, facetID
});
export const fetchFacetFailed = (facetClass, id, error, message) => ({
type: FETCH_FACET_FAILED,
facetClass, id, error, message
});
export const updateFacet = ({ facetClass, id, distinctValueCount, values, flatValues, sortBy, sortDirection }) => ({
type: UPDATE_FACET,
facetClass, id, distinctValueCount, values, flatValues, sortBy, sortDirection
export const updateFacetValues = ({ facetClass, id, distinctValueCount, values, flatValues }) => ({
type: UPDATE_FACET_VALUES,
facetClass, id, distinctValueCount, values, flatValues
});
export const updateFilter = ({ facetClass, property, value }) => ({
type: UPDATE_FILTER,
facetClass, property, value
export const updateFacetOption = ({ facetClass, facetID, option, value }) => ({
type: UPDATE_FACET_OPTION,
facetClass, facetID, option, value
});
export const openMarkerPopup = uri => ({
type: OPEN_MARKER_POPUP,
......
......@@ -51,33 +51,23 @@ class FacetBar extends React.Component {
return (
<Paper key={id} className={classes.facetContainer}>
<FacetHeader
label={facets[id].label}
property={id}
facetID={id}
facet={facets[id]}
facetClass={this.props.facetClass}
resultClass={this.props.resultClass}
hierarchical={false}
distinctValueCount={facets[id].distinctValueCount}
sortBy={facets[id].sortBy}
sortDirection={facets[id].sortDirection}
sortButton={facets[id].sortButton}
spatialFilterButton={facets[id].spatialFilterButton}
filterType={facets[id].filterType}
fetchFacet={this.props.fetchFacet}
updateFacetOption={this.props.updateFacetOption}
/>
<div className={classes[facets[id].containerClass]}>
<Tree
facetFunctionality={true}
property={id}
data={facets[id].values}
facetID={id}
facet={facets[id]}
facetClass={this.props.facetClass}
sortBy={facets[id].sortBy}
sortDirection={facets[id].sortDirection}
fetchFacet={this.props.fetchFacet}
fetchingFacet={facets[id].isFetching}
updateFilter={this.props.updateFilter}
resultClass={this.props.resultClass}
facetUpdateID={facetUpdateID}
updatedFacet={updatedFacet}
searchField={facets[id].searchField}
fetchFacet={this.props.fetchFacet}
updateFacetOption={this.props.updateFacetOption}
/>
</div>
</Paper>
......@@ -94,7 +84,7 @@ FacetBar.propTypes = {
facetClass: PropTypes.string.isRequired,
resultClass: PropTypes.string.isRequired,
fetchFacet: PropTypes.func.isRequired,
updateFilter: PropTypes.func.isRequired
updateFacetOption: PropTypes.func.isRequired
};
export default withStyles(styles)(FacetBar);
......@@ -51,29 +51,18 @@ class FacetHeader extends React.Component {
this.setState({ anchorEl: event.currentTarget });
};
handleSortOnClick = (sortBy, isSelected) => () => {
handleSortOnClick = () => () => {
this.setState({ anchorEl: null });
let sortDirection = '';
if (isSelected) {
sortDirection = this.props.sortDirection === 'asc' ? 'desc' : 'asc';
} else {
if (sortBy === 'prefLabel') {
sortDirection = 'asc';
} else if (sortBy === 'instanceCount') {
sortDirection = 'desc';
}
}
this.props.fetchFacet({
facetClass: this.props.facetClass,
id: this.props.property,
sortBy: sortBy,
sortDirection: sortDirection
});
// this.props.fetchFacet({
// facetClass: this.props.facetClass,
// facetID: this.props.facetID,
// });
};
handleFilterTypeOnClick = () => () => {
this.setState({ anchorEl: null });
history.push({ pathname: `/${this.props.resultClass}/${this.props.filterType}`});
history.push({ pathname: `/${this.props.resultClass}/${this.props.facet.filterType}`});
}
handleMenuClose = () => {
......@@ -82,33 +71,34 @@ class FacetHeader extends React.Component {
renderFacetMenu = () => {
const { anchorEl } = this.state;
const { sortButton, spatialFilterButton, sortBy, filterType } = this.props.facet;
const open = Boolean(anchorEl);
let menuButtons = [];
if (this.props.sortButton) {
if (sortButton) {
menuButtons.push({
id: 'prefLabel',
menuItemText: 'Sort alphabetically',
selected: this.props.sortBy === 'prefLabel' ? true : false,
selected: sortBy === 'prefLabel' ? true : false,
onClickHandler: this.handleSortOnClick
});
menuButtons.push({
id: 'instanceCount',
menuItemText: `Sort by number of ${this.props.resultClass}`,
selected: this.props.sortBy === 'instanceCount' ? true : false,
selected: sortBy === 'instanceCount' ? true : false,
onClickHandler: this.handleSortOnClick
});
}
if (this.props.spatialFilterButton) {
if (spatialFilterButton) {
menuButtons.push({
id: 'uriFilter',
menuItemText: `Filter by name`,
selected: this.props.filterType === 'uri' ? true : false,
selected: filterType === 'uri' ? true : false,
onClickHandler: this.handleFilterTypeOnClick
});
menuButtons.push({
id: 'spatialFilter',
menuItemText: `Filter by bounding box`,
selected: this.props.filterType === 'spatial' ? true : false,
selected: filterType === 'spatial' ? true : false,
onClickHandler: this.handleFilterTypeOnClick
});
}
......@@ -131,7 +121,7 @@ class FacetHeader extends React.Component {
onClose={this.handleMenuClose}
>
{menuButtons.map(button => (
<MenuItem key={button.id} selected={button.selected} onClick={button.onClickHandler(button.id, button.selected)}>
<MenuItem key={button.id} selected={button.selected} onClick={button.onClickHandler}>
{button.menuItemText}
</MenuItem>
))}
......@@ -142,11 +132,12 @@ class FacetHeader extends React.Component {
render() {
const { classes } = this.props;
const { label, sortButton, spatialFilterButton } = this.props.facet;
return (
<Paper className={classes.headingContainer}>
<Typography variant="h6">{this.props.label} </Typography>
<Typography variant="h6">{label} </Typography>
<div className={classes.facetHeaderButtons}>
{(this.props.sortButton || this.props.spatialFilterButton) && this.renderFacetMenu()}
{(sortButton || spatialFilterButton) && this.renderFacetMenu()}
</div>
</Paper>
);
......@@ -155,17 +146,12 @@ class FacetHeader extends React.Component {
FacetHeader.propTypes = {
classes: PropTypes.object.isRequired,
label: PropTypes.string.isRequired,
property: PropTypes.string.isRequired,
facetID: PropTypes.string.isRequired,
facet: PropTypes.object.isRequired,
facetClass: PropTypes.string.isRequired,
resultClass: PropTypes.string.isRequired,
sortButton: PropTypes.bool.isRequired,
spatialFilterButton: PropTypes.bool.isRequired,
filterType: PropTypes.string.isRequired,
distinctValueCount: PropTypes.number.isRequired,
sortBy: PropTypes.string.isRequired,
sortDirection: PropTypes.string.isRequired,
fetchFacet: PropTypes.func.isRequired
fetchFacet: PropTypes.func.isRequired,
updateFacetOption: PropTypes.func.isRequired
};
export default withStyles(styles)(FacetHeader);
......@@ -74,33 +74,25 @@ class Tree extends Component {
}
componentDidMount = () => {
if (this.props.facetFunctionality) {
this.props.fetchFacet({
facetClass: this.props.facetClass,
id: this.props.property,
sortBy: this.props.sortBy,
sortDirection: this.props.sortDirection
});
} else {
this.props.fetchData();
}
this.props.fetchFacet({
facetClass: this.props.facetClass,
facetID: this.props.facetID,
});
}
componentDidUpdate = prevProps => {
if (prevProps.data != this.props.data) {
if (prevProps.facet.values != this.props.facet.values) {
this.setState({
treeData: this.props.data
treeData: this.props.facet.values
});
}
if (this.props.updatedFacet !== null
&& this.props.updatedFacet !== this.props.property
&& this.props.updatedFacet !== this.props.facetID
&& prevProps.facetUpdateID !== this.props.facetUpdateID) {
// console.log(`fetching new values for ${this.props.property}`)
this.props.fetchFacet({
facetClass: this.props.facetClass,
id: this.props.property,
sortBy: this.props.sortBy,
sortDirection: this.props.sortDirection
facetID: this.props.facetID,
});
}
}
......@@ -116,9 +108,10 @@ class Tree extends Component {
},
});
this.setState({ treeData: newTreeData });
this.props.updateFilter({
this.props.updateFacetOption({
facetClass: this.props.facetClass,
property: this.props.property,
facetID: this.props.facetID,
option: this.props.facet.filterType,
value: treeObj.node.id
});
};
......@@ -188,8 +181,10 @@ class Tree extends Component {
render() {
const { classes } = this.props;
const { searchString, searchFocusIndex, searchFoundCount } = this.state;
const { classes, facet } = this.props;
const { isFetching, searchField } = facet;
//console.log(this.props.data)
// Case insensitive search of `node.title`
......@@ -217,13 +212,13 @@ class Tree extends Component {
return (
<React.Fragment>
{this.props.fetchingFacet ?
{isFetching ?
<div className={classes.spinnerContainer}>
<CircularProgress style={{ color: purple[500] }} thickness={5} />
</div>
:
<React.Fragment>
{this.props.searchField &&
{searchField &&
<div className={classes.facetSearchContainer}>
<Input
placeholder={`Search...`}
......@@ -253,7 +248,7 @@ class Tree extends Component {
}
</div>
}
<div className={this.props.searchField ? classes.treeContainerWithSearchField : classes.treeContainer }>
<div className={searchField ? classes.treeContainerWithSearchField : classes.treeContainer }>
<SortableTree
treeData={this.state.treeData}
onChange={treeData => this.setState({ treeData })}
......@@ -294,17 +289,12 @@ class Tree extends Component {
Tree.propTypes = {
classes: PropTypes.object.isRequired,
facetFunctionality: PropTypes.bool.isRequired,
searchField: PropTypes.bool.isRequired,
data: PropTypes.array.isRequired,
facetID: PropTypes.string.isRequired,
facet: PropTypes.object.isRequired,
facetClass: PropTypes.string,
fetchData: PropTypes.func,
resultClass: PropTypes.string,
fetchFacet: PropTypes.func,
property: PropTypes.string,
sortBy: PropTypes.string,
sortDirection: PropTypes.string,
fetchingFacet: PropTypes.bool,
updateFilter: PropTypes.func,
updateFacetOption: PropTypes.func,
facetUpdateID: PropTypes.number,
updatedFacet: PropTypes.string,
};
......
......@@ -63,7 +63,7 @@ let Manuscripts = props => {
mapMode={'cluster'}
variant='productionPlaces'
showInstanceCountInClusters={true}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
property={'productionPlace'}
/>}
/>
......@@ -98,7 +98,7 @@ Manuscripts.propTypes = {
updatePage: PropTypes.func.isRequired,
sortResults: PropTypes.func.isRequired,
routeProps: PropTypes.object.isRequired,
updateFilter: PropTypes.func.isRequired
updateFacetOption: PropTypes.func.isRequired
};
export default Manuscripts;
......@@ -24,7 +24,7 @@ import {
fetchByURI,
fetchFacet,
sortResults,
updateFilter,
updateFacetOption,
updatePage,
showError
} from '../actions';
......@@ -95,7 +95,7 @@ let SemanticPortal = (props) => {
facetClass='manuscripts'
resultClass='manuscripts'
fetchFacet={props.fetchFacet}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
/>
</Grid>
<Grid item sm={12} md={9} className={classes.resultsContainer}>
......@@ -108,7 +108,7 @@ let SemanticPortal = (props) => {
fetchResults={props.fetchResults}
fetchByURI={props.fetchByURI}
updatePage={props.updatePage}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
sortResults={props.sortResults}
routeProps={routeProps}
/>
......@@ -127,7 +127,7 @@ let SemanticPortal = (props) => {
facetClass='works'
resultClass='works'
fetchFacet={props.fetchFacet}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
/>
</Grid>
<Grid item sm={12} md={9} className={classes.resultsContainer}>
......@@ -158,7 +158,7 @@ let SemanticPortal = (props) => {
facetClass='people'
resultClass='people'
fetchFacet={props.fetchFacet}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
/>
</Grid>
<Grid item sm={12} md={9} className={classes.resultsContainer}>
......@@ -190,7 +190,7 @@ let SemanticPortal = (props) => {
facetClass='organizations'
resultClass='organizations'
fetchFacet={props.fetchFacet}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
/>
</Grid>
<Grid item sm={12} md={9} className={classes.resultsContainer}>
......@@ -222,7 +222,7 @@ let SemanticPortal = (props) => {
facetClass='places'
resultClass='places'
fetchFacet={props.fetchFacet}
updateFilter={props.updateFilter}
updateFacetOption={props.updateFacetOption}
/>
</Grid>
<Grid item sm={12} md={9} className={classes.resultsContainer}>
......@@ -277,7 +277,7 @@ const mapDispatchToProps = ({
fetchByURI,
fetchFacet,
sortResults,
updateFilter,
updateFacetOption,
updatePage,
showError
});
......@@ -302,7 +302,7 @@ SemanticPortal.propTypes = {
fetchByURI: PropTypes.func.isRequired,
sortResults: PropTypes.func.isRequired,
updatePage: PropTypes.func.isRequired,
updateFilter: PropTypes.func.isRequired,
updateFacetOption: PropTypes.func.isRequired,
fetchFacet: PropTypes.func.isRequired,
showError: PropTypes.func.isRequired
};
......
......@@ -12,18 +12,18 @@ import {
FETCH_BY_URI_FAILED,
FETCH_FACET,
FETCH_FACET_FAILED,
//SHOW_ERROR,
updatePaginatedResults,
updateResults,
updateInstance,
updateFacet,
updateFacetValues,
} from '../actions';
const apiUrl = (process.env.NODE_ENV === 'development')
? 'http://localhost:3001/api/'
: `http://${location.hostname}/api/`;
const backendErrorText = 'Cannot connect to the MMM Knowledge Base. A data conversion process might be running. Please try again later.';
const backendErrorText = `Cannot connect to the MMM Knowledge Base.
A data conversion process might be running. Please try again later.`;
const fetchPaginatedResultsEpic = (action$, state$) => action$.pipe(
ofType(FETCH_PAGINATED_RESULTS),
......@@ -122,9 +122,12 @@ const fetchFacetEpic = (action$, state$) => action$.pipe(
ofType(FETCH_FACET),
withLatestFrom(state$),
mergeMap(([action, state]) => {
const { facetClass, id, sortBy, sortDirection } = action;
const { facetClass, facetID } = action;
const facets = state[`${facetClass}Facets`].facets;
const facet = facets[facetID];
const { sortBy, sortDirection } = facet;
const params = stateToUrl({
facets: state[`${facetClass}Facets`].facets,
facets: facets,
facetClass: null,
page: null,
pagesize: null,
......@@ -132,16 +135,14 @@ const fetchFacetEpic = (action$, state$) => action$.pipe(
sortDirection: sortDirection,
variant: null
});
const requestUrl = `${apiUrl}${action.facetClass}/facet/${id}?${params}`;
const requestUrl = `${apiUrl}${action.facetClass}/facet/${facetID}?${params}`;
return ajax.getJSON(requestUrl).pipe(
map(res => updateFacet({
map(res => updateFacetValues({
facetClass: facetClass,
id: id,
id: facetID,
distinctValueCount: res.distinctValueCount,
values: res.values,
flatValues: res.flatValues,
sortBy: sortBy,
sortDirection: sortDirection
flatValues: res.flatValues
})),
catchError(error => of({
type: FETCH_FACET_FAILED,
......
......@@ -42,11 +42,17 @@ export const updateSortBy = (state, action) => {
}
};
export const updateFilter = (state, action) => {
let { property, value } = action;
const oldFacet = state.facets[property];
export const updateFacetOption = (state, action) => {
if (action.option === 'uriFilter' || action.option === 'spatialFilter') {
return updateFacetFilter(state, action);
}
};
const updateFacetFilter = (state, action) => {
const { facetID, value } = action;
const oldFacet = state.facets[facetID];
let newFacet = {};
if (oldFacet.filterType === 'uri') {
if (oldFacet.filterType === 'uriFilter') {
let newUriFilter = oldFacet.uriFilter;
if (newUriFilter.has(value)) {
newUriFilter.delete(value);
......@@ -54,22 +60,22 @@ export const updateFilter = (state, action) => {
newUriFilter.add(value);
}
newFacet = {
...state.facets[property],
...state.facets[facetID],
uriFilter: newUriFilter
};
} else if (oldFacet.filterType === 'spatial') {
} else if (oldFacet.filterType === 'spatialFilter') {
newFacet = {
...state.facets[property],
...state.facets[facetID],
spatialFilter: value
};
}
return {
...state,
updatedFacet: property,
updatedFacet: facetID,
facetUpdateID: ++state.facetUpdateID,
facets: {
...state.facets,
[ property ]: newFacet
[ facetID ]: newFacet
}
};
};
......@@ -99,8 +105,8 @@ export const fetchFacet = (state, action) => {
...state,
facets: {
...state.facets,
[ action.id ]: {
...state.facets[action.id],
[ action.facetID ]: {
...state.facets[action.facetID],
isFetching: true
}
}
......@@ -112,8 +118,8 @@ export const fetchFacetFailed = (state, action) => {
...state,
facets: {
...state.facets,
[ action.id ]: {
...state.facets[action.id],
[ action.facetID ]: {
...state.facets[action.facetID],
isFetching: false,
}
},
......@@ -127,7 +133,7 @@ export const fetchFacetFailed = (state, action) => {
};
};
export const updateFacet = (state, action) => {
export const updateFacetValues = (state, action) => {
return {
...state,
facets: {
......@@ -137,8 +143,6 @@ export const updateFacet = (state, action) => {
distinctValueCount: action.distinctValueCount,
values: action.values,
flatValues: action.flatValues || [],
sortBy: action.sortBy,
sortDirection: action.sortDirection,
isFetching: false
}
}
......
import {
FETCH_FACET,
FETCH_FACET_FAILED,
UPDATE_FACET,
UPDATE_FILTER,
UPDATE_FACET_VALUES,
UPDATE_FACET_OPTION,
} from '../actions';
import {
updateFilter,
fetchFacet,
fetchFacetFailed,
updateFacet
updateFacetValues,
updateFacetOption,
} from './helpers';
export const INITIAL_STATE = {
......@@ -29,7 +29,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: false,
containerClass: 'three',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set()
},
productionPlace: {
......@@ -46,7 +46,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: true,
containerClass: 'ten',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set(),
spatialFilter: {}
},
......@@ -64,7 +64,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: true,
containerClass: 'ten',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set()
},
// language: {
......@@ -87,10 +87,10 @@ const manuscriptsFacets = (state = INITIAL_STATE, action) => {
return fetchFacet(state, action);
case FETCH_FACET_FAILED:
return fetchFacetFailed(state, action);
case UPDATE_FACET:
return updateFacet(state, action);
case UPDATE_FILTER:
return updateFilter(state, action);
case UPDATE_FACET_VALUES:
return updateFacetValues(state, action);
case UPDATE_FACET_OPTION:
return updateFacetOption(state, action);
default:
return state;
}
......
import {
FETCH_FACET,
FETCH_FACET_FAILED,
UPDATE_FACET,
UPDATE_FILTER,
UPDATE_FACET_VALUES,
UPDATE_FACET_OPTION,
} from '../actions';
import {
updateFilter,
fetchFacet,
fetchFacetFailed,
updateFacet
updateFacetValues,
updateFacetOption,
} from './helpers';
export const INITIAL_STATE = {
......@@ -29,7 +29,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: false,
containerClass: 'five',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set()
},
}
......@@ -42,10 +42,10 @@ const organizationsFacets = (state = INITIAL_STATE, action) => {
return fetchFacet(state, action);
case FETCH_FACET_FAILED:
return fetchFacetFailed(state, action);
case UPDATE_FACET:
return updateFacet(state, action);
case UPDATE_FILTER:
return updateFilter(state, action);
case UPDATE_FACET_VALUES:
return updateFacetValues(state, action);
case UPDATE_FACET_OPTION:
return updateFacetOption(state, action);
default:
return state;
}
......
import {
FETCH_FACET,
FETCH_FACET_FAILED,
UPDATE_FACET,
UPDATE_FILTER,
UPDATE_FACET_VALUES,
UPDATE_FACET_OPTION,
} from '../actions';
import {
updateFilter,
fetchFacet,
fetchFacetFailed,
updateFacet
updateFacetValues,
updateFacetOption,
} from './helpers';
export const INITIAL_STATE = {
......@@ -46,7 +46,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: true,
containerClass: 'ten',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set()
},
}
......@@ -59,10 +59,10 @@ const peopleFacets = (state = INITIAL_STATE, action) => {
return fetchFacet(state, action);
case FETCH_FACET_FAILED:
return fetchFacetFailed(state, action);
case UPDATE_FACET:
return updateFacet(state, action);
case UPDATE_FILTER:
return updateFilter(state, action);
case UPDATE_FACET_VALUES:
return updateFacetValues(state, action);
case UPDATE_FACET_OPTION:
return updateFacetOption(state, action);
default:
return state;
}
......
import {
FETCH_FACET,
FETCH_FACET_FAILED,
UPDATE_FACET,
UPDATE_FILTER,
UPDATE_FACET_VALUES,
UPDATE_FACET_OPTION,
} from '../actions';
import {
updateFilter,
fetchFacet,
fetchFacetFailed,
updateFacet
updateFacetValues,
updateFacetOption,
} from './helpers';
export const INITIAL_STATE = {
......@@ -29,7 +29,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: false,
containerClass: 'five',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set()
},
area: {
......@@ -46,7 +46,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: true,
containerClass: 'ten',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set(),
spatialFilter: {}
},
......@@ -60,10 +60,10 @@ const placesFacets = (state = INITIAL_STATE, action) => {
return fetchFacet(state, action);
case FETCH_FACET_FAILED:
return fetchFacetFailed(state, action);
case UPDATE_FACET:
return updateFacet(state, action);
case UPDATE_FILTER:
return updateFilter(state, action);
case UPDATE_FACET_VALUES:
return updateFacetValues(state, action);
case UPDATE_FACET_OPTION:
return updateFacetOption(state, action);
default:
return state;
}
......
import {
FETCH_FACET,
FETCH_FACET_FAILED,
UPDATE_FACET,
UPDATE_FILTER,
UPDATE_FACET_VALUES,
UPDATE_FACET_OPTION,
} from '../actions';
import {
updateFilter,
fetchFacet,
fetchFacetFailed,
updateFacet
updateFacetValues,
updateFacetOption,
} from './helpers';
export const INITIAL_STATE = {
......@@ -29,7 +29,7 @@ export const INITIAL_STATE = {
isFetching: false,
searchField: false,
containerClass: 'five',
filterType: 'uri',
filterType: 'uriFilter',
uriFilter: new Set()
},
},
......@@ -42,10 +42,10 @@ const worksFacets = (state = INITIAL_STATE, action) => {
return fetchFacet(state, action);
case FETCH_FACET_FAILED:
return fetchFacetFailed(state, action);
case UPDATE_FACET:
return updateFacet(state, action);
case UPDATE_FILTER:
return updateFilter(state, action);
case UPDATE_FACET_VALUES:
return updateFacetValues(state, action);
case UPDATE_FACET_OPTION:
return updateFacetOption(state, action);
default:
return state;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment