2017-02-11 20:39:38 -05:00
|
|
|
var connect = require('react-redux').connect;
|
|
|
|
|
|
|
|
var ReportActions = require('../actions/ReportActions');
|
|
|
|
var ReportsTab = require('../components/ReportsTab');
|
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
2017-06-17 10:28:50 -04:00
|
|
|
var report_list = [];
|
|
|
|
for (var reportId in state.reports.map) {
|
|
|
|
if (state.reports.map.hasOwnProperty(reportId))
|
|
|
|
report_list.push(state.reports.map[reportId]);
|
|
|
|
}
|
2017-02-11 20:39:38 -05:00
|
|
|
return {
|
2017-06-17 10:28:50 -04:00
|
|
|
reports: state.reports,
|
|
|
|
report_list: report_list
|
2017-02-11 20:39:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return {
|
2017-06-16 20:55:22 -04:00
|
|
|
onFetchAllReports: function() {dispatch(ReportActions.fetchAll())},
|
|
|
|
onCreateReport: function(report) {dispatch(ReportActions.create(report))},
|
|
|
|
onUpdateReport: function(report) {dispatch(ReportActions.update(report))},
|
|
|
|
onDeleteReport: function(report) {dispatch(ReportActions.remove(report))},
|
|
|
|
onSelectReport: function(report) {dispatch(ReportActions.select(report))},
|
|
|
|
onTabulateReport: function(report) {dispatch(ReportActions.tabulate(report))},
|
2017-06-17 14:24:02 -04:00
|
|
|
onSelectSeries: function(seriesTraversal) {dispatch(ReportActions.selectSeries(seriesTraversal))}
|
2017-02-11 20:39:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(ReportsTab)
|