diff --git a/actionlist/.flowconfig b/actionlist/.flowconfig index 54c1f0a..876e701 100644 --- a/actionlist/.flowconfig +++ b/actionlist/.flowconfig @@ -8,9 +8,6 @@ ; Ignore unexpected extra "@providesModule" .*/node_modules/.*/node_modules/fbjs/.* -; Ignore unexpected extra "@providesModule" -.*/node_modules/react-native-router-flux/node_modules/.* - ; Ignore duplicate module providers ; For RN Apps installed via npm, "Libraries" folder is inside ; "node_modules/react-native" but in the source repo it is in the root diff --git a/actionlist/__tests__/components/sideMenuSpec.js b/actionlist/__tests__/components/sideMenuSpec.js index 64e96a4..9734bdc 100644 --- a/actionlist/__tests__/components/sideMenuSpec.js +++ b/actionlist/__tests__/components/sideMenuSpec.js @@ -19,8 +19,8 @@ describe('SideMenu', () => { ); - expect(wrapper.find(View).length).to.equal(9); - expect(wrapper.find(Text).length).to.equal(8); + expect(wrapper.find(View).length).to.equal(21); + expect(wrapper.find(Text).length).to.equal(15); expect(wrapper.find(Text).first().text()).to.equal('Home'); expect(wrapper.find(Text).at(1).text()).to.equal('Preferences'); expect(wrapper.find(Text).at(2).text()).to.equal('Filter'); diff --git a/actionlist/app/actions/action_items.js b/actionlist/app/actions/action_items.js index 6a5f3eb..2fc7def 100644 --- a/actionlist/app/actions/action_items.js +++ b/actionlist/app/actions/action_items.js @@ -1,6 +1,8 @@ import { createAction } from 'redux-actions'; -import { TOGGLE_DRAWER, SORT_ACTION_LIST, SELECT_DROPDOWN_OPTION } from './types'; +import { TOGGLE_DRAWER, SORT_ACTION_LIST, FILTER_ACTION_LIST, RESET_FILTERS, SELECT_DROPDOWN_OPTION } from './types'; export const toggleDrawer = createAction(TOGGLE_DRAWER); +export const filterActionList = createAction(FILTER_ACTION_LIST); export const sortActionList = createAction(SORT_ACTION_LIST); export const selectDropdownOption = createAction(SELECT_DROPDOWN_OPTION); +export const resetFilters = createAction(RESET_FILTERS); diff --git a/actionlist/app/actions/types.js b/actionlist/app/actions/types.js index d70d37f..de34d95 100644 --- a/actionlist/app/actions/types.js +++ b/actionlist/app/actions/types.js @@ -1,3 +1,5 @@ export const TOGGLE_DRAWER = 'toggle_drawer'; +export const FILTER_ACTION_LIST = 'filter_action_list'; export const SORT_ACTION_LIST = 'sort_action_list'; export const SELECT_DROPDOWN_OPTION = 'select_dropdown_option'; +export const RESET_FILTERS = 'reset_filters'; diff --git a/actionlist/app/components/SideMenu.js b/actionlist/app/components/SideMenu.js index a0248b0..6ea1f72 100644 --- a/actionlist/app/components/SideMenu.js +++ b/actionlist/app/components/SideMenu.js @@ -1,17 +1,19 @@ import React from 'react'; - import { StyleSheet, View, Text, + ScrollView, TouchableHighlight, } from 'react-native'; import Button from 'react-native-button'; -import { Actions } from 'react-native-router-flux'; +import Actions from 'react-native-router-flux'; import { connect } from 'react-redux'; -import { sortActionList } from '../actions/action_items'; -import { Colors, sortTypes } from '../lib/commons'; +import { sortActionList, resetFilters } from '../actions/action_items'; +import { Colors, sortTypes, filterTypes } from '../lib/commons'; +import FilterPicker from './filterPicker'; +import ContentHeader from './contentHeader'; const style = StyleSheet.create({ view: { @@ -29,6 +31,29 @@ const style = StyleSheet.create({ textAlign: 'left', borderBottomWidth: 0.5, }, + resetContainer: { + backgroundColor: '#990000', + padding: 5, + borderRadius: 8, + marginRight: 10, + marginLeft: 70, + marginBottom: 10, + marginTop: 10, + width: 100, + }, + resetButton: { + fontSize: 10, + color: '#ffffff', + }, + picker: { + fontSize: 10, + color: Colors.iuGray, + fontFamily: 'BentonSansBold, Arial, sans-serif', + }, + container: { + backgroundColor: '#f4f7f9', + paddingTop: 0, + }, subtext: { color: Colors.iuCrimson, marginLeft: 15, @@ -48,54 +73,93 @@ const style = StyleSheet.create({ }, }); -const SideMenu = ({ optionSelected, onSort }) => ( - - - - +const SideMenu = ({ optionSelected, + filters, + onSort, + onReset, +}) => ( + - - Sort - - onSort(sortTypes.creationDate)}> - Date Created - - onSort(sortTypes.lastApprovedDate)}> - Date Last Approved - - onSort(sortTypes.processType)}> - Process Type - - onSort(sortTypes.actionRequested)}> - Action Requested - + + + + + + Sort + + onSort(sortTypes.creationDate)}> + Date Created + + onSort(sortTypes.lastApprovedDate)}> + Date Last Approved + + onSort(sortTypes.processType)}> + Process Type + + onSort(sortTypes.actionRequested)}> + Action Requested + + Filter + + + + {filterTypes.DocumentCreatedDate.title} + {filterTypes.DocumentAssignedDate.title} + + - + ); const mapStateToProps = state => ({ optionSelected: state.actionItemsReducer.optionSelected, + filters: state.actionItemsReducer.filterStatus, }); const mapDispatchToProps = dispatch => ({ + onReset: () => dispatch(resetFilters()), onSort: criteria => dispatch(sortActionList(criteria)), }); SideMenu.propTypes = { onSort: React.PropTypes.func.isRequired, optionSelected: React.PropTypes.string.isRequired, + onReset: React.PropTypes.func.isRequired, + filters: React.PropTypes.shape({ + documentRouteStatus: React.PropTypes.string, + documentType: React.PropTypes.string, + documentCreationDate: React.PropTypes.string, + documentAssignedDate: React.PropTypes.string, + actionRequested: React.PropTypes.string, + }).isRequired, }; export default connect(mapStateToProps, mapDispatchToProps)(SideMenu); diff --git a/actionlist/app/components/action_item_header.js b/actionlist/app/components/action_item_header.js index 16cbf7e..c43ecd1 100644 --- a/actionlist/app/components/action_item_header.js +++ b/actionlist/app/components/action_item_header.js @@ -59,4 +59,3 @@ ActionItemHeader.propTypes = { }; export default ActionItemHeader; - diff --git a/actionlist/app/components/contentHeader.js b/actionlist/app/components/contentHeader.js new file mode 100644 index 0000000..550086e --- /dev/null +++ b/actionlist/app/components/contentHeader.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { + StyleSheet, + View, + Text, +} from 'react-native'; +import { Colors } from '../lib/commons'; + +const style = StyleSheet.create({ + headerText: { + fontSize: 10, + color: Colors.iuCrimson, + fontFamily: 'BentonSansBold, Arial, sans-serif', + margin: 10, + }, +}); + +const ContentHeader = props => ( + + {props.children} + +); + +ContentHeader.propTypes = { + children: React.PropTypes.node.isRequired, +}; + +export default ContentHeader; diff --git a/actionlist/app/components/display_list.js b/actionlist/app/components/display_list.js index fddffe6..0ac1ac1 100644 --- a/actionlist/app/components/display_list.js +++ b/actionlist/app/components/display_list.js @@ -21,11 +21,17 @@ const styles = StyleSheet.create({ }, }); -const DisplayList = ({ dataSource }) => ( +const filterData = (dataSource, filters) => ( + dataSource.filter(item => ((item.actionRequested.label === filters.actionRequested || filters.actionRequested === 'All') && + (item.processType.label === filters.documentType || filters.documentType === 'All') && + (item.processInstanceStatus.label === filters.documentRouteStatus || filters.documentRouteStatus === 'All'))) +); + +const DisplayList = ({ dataSource, filterStatus }) => ( @@ -35,10 +41,16 @@ const DisplayList = ({ dataSource }) => ( const mapStateToProps = state => ({ dataSource: state.actionItemsReducer.dataSource, + filterStatus: state.actionItemsReducer.filterStatus, }); DisplayList.propTypes = { dataSource: React.PropTypes.arrayOf(React.PropTypes.shape({})).isRequired, + filterStatus: React.PropTypes.shape({ + actionRequested: React.PropTypes.string, + documentType: React.PropTypes.string, + documentRouteStatus: React.PropTypes.string, + }).isRequired, }; export default connect(mapStateToProps)(DisplayList); diff --git a/actionlist/app/components/filterPicker.js b/actionlist/app/components/filterPicker.js new file mode 100644 index 0000000..c157cb6 --- /dev/null +++ b/actionlist/app/components/filterPicker.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { + View, + Picker, +} from 'react-native'; + +/* eslint-disable no-unused-vars */ +import { connect } from 'react-redux'; +import { filterActionList } from '../actions/action_items'; +import ContentHeader from './contentHeader'; + +const FilterPicker = ({ filter, value, filterKey, onActionListFiltering }) => ( + + {filter.title} + onActionListFiltering(filterKey, selectedOption)} + > + { + filter.data.map(i => ( + + )) + } + + +); + +const mapDispatchToProps = dispatch => ({ + onActionListFiltering: (filterType, value) => + dispatch(filterActionList({ filterType, value })), +}); + +FilterPicker.propTypes = { + onActionListFiltering: React.PropTypes.func.isRequired, + filter: React.PropTypes.shape({ + title: React.PropTypes.string, + data: React.PropTypes.arrayOf(React.PropTypes.string), + }).isRequired, + value: React.PropTypes.string.isRequired, + filterKey: React.PropTypes.string.isRequired, +}; + +export default connect(null, mapDispatchToProps)(FilterPicker); diff --git a/actionlist/app/lib/commons.js b/actionlist/app/lib/commons.js index d0f8449..777a071 100644 --- a/actionlist/app/lib/commons.js +++ b/actionlist/app/lib/commons.js @@ -1,5 +1,6 @@ export const processInstanceJSON = '[{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess1","label":"Z"},"title":"1","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess2","label":"Y"},"title":"2","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Rejected"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2014-02-03T11:30:00","creationDate":"2017-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess3","label":"X"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-04T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess4","label":"W"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-06-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess5","label":"V"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-09-01T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess6","label":"U"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2014-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess7","label":"T"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-12-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess8","label":"S"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-16T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess9","label":"R"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-08-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess10","label":"Q"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-07T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess11","label":"P"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-04-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess12","label":"O"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-181T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess13","label":"N"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-14T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess14","label":"M"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2013-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess15","label":"L"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-09-12T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess16","label":"K"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-11-10T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess17","label":"J"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-05T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess1","label":"Z"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess2","label":"Y"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Rejected"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2014-02-03T11:30:00","creationDate":"2017-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess3","label":"X"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-04T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess4","label":"W"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-06-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess5","label":"V"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-09-01T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess6","label":"U"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2014-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess7","label":"T"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-12-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess8","label":"S"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-16T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess9","label":"R"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-08-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess10","label":"Q"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-07T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess11","label":"P"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-04-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess12","label":"O"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-181T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess13","label":"N"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-14T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess14","label":"M"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2013-02-21T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess15","label":"L"},"title":"Hello, world!","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-09-12T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess16","label":"K"},"title":"second last","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-11-10T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}},{"id":"12345","processInstanceId":"23456","processType":{"name":"SomeProcess17","label":"J"},"title":"last","processInstanceStatus":{"code":"R","label":"Enroute"},"actionRequested":{"code":"A","label":"Approve"},"initiator":"Francis Fernandez","delegator":"Eric Westfall","group":"ESI Developers","routeNodes":["Manager Approval"],"lastApprovedDate":"2017-02-03T11:30:00","creationDate":"2017-02-05T12:00:00","_links":{"self":{"href":"https://workflow.iu.edu/actions/12345"},"actionList":{"href":"https://workflow.iu.edu/actions"},"processInstance":{"href":"https://workflow.iu.edu/processInstances/23456/open"},"log":{"href":"https://workflow.iu.edu/processInstances/23456/log"},"initiator":{"href":"https://people.iu.edu/fraferna"}}}]'; export const preferenceJSON = '{"pageSize":10,"refreshRate":15,"showPrimaryDelegations":true,"showSecondaryDelegations":false,"showSummary":true,"showFilters":true,"columns":[{"name":"processInstanceId","title":"Process Instance","link":"processInstance"},{"name":"processType","title":"Process Type"},{"name":"title","title":"Title"},{"name":"log","title":"Log","icon":"log","link":"log"}],"colors":{"S":"red","A":"orange"},"notifications":{"defaultFrequency":"immediate","primaryDelegation":true,"secondaryDelegation":false,"approval":true,"complete":true,"acknowledge":true,"fyi":false,"processTypeOverrides":{"Some Process":"daily"}}}'; + export const Colors = { iuGray: '#e9e9e9', iuDarkLimeStone: '#EDEBEB', @@ -33,5 +34,34 @@ export const sortTypes = { actionRequested: 'actionRequested.label', }; +export const filterStatus = { + documentRouteStatus: 'All', + documentType: 'All', + documentCreationDate: 'All', + documentAssignedDate: 'All', + actionRequested: 'All', +}; + // Adding expanded state and exporting to a hash export const processInstances = JSON.parse(processInstanceJSON); + +export const filterTypes = { + DocumentRouteStatus: { + title: 'Document Route Status', + data: ['All', 'Saved', 'Initiated', 'Disapproved', 'Enroute', 'Approved', 'Final', 'Processed', 'Exception', 'Canceled'], + }, + DocumentType: { + title: 'Document Type', + data: ['All', ...new Set(processInstances.map(item => item.processType.label))], + }, + ActionRequested: { + title: 'Action Requested', + data: ['All', 'Acknowledge', 'Approve', 'Complete', 'FYI'], + }, + DocumentCreatedDate: { + title: 'Document Created Date', + }, + DocumentAssignedDate: { + title: 'Document Assigned Date', + }, +}; diff --git a/actionlist/app/reducers/action_items.js b/actionlist/app/reducers/action_items.js index 6ff68bd..4dc3322 100644 --- a/actionlist/app/reducers/action_items.js +++ b/actionlist/app/reducers/action_items.js @@ -1,11 +1,12 @@ /* eslint arrow-body-style: ["error", "as-needed", { "requireReturnForObjectLiteral": true }] */ import { handleActions } from 'redux-actions'; -import { TOGGLE_DRAWER, SORT_ACTION_LIST, SELECT_DROPDOWN_OPTION } from '../actions/types'; -import { processInstances, sortTypes, Colors } from '../lib/commons'; +import { TOGGLE_DRAWER, SORT_ACTION_LIST, FILTER_ACTION_LIST, RESET_FILTERS, SELECT_DROPDOWN_OPTION } from '../actions/types'; +import { processInstances, sortTypes, filterStatus, Colors } from '../lib/commons'; export const defaultState = { dataSource: processInstances, drawerExpanded: false, + filterStatus, optionSelected: '', dropdownColors: { Saved: Colors.white, @@ -94,8 +95,27 @@ const selectDropdownOption = (state, action) => { }; }; +const filterActionList = (state, action) => { + return { + ...state, + filterStatus: { + ...state.filterStatus, + [action.payload.filterType]: action.payload.value, + }, + }; +}; + +const resetFilters = (state) => { + return { + ...state, + filterStatus, + }; +}; + export default handleActions({ [TOGGLE_DRAWER]: toggleDrawer, [SORT_ACTION_LIST]: sortActionList, + [FILTER_ACTION_LIST]: filterActionList, [SELECT_DROPDOWN_OPTION]: selectDropdownOption, + [RESET_FILTERS]: resetFilters, }, defaultState); diff --git a/actionlist/package.json b/actionlist/package.json index 8f10812..4301ccb 100644 --- a/actionlist/package.json +++ b/actionlist/package.json @@ -36,6 +36,7 @@ "react-native-button": "^1.8.2", "react-native-collapsible": "^0.8.0", "react-native-drawer": "^2.3.0", + "react-native-radio-buttons": "^0.14.0", "react-native-modal-dropdown": "^0.4.2", "react-native-router-flux": "^3.38.0", "react-native-side-menu": "^0.20.1", diff --git a/actionlist/test_constants/componentTests.js b/actionlist/test_constants/componentTests.js index 4ce952e..dc05b9e 100644 --- a/actionlist/test_constants/componentTests.js +++ b/actionlist/test_constants/componentTests.js @@ -17,5 +17,12 @@ export const Middlewares = []; export const InitialState = { actionItemsReducer: { sortValue: 'test', + filterStatus: { + documentRouteStatus: 'All', + documentType: 'All', + documentCreationDate: 'All', + documentAssignedDate: 'All', + actionRequested: 'All', + }, }, };