feat: postman

This commit is contained in:
zwjamnsss 2017-08-22 09:41:20 +08:00
parent bb8e72735b
commit 9e38e42105
5 changed files with 27 additions and 17 deletions

View File

@ -6,6 +6,7 @@ import Loading from './Loading/Loading.js'
import MockDoc from './MockDoc/MockDoc.js' import MockDoc from './MockDoc/MockDoc.js'
import ProjectCard from './ProjectCard/ProjectCard.js' import ProjectCard from './ProjectCard/ProjectCard.js'
import Subnav from './Subnav/Subnav.js' import Subnav from './Subnav/Subnav.js'
import Postman from './Postman/Postman'
export { export {
Breadcrumb, Breadcrumb,
@ -15,5 +16,6 @@ export {
Loading, Loading,
MockDoc, MockDoc,
ProjectCard, ProjectCard,
Subnav Subnav,
Postman
} }

View File

@ -82,7 +82,7 @@ class Interface extends Component {
<Tabs.TabPane tab="接口列表" key="api"> <Tabs.TabPane tab="接口列表" key="api">
<InterfaceMenu router={matchPath(this.props.location.pathname, contentRouter)} projectId={this.props.match.params.id} /> <InterfaceMenu router={matchPath(this.props.location.pathname, contentRouter)} projectId={this.props.match.params.id} />
</Tabs.TabPane> </Tabs.TabPane>
<Tabs.TabPane tab="接口集合" key="colOrCase" > <Tabs.TabPane tab="测试集合" key="colOrCase" >
<InterfaceColMenu /> <InterfaceColMenu />
</Tabs.TabPane> </Tabs.TabPane>
</Tabs> </Tabs>

View File

@ -3,6 +3,8 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { withRouter } from 'react-router' import { withRouter } from 'react-router'
import { fetchInterfaceColList, setColData, fetchCaseData } from '../../../../reducer/modules/interfaceCol' import { fetchInterfaceColList, setColData, fetchCaseData } from '../../../../reducer/modules/interfaceCol'
import { Postman } from '../../../../components'
// import Run from
@connect( @connect(
state => { state => {
@ -11,7 +13,8 @@ import { fetchInterfaceColList, setColData, fetchCaseData } from '../../../../re
currColId: state.interfaceCol.currColId, currColId: state.interfaceCol.currColId,
currCaseId: state.interfaceCol.currCaseId, currCaseId: state.interfaceCol.currCaseId,
currCase: state.interfaceCol.currCase, currCase: state.interfaceCol.currCase,
isShowCol: state.interfaceCol.isShowCol isShowCol: state.interfaceCol.isShowCol,
currProject: state.project.currProject
} }
}, },
{ {
@ -33,7 +36,8 @@ export default class InterfaceCaseContent extends Component {
currColId: PropTypes.number, currColId: PropTypes.number,
currCaseId: PropTypes.number, currCaseId: PropTypes.number,
currCase: PropTypes.object, currCase: PropTypes.object,
isShowCol: PropTypes.bool isShowCol: PropTypes.bool,
currProject: PropTypes.object
} }
constructor(props) { constructor(props) {
@ -75,10 +79,14 @@ export default class InterfaceCaseContent extends Component {
} }
render() { render() {
const { currCase, currProject } = this.props;
const data = Object.assign({}, currCase, currProject);
return ( return (
<div> <div>
<h1>hello caseContent</h1> <h1 style={{marginLeft: 8}}>{currCase.casename}</h1>
{JSON.stringify(this.props.currCase, null, 2)} <div>
<Postman data={data} />
</div>
</div> </div>
) )
} }

View File

@ -46,7 +46,9 @@ export default class InterfaceColContent extends Component {
let { currColId } = this.props; let { currColId } = this.props;
const params = this.props.match.params; const params = this.props.match.params;
const { actionId } = params; const { actionId } = params;
currColId = +actionId || +currColId || result.payload.data.data[0].caseList[0]._id; currColId = +actionId ||
result.payload.data.data.find(item => +item._id === +currColId) && +currColId ||
result.payload.data.data[0]._id;
this.props.history.push('/project/' + params.id + '/interface/col/' + currColId) this.props.history.push('/project/' + params.id + '/interface/col/' + currColId)
this.props.fetchCaseList(currColId) this.props.fetchCaseList(currColId)
this.props.setColData({currColId: +currColId, isShowCol: true}) this.props.setColData({currColId: +currColId, isShowCol: true})
@ -66,24 +68,24 @@ export default class InterfaceColContent extends Component {
const { currCaseList } = this.props; const { currCaseList } = this.props;
const columns = [{ const columns = [{
title: '名字', title: '用例名称',
dataIndex: 'casename', dataIndex: 'casename',
key: 'casename' key: 'casename'
}, { }, {
title: '方法', title: '用例路径',
dataIndex: 'method',
key: 'method'
}, {
title: 'PATH',
dataIndex: 'path', dataIndex: 'path',
key: 'path' key: 'path'
}, {
title: '请求方式',
dataIndex: 'method',
key: 'method'
}]; }];
return ( return (
<div> <div>
<div style={{padding:"15px"}}> <div style={{padding:"15px"}}>
<h2 style={{marginBottom: '10px'}}>接口集合</h2> <h2 style={{marginBottom: '10px'}}>测试集合</h2>
<Table dataSource={currCaseList} columns={columns} /> <Table dataSource={currCaseList} columns={columns} pagination={false} rowKey="_id"/>
</div> </div>
</div> </div>
) )

View File

@ -68,8 +68,6 @@ export default class Run extends Component {
getInterfaceState(nextProps) { getInterfaceState(nextProps) {
const props = nextProps || this.props; const props = nextProps || this.props;
const { currInterface, currProject } = props; const { currInterface, currProject } = props;
console.log('currInterface', currInterface)
console.log('currProject', currProject)
const { const {
method, method,
path: url, path: url,