Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
When filtering a view please use the newly introduced /documentView/{…
Browse files Browse the repository at this point in the history
…windowId}/{viewId}/filter endpoint #740
  • Loading branch information
Dunkat committed May 15, 2017
1 parent b243dee commit 95aec43
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/actions/AppActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ export function createViewRequest(
});
}

export function filterViewRequest(windowType, viewId, filters){
return () => axios.post(config.API_URL + '/documentView/' + windowType +
'/'+viewId+'/filter', {
'filters': filters
});
}

export function addNotification(title, msg, time, notifType, shortMsg){
return {
type: types.ADD_NOTIFICATION,
Expand Down
29 changes: 27 additions & 2 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import {

import {
createViewRequest,
browseViewRequest
browseViewRequest,
filterViewRequest
} from '../../actions/AppActions';

class DocumentList extends Component {
Expand Down Expand Up @@ -267,7 +268,11 @@ class DocumentList extends Component {
if(viewId && !isNewFilter){
this.browseView();
}else{
this.createView();
if(viewId){
this.filterView();
} else {
this.createView();
}
}
setModalTitle && setModalTitle(response.data.caption)
})
Expand All @@ -282,6 +287,7 @@ class DocumentList extends Component {
})
})
}

/*
* If viewId exist, than browse that view.
*/
Expand Down Expand Up @@ -316,6 +322,25 @@ class DocumentList extends Component {
})
}

filterView = () => {
const {
dispatch, windowType
} = this.props;

const {page, sort, filters, viewId} = this.state;

dispatch(filterViewRequest(
windowType, viewId, filters
)).then(response => {
this.mounted && this.setState({
data: response.data,
viewId: response.data.viewId
}, () => {
this.getData(response.data.viewId, page, sort);
})
})
}

getData = (id, page, sortingQuery, refresh) => {
const {dispatch, windowType, updateUri, setNotFound} = this.props;

Expand Down

0 comments on commit 95aec43

Please sign in to comment.