yapi/client/containers/Interface/Interface.js

59 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-07-11 19:12:13 +08:00
import './Interface.scss'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import InterfaceList from './InterfaceList/InterfaceList.js'
import InterfaceTable from './InterfaceTable/InterfaceTable.js'
2017-07-13 20:09:04 +08:00
import InterfaceMode from './InterfaceMode/InterfaceMode.js'
import {
fetchInterfaceData,
projectMember,
2017-07-14 11:27:34 +08:00
closeProjectMember
2017-07-13 20:09:04 +08:00
} from '../../actions/interfaceAction.js'
2017-07-11 19:12:13 +08:00
@connect(
state => {
return {
2017-07-13 20:09:04 +08:00
interfaceData: state.Interface.interfaceData,
modalVisible: state.Interface.modalVisible,
2017-07-14 11:27:34 +08:00
closeProjectMember: state.Interface.closeProjectMember
2017-07-11 19:12:13 +08:00
}
},
{
2017-07-13 20:09:04 +08:00
fetchInterfaceData,
projectMember,
2017-07-14 11:27:34 +08:00
closeProjectMember
2017-07-11 19:12:13 +08:00
}
)
2017-07-13 20:09:04 +08:00
2017-07-11 19:12:13 +08:00
class Interface extends Component {
static propTypes = {
2017-07-13 20:09:04 +08:00
fetchInterfaceData: PropTypes.func,
interfaceData: PropTypes.array,
projectMember: PropTypes.func,
closeProjectMember: PropTypes.func,
2017-07-14 11:27:34 +08:00
modalVisible: PropTypes.bool
2017-07-11 19:12:13 +08:00
}
constructor(props) {
super(props)
}
componentWillMount () {
2017-07-13 20:09:04 +08:00
this.props.fetchInterfaceData()
2017-07-11 19:12:13 +08:00
}
render () {
2017-07-13 20:09:04 +08:00
const { interfaceData, projectMember, modalVisible } = this.props
2017-07-11 19:12:13 +08:00
return (
<section className="interface-box">
2017-07-13 20:09:04 +08:00
<InterfaceList projectMember={projectMember} />
<InterfaceMode modalVisible={modalVisible} closeProjectMember={this.props.closeProjectMember} />
<InterfaceTable data={interfaceData} />
2017-07-11 19:12:13 +08:00
</section>
)
}
}
2017-07-14 11:27:34 +08:00
export default Interface