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

This commit is contained in:
suxiaoxin 2017-09-26 13:51:50 +08:00
commit 6039e2d0c9
8 changed files with 220 additions and 205 deletions

View File

@ -175,12 +175,12 @@ export default class HeaderCom extends Component {
return (
<Header className="header-box m-header">
<div className="content g-row">
<div className="logo">
<Link to="/group" onClick={this.relieveLink} className="href">
<Link onClick={this.relieveLink} to="/group" className="logo">
<div className="href">
<span className="img">{logoSVG('32px')}</span>
{/*<span className="logo-name">YApi</span>*/}
</Link>
</div>
</Link>
<Breadcrumb />
<div className="user-toolbar">
{login?

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Mock from 'mockjs'
import { Button, Input, Select, Card, Alert, Spin, Icon, Collapse, Tooltip, message, AutoComplete } from 'antd'
import { Button, Input, Select, Alert, Spin, Icon, Collapse, Tooltip, message, AutoComplete } from 'antd'
import { autobind } from 'core-decorators';
import constants from '../../constants/variable.js'
@ -517,7 +517,7 @@ export default class Run extends Component {
return (
<div className="interface-test postman">
<div className="has-plugin">
<div className={ hasPlugin? null : 'has-plugin' } >
{hasPlugin ? '' : <Alert
message={
<div>
@ -547,7 +547,10 @@ export default class Run extends Component {
}
</div>
<Card title={<Tooltip placement="top" title="在 '设置->环境配置' 配置 domain">请求部分&nbsp;<Icon type="question-circle-o" /></Tooltip>} noHovering className="req-part">
<h2 className="interface-title" style={{ marginTop: 0 }}>请求部分&nbsp;
<Tooltip placement="top" title="在 '设置->环境配置' 配置 domain"><Icon type="question-circle-o" /></Tooltip>
</h2>
<div className="url">
<InputGroup compact style={{ display: 'flex' }}>
@ -717,9 +720,8 @@ export default class Run extends Component {
*/}
</Panel>
</Collapse>
</Card>
<Card title="返回结果" noHovering className="resp-part">
<h2 className="interface-title">返回结果</h2>
<Spin spinning={this.state.loading}>
<div className="res-code"></div>
<Collapse defaultActiveKey={['0', '1']} bordered={true}>
@ -744,7 +746,6 @@ export default class Run extends Component {
</Panel>
</Collapse>
</Spin>
</Card>
</div>
)
}

View File

@ -14,3 +14,6 @@
min-height: 200px;
}
}
.interface-test {
padding: .24rem;
}

View File

@ -101,6 +101,9 @@ export default class GroupList extends Component {
});
} else {
this.setState({
newGroupName: '',
group_name: '',
owner_uid: 0,
addGroupModalVisible: false
});
}
@ -111,6 +114,9 @@ export default class GroupList extends Component {
const res = await axios.post('/api/group/add', { group_name, group_desc, owner_uid })
if (!res.data.errcode) {
this.setState({
newGroupName: '',
group_name: '',
owner_uid: 0,
addGroupModalVisible: false
});
await this.props.fetchGroupList();

View File

@ -189,7 +189,7 @@ class InterfaceMenu extends Component {
that.props.history.push('/project/' + that.props.match.params.id + '/interface/api')
},
async onCancel() {
onCancel() {
ref.destroy()
}
});

View File

@ -1,6 +1,6 @@
.interface-test {
.has-plugin, .req-part, .resp-part {
margin: 8px;
margin-bottom: 16px;
}
.url {
display: flex;
@ -25,7 +25,7 @@
margin-left: 6px;
}
.icon-btn:hover {
color: #108ee9;
color: #2395f1;
}
}
.add-col-modal {
@ -41,7 +41,8 @@
background: #fa0;
}
.col-item.selected {
background: #108ee9;
background: #2395f1;
color: rgba(255, 255, 255, 1);
}
}
}

View File

@ -120,6 +120,6 @@
transform: translate(0, -50%);
}
.user-name {
padding-left: .32rem;
padding-left: .38rem;
}
}

View File

@ -67,14 +67,18 @@ class groupController extends baseController {
return ctx.body = yapi.commons.resReturn(null, 400, '项目分组名不能为空');
}
if (!params.owner_uid) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目分组必须添加一个组长');
}
// if (!params.owner_uid) {
// return ctx.body = yapi.commons.resReturn(null, 400, '项目分组必须添加一个组长');
// }
let groupUserdata = await this.getUserdata(params.owner_uid, 'owner');
let groupUserdata = null;
if (params.owner_uid) {
groupUserdata = await this.getUserdata(params.owner_uid, 'owner');
if (groupUserdata === null) {
return ctx.body = yapi.commons.resReturn(null, 400, '组长uid不存在')
}
}
let groupInst = yapi.getInst(groupModel);
let checkRepeat = await groupInst.checkRepeat(params.group_name);
@ -89,7 +93,7 @@ class groupController extends baseController {
uid: this.getUid(),
add_time: yapi.commons.time(),
up_time: yapi.commons.time(),
members: [groupUserdata]
members: groupUserdata ? [groupUserdata] : []
};
try {