ES6 Plato on Github
Report Home
Summary Display
containers/InvestigationsContainer.js
Maintainability
71.16
Lines of code
61
Difficulty
20.83
Estimated Errors
0.35
Function weight
By Complexity
By SLOC
import React, { Component } from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { setBreadCrumbs } from '../actions/breadcrumbs.js'; import InvestigationTable from "../components/Investigation/InvestigationTable.js" import Loader from 'react-loader-advanced'; class InvestigationsContainer extends Component { componentDidMount(){ if (this.props.closedData){ this.props.setBreadCrumbs([{ name: 'Closed Data', link: '/investigations' },{ name: 'Investigations', link: '/investigations' }]); } else{ this.props.setBreadCrumbs([{ name: 'My Data', link: '/investigations' },{ name: 'Investigations', link: '/investigations' }]); } } render() { if ((!this.props.user) || (!this.props.user.sessionId) || (!this.props.investigations)) { return null; } return ( <div> <Loader show={this.props.investigations.fetching} > <InvestigationTable user={this.props.user} linkProposal={this.props.linkProposal} closedData={this.props.closedData} fetching={this.props.investigations.fetching} investigations={this.props.investigations.data}> </InvestigationTable> </Loader> </div>); } } function mapStateToProps(state) { return { user: state.user }; } function mapDispatchToProps(dispatch) { return { setBreadCrumbs: bindActionCreators(setBreadCrumbs, dispatch) }; } export default connect( mapStateToProps, mapDispatchToProps )(InvestigationsContainer);