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页实现数据分页 * interfaceList页实现数据分页
* 新建接口的时候产生一个demo response * 新建接口的时候产生一个demo response
* 接口列表中增加“开放接口”状态
#### Bug Fixed #### Bug Fixed

View File

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

View File

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

View File

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

View File

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

View File

@ -150,7 +150,7 @@ class interfaceModel extends baseModel {
.sort({ title: 1 }) .sort({ title: 1 })
.skip((page - 1) * limit) .skip((page - 1) * limit)
.limit(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(); .exec();
} }
@ -187,7 +187,7 @@ class interfaceModel extends baseModel {
.sort({ title: 1 }) .sort({ title: 1 })
.skip((page - 1) * limit) .skip((page - 1) * limit)
.limit(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(); .exec();
} }