yapi/client/containers/Interface/Interface.js

62 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'
2017-07-18 18:25:53 +08:00
import {
2017-07-13 20:09:04 +08:00
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 (
2017-07-14 14:44:32 +08:00
<div>
<section className="interface-box">
<InterfaceList projectMember={projectMember} />
<InterfaceMode modalVisible={modalVisible} closeProjectMember={this.props.closeProjectMember} />
<InterfaceTable data={interfaceData} />
</section>
</div>
2017-07-11 19:12:13 +08:00
)
}
}
2017-07-14 11:27:34 +08:00
export default Interface