mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-06 12:45:22 +08:00
feat: postman
This commit is contained in:
parent
bb8e72735b
commit
9e38e42105
@ -6,6 +6,7 @@ import Loading from './Loading/Loading.js'
|
||||
import MockDoc from './MockDoc/MockDoc.js'
|
||||
import ProjectCard from './ProjectCard/ProjectCard.js'
|
||||
import Subnav from './Subnav/Subnav.js'
|
||||
import Postman from './Postman/Postman'
|
||||
|
||||
export {
|
||||
Breadcrumb,
|
||||
@ -15,5 +16,6 @@ export {
|
||||
Loading,
|
||||
MockDoc,
|
||||
ProjectCard,
|
||||
Subnav
|
||||
Subnav,
|
||||
Postman
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class Interface extends Component {
|
||||
<Tabs.TabPane tab="接口列表" key="api">
|
||||
<InterfaceMenu router={matchPath(this.props.location.pathname, contentRouter)} projectId={this.props.match.params.id} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="接口集合" key="colOrCase" >
|
||||
<Tabs.TabPane tab="测试集合" key="colOrCase" >
|
||||
<InterfaceColMenu />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
|
@ -3,6 +3,8 @@ import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types'
|
||||
import { withRouter } from 'react-router'
|
||||
import { fetchInterfaceColList, setColData, fetchCaseData } from '../../../../reducer/modules/interfaceCol'
|
||||
import { Postman } from '../../../../components'
|
||||
// import Run from
|
||||
|
||||
@connect(
|
||||
state => {
|
||||
@ -11,7 +13,8 @@ import { fetchInterfaceColList, setColData, fetchCaseData } from '../../../../re
|
||||
currColId: state.interfaceCol.currColId,
|
||||
currCaseId: state.interfaceCol.currCaseId,
|
||||
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,
|
||||
currCaseId: PropTypes.number,
|
||||
currCase: PropTypes.object,
|
||||
isShowCol: PropTypes.bool
|
||||
isShowCol: PropTypes.bool,
|
||||
currProject: PropTypes.object
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
@ -75,10 +79,14 @@ export default class InterfaceCaseContent extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { currCase, currProject } = this.props;
|
||||
const data = Object.assign({}, currCase, currProject);
|
||||
return (
|
||||
<div>
|
||||
<h1>hello caseContent</h1>
|
||||
{JSON.stringify(this.props.currCase, null, 2)}
|
||||
<h1 style={{marginLeft: 8}}>{currCase.casename}</h1>
|
||||
<div>
|
||||
<Postman data={data} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -46,7 +46,9 @@ export default class InterfaceColContent extends Component {
|
||||
let { currColId } = this.props;
|
||||
const params = this.props.match.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.fetchCaseList(currColId)
|
||||
this.props.setColData({currColId: +currColId, isShowCol: true})
|
||||
@ -66,24 +68,24 @@ export default class InterfaceColContent extends Component {
|
||||
const { currCaseList } = this.props;
|
||||
|
||||
const columns = [{
|
||||
title: '名字',
|
||||
title: '用例名称',
|
||||
dataIndex: 'casename',
|
||||
key: 'casename'
|
||||
}, {
|
||||
title: '方法',
|
||||
dataIndex: 'method',
|
||||
key: 'method'
|
||||
}, {
|
||||
title: 'PATH',
|
||||
title: '用例路径',
|
||||
dataIndex: 'path',
|
||||
key: 'path'
|
||||
}, {
|
||||
title: '请求方式',
|
||||
dataIndex: 'method',
|
||||
key: 'method'
|
||||
}];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{padding:"15px"}}>
|
||||
<h2 style={{marginBottom: '10px'}}>接口集合</h2>
|
||||
<Table dataSource={currCaseList} columns={columns} />
|
||||
<h2 style={{marginBottom: '10px'}}>测试集合</h2>
|
||||
<Table dataSource={currCaseList} columns={columns} pagination={false} rowKey="_id"/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@ -68,8 +68,6 @@ export default class Run extends Component {
|
||||
getInterfaceState(nextProps) {
|
||||
const props = nextProps || this.props;
|
||||
const { currInterface, currProject } = props;
|
||||
console.log('currInterface', currInterface)
|
||||
console.log('currProject', currProject)
|
||||
const {
|
||||
method,
|
||||
path: url,
|
||||
|
Loading…
Reference in New Issue
Block a user