Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
suxiaoxin 2017-09-08 15:21:44 +08:00
commit 999a9cacf7
2 changed files with 10 additions and 17 deletions

View File

@ -19,8 +19,11 @@
.table-interfacelist { .table-interfacelist {
margin-top: .2rem; margin-top: .2rem;
white-space: nowrap; white-space: nowrap;
table {
table-layout: fixed;
}
.path { .path {
width: 400px; width: 100%;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
white-space: nowrap; white-space: nowrap;
@ -45,14 +48,3 @@
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
} }
@media (max-width: 1100px) {
.table-interfacelist .path {
width: 360px;
}
}
@media (max-width: 980px) {
.table-interfacelist .path {
width: 280px;
}
}

View File

@ -104,6 +104,7 @@ class InterfaceList extends Component {
title: '接口名称', title: '接口名称',
dataIndex: 'title', dataIndex: 'title',
key: 'title', key: 'title',
width: 30,
sorter: (a, b) => { sorter: (a, b) => {
return a.title.localeCompare(b.title) === 1 return a.title.localeCompare(b.title) === 1
}, },
@ -115,7 +116,7 @@ class InterfaceList extends Component {
title: '接口路径', title: '接口路径',
dataIndex: 'path', dataIndex: 'path',
key: 'path', key: 'path',
width: 400, width: 50,
render: (item) => { render: (item) => {
const path = this.props.curProject.basepath + item; const path = this.props.curProject.basepath + item;
return <Tooltip title={path} placement="topLeft" overlayClassName="toolTip"><span className="path">{path}</span></Tooltip> return <Tooltip title={path} placement="topLeft" overlayClassName="toolTip"><span className="path">{path}</span></Tooltip>
@ -124,7 +125,7 @@ class InterfaceList extends Component {
title: '请求方法', title: '请求方法',
dataIndex: 'method', dataIndex: 'method',
key: 'method', key: 'method',
width: 100, width: 12,
render: (item) => { render: (item) => {
let methodColor = variable.METHOD_COLOR[item ? item.toLowerCase() : 'get']; let methodColor = variable.METHOD_COLOR[item ? item.toLowerCase() : 'get'];
return <span style={{color:methodColor.color,backgroundColor:methodColor.bac}} className="colValue">{item}</span> return <span style={{color:methodColor.color,backgroundColor:methodColor.bac}} className="colValue">{item}</span>
@ -133,7 +134,7 @@ class InterfaceList extends Component {
title: '状态', title: '状态',
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
width: 100, width: 12,
render: (item) => { render: (item) => {
return <div>{item === 'done' ? return <div>{item === 'done' ?
<Tag color="#87d068">完成</Tag> <Tag color="#87d068">完成</Tag>
@ -157,9 +158,9 @@ class InterfaceList extends Component {
}); });
return ( return (
<div style={{ padding: "16px" }}> <div style={{ padding: '16px' }}>
<h2 style={{ display: 'inline-block'}}>接口列表</h2> <h2 style={{ display: 'inline-block'}}>接口列表</h2>
<Button style={{float: "right", marginRight: '10px'}} type="primary" onClick={() => this.setState({ visible: true })}>添加接口</Button> <Button style={{float: 'right'}} type="primary" onClick={() => this.setState({ visible: true })}>添加接口</Button>
<Table className="table-interfacelist" pagination={false} columns={columns} onChange={this.handleChange} dataSource={data} /> <Table className="table-interfacelist" pagination={false} columns={columns} onChange={this.handleChange} dataSource={data} />
<Modal <Modal
title="添加接口" title="添加接口"