This commit is contained in:
喻希里 2017-09-29 20:56:40 +08:00
commit fbc25c1867
21 changed files with 1800 additions and 1746 deletions

View File

@ -72,7 +72,8 @@ class InterfaceColContent extends Component {
rows: [],
reports: {},
visible: false,
curCaseid: null
curCaseid: null,
hasPlugin: false
};
this.onRow = this.onRow.bind(this);
this.onMoveRow = this.onMoveRow.bind(this);
@ -93,6 +94,29 @@ class InterfaceColContent extends Component {
this.handleColdata(this.props.currCaseList)
}
let startTime = 0;
this.interval = setInterval(() => {
startTime += 500;
if (startTime > 5000) {
clearInterval(this.interval);
}
if (window.crossRequest) {
clearInterval(this.interval);
this.setState({
hasPlugin: true
})
} else {
this.setState({
hasPlugin: false
})
}
}, 500)
this.getInterfaceState()
}
componentWillUnmount() {
clearInterval(this.interval)
}
handleColdata = (rows) => {
@ -187,7 +211,7 @@ class InterfaceColContent extends Component {
})
let validRes = [];
if(interfaceData.mock_verify){
if (interfaceData.mock_verify) {
validRes = Mock.valid(tpl, res);
}
if (validRes.length === 0) {
@ -447,7 +471,13 @@ class InterfaceColContent extends Component {
<h2 className="interface-title" style={{ display: 'inline-block', margin: 0, marginBottom: '16px' }}>测试集合&nbsp;<a target="_blank" rel="noopener noreferrer" href="https://yapi.ymfe.org/case.html" >
<Tooltip title="点击查看文档"><Icon type="question-circle-o" /></Tooltip>
</a></h2>
<Button type="primary" style={{ float: 'right' }} onClick={this.executeTests}>开始测试</Button>
{this.state.hasPlugin?
<Button type="primary" style={{ float: 'right' }} onClick={this.executeTests}>开始测试</Button>:
<Tooltip title="请安装 cross-request Chrome 插件">
<Button disabled type="primary" style={{ float: 'right' }} >开始测试</Button>
</Tooltip>
}
<Table.Provider
components={components}
columns={resolvedColumns}

View File

@ -295,9 +295,15 @@ export default class InterfaceColMenu extends Component {
<div className="menu-title">
<span><Icon type="folder-open" style={{marginRight: 5}} /><span>{col.name}</span></span>
<div className="btns">
<Icon type='delete' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showDelColConfirm(col._id)}} />
<Icon type='edit' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showColModal('edit', col)}} />
<Icon type='plus' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showImportInterfaceModal(col._id)}} />
<Tooltip title="删除集合">
<Icon type='delete' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showDelColConfirm(col._id)}} />
</Tooltip>
<Tooltip title="编辑集合">
<Icon type='edit' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showColModal('edit', col)}} />
</Tooltip>
<Tooltip title="添加集合">
<Icon type='plus' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showImportInterfaceModal(col._id)}} />
</Tooltip>
</div>
{/*<Dropdown overlay={menu(col)} trigger={['click']} onClick={e => e.stopPropagation()}>
<Icon className="opts-icon" type='ellipsis'/>
@ -318,7 +324,9 @@ export default class InterfaceColMenu extends Component {
title={
<div className="menu-title" title={interfaceCase.casename}>
<span className="casename">{interfaceCase.casename}</span>
<Icon type='delete' className="case-delete-icon" onClick={(e) => { e.stopPropagation();this.showDelCaseConfirm(interfaceCase._id) }} />
<Tooltip title="删除用例">
<Icon type='delete' className="case-delete-icon" onClick={(e) => { e.stopPropagation();this.showDelCaseConfirm(interfaceCase._id) }} />
</Tooltip>
</div>
}
></TreeNode>

View File

@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types'
import { fetchInterfaceList, fetchInterfaceData, deleteInterfaceData, deleteInterfaceCatData, initInterface } from '../../../../reducer/modules/interface.js';
import { getProject } from '../../../../reducer/modules/project.js';
import { Input, Icon, Button, Modal, message, Tree } from 'antd';
import { Input, Icon, Button, Modal, message, Tree, Tooltip } from 'antd';
import AddInterfaceForm from './AddInterfaceForm';
import AddInterfaceCatForm from './AddInterfaceCatForm';
import axios from 'axios'
@ -339,8 +339,12 @@ class InterfaceMenu extends Component {
title={<div className="container-title" onMouseEnter={() => this.enterItem(item._id)} onMouseLeave={this.leaveItem} >
<Link className="interface-item" to={"/project/" + matchParams.id + "/interface/api/" + item._id} >{item.title}</Link>
<div className="btns">
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
<Icon type='copy' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.copyInterface(item) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
<Tooltip title="删除接口">
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
</Tooltip>
<Tooltip title="复制接口">
<Icon type='copy' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.copyInterface(item) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
</Tooltip>
</div>
{/*<Dropdown overlay={menu(item)} trigger={['click']} onClick={e => e.stopPropagation()}>
<Icon type='ellipsis' className="interface-delete-icon" style={{ opacity: this.state.delIcon == item._id ? 1 : 0 }}/>
@ -420,21 +424,27 @@ class InterfaceMenu extends Component {
return <TreeNode title={<div className="container-title" onMouseEnter={() => this.enterItem(item._id)} onMouseLeave={this.leaveItem} >
<Link className="interface-item" to={"/project/" + matchParams.id + "/interface/api/cat_" + item._id} ><Icon type="folder-open" style={{ marginRight: 5 }} />{item.name}</Link>
<div className="btns">
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.showDelCatConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }}/>
<Icon type='edit' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={(e) => {
e.stopPropagation();
this.changeModal('change_cat_modal_visible', true);
this.setState({
curCatdata: item
})
}} />
<Icon type='plus' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={(e) => {
e.stopPropagation();
this.changeModal('visible', true);
this.setState({
curCatid: item._id
});
}} />
<Tooltip title="删除集合">
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.showDelCatConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }}/>
</Tooltip>
<Tooltip title="编辑集合">
<Icon type='edit' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={(e) => {
e.stopPropagation();
this.changeModal('change_cat_modal_visible', true);
this.setState({
curCatdata: item
})
}} />
</Tooltip>
<Tooltip title="添加集合">
<Icon type='plus' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={(e) => {
e.stopPropagation();
this.changeModal('visible', true);
this.setState({
curCatid: item._id
});
}} />
</Tooltip>
</div>
{/*<Dropdown overlay={menu(item)} trigger={['click']} onClick={e => e.stopPropagation()}>

3435
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,8 @@
"sha1": "^1.1.1",
"underscore": "^1.8.3",
"universal-cookie": "^2.0.8",
"url": "^0.11.0"
"url": "^0.11.0",
"yapi-plugin-qsso": "^1.0.5"
},
"devDependencies": {
"assets-webpack-plugin": "^3.5.1",

View File

@ -1 +1 @@
window.WEBPACK_ASSETS = {"index.js":{"js":"index@86c2b0ce829f6e441377.js","css":"index@86c2b0ce829f6e441377.css"},"lib":{"js":"lib@0fe1d0abd11fbb8ef3d6.js"},"lib2":{"js":"lib2@980bff89a8e0841fa293.js"},"manifest":{"js":"manifest@b67af9f8b578904e66c5.js"}}
window.WEBPACK_ASSETS = {"index.js":{"js":"index@da88d5e7f8a84b661340.js","css":"index@da88d5e7f8a84b661340.css"},"lib":{"js":"lib@875e625cb7fc52911ccf.js"},"lib2":{"js":"lib2@350ee6d65d22a8d4ef3f.js"},"manifest":{"js":"manifest@b67af9f8b578904e66c5.js"}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.