feat: 接口列表中增加“开放接口”状态

This commit is contained in:
gaoxiaolin.gao 2018-02-27 14:36:19 +08:00
parent 8cbd6d9ce2
commit 767a854a3b
6 changed files with 28 additions and 10 deletions

View File

@ -5,6 +5,7 @@
* 增加测试集合列表的拖动功能
* interfaceList页实现数据分页
* 新建接口的时候产生一个demo response
* 接口列表中增加“开放接口”状态
#### Bug Fixed

View File

@ -454,7 +454,6 @@ export default class InterfaceColMenu extends Component {
let list = this.state.list;
if (this.state.filterValue) {
let arr = [];
list = list.filter((item) => {

View File

@ -107,7 +107,7 @@ class AddInterfaceForm extends Component {
{...formItemLayout}
label="注"
>
<span>详细的接口数据可以在编辑页面中添加</span>
<span style={{ color: "#929292" }}>详细的接口数据可以在编辑页面中添加</span>
</FormItem>
<FormItem className="catModalfoot" wrapperCol={{ span: 24, offset: 8 }} >
<Button onClick={this.props.onCancel} style={{ marginRight: "10px" }} >取消</Button>

View File

@ -62,7 +62,7 @@
table-layout: fixed;
}
.path {
width: 100%;
width: 95%;
display: inline-block;
overflow: hidden;
text-overflow:ellipsis;
@ -70,6 +70,12 @@
padding-right: 24px;
line-height: 100%;
}
.opened {
color: #00a854;
padding-right: 6px;
font-size: 14px;
}
.colValue{
display: inline-block;
border-radius: 4px;

View File

@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types'
import axios from 'axios'
import {
Table, Button, Modal, message, Tooltip, Select
Table, Button, Modal, message, Tooltip, Select, Icon
} from 'antd';
import AddInterfaceForm from './AddInterfaceForm';
import { fetchInterfaceListMenu, fetchInterfaceList, fetchInterfaceCatList } from '../../../../reducer/modules/interface.js';
@ -166,7 +166,11 @@ class InterfaceList extends Component {
key: 'title',
width: 30,
render: (text, item) => {
return <Link to={"/project/" + item.project_id + "/interface/api/" + item._id} ><span className="path">{text}</span></Link>
return (
<Link to={"/project/" + item.project_id + "/interface/api/" + item._id} >
<span className="path">{text}</span>
</Link>
)
}
}, {
title: '接口路径',
@ -174,13 +178,21 @@ class InterfaceList extends Component {
key: 'path',
width: 50,
render: (item, record) => {
const path = this.props.curProject.basepath + item;
let methodColor = variable.METHOD_COLOR[record.method ? record.method.toLowerCase() : 'get'];
return <Tooltip title={path} placement="topLeft" overlayClassName="toolTip">
return <div>
<span style={{ color: methodColor.color, backgroundColor: methodColor.bac }} className="colValue">{record.method}</span>
<span className="path">{path}</span>
</Tooltip>
<Tooltip title="开放接口" placement="topLeft" >
<span>{record.api_opened && <Icon className="opened" type="eye-o"/>
}
</span>
</Tooltip>
<Tooltip title={path} placement="topLeft" overlayClassName="toolTip">
<span className="path">{path}</span>
</Tooltip>
</div>
}
}, {
title: '接口分类',

View File

@ -150,7 +150,7 @@ class interfaceModel extends baseModel {
.sort({ title: 1 })
.skip((page - 1) * limit)
.limit(limit)
.select('_id title uid path method project_id catid edit_uid status add_time up_time')
.select('_id title uid path method project_id catid api_opened edit_uid status add_time up_time')
.exec();
}
@ -187,7 +187,7 @@ class interfaceModel extends baseModel {
.sort({ title: 1 })
.skip((page - 1) * limit)
.limit(limit)
.select('_id title uid path method project_id catid edit_uid status add_time up_time')
.select('_id title uid path method project_id catid edit_uid api_opened status add_time up_time')
.exec();
}