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

This commit is contained in:
zwjamnsss 2017-10-12 10:37:42 +08:00
commit daf431613e
7 changed files with 30 additions and 31 deletions

View File

@ -59,23 +59,12 @@ Footer.defaultProps = {
}, },
{ {
title: '相关站点', title: '团队',
iconType: 'link', iconType: 'team',
linkList: [ linkList: [
{
itemTitle: 'YApi',
itemLink: 'https://github.com/YMFE/yapi'
},
{ {
itemTitle: 'YMFE', itemTitle: 'YMFE',
itemLink: 'http://ued.qunar.com/ymfe/about' itemLink: 'http://ued.qunar.com/ymfe/about'
},
{
itemTitle: 'UED',
itemLink: 'http://ued.qunar.com/'
},{
itemTitle: '去哪儿网',
itemLink: 'http://www.qunar.com/'
} }
] ]
@ -87,15 +76,21 @@ Footer.defaultProps = {
{ {
itemTitle: 'qq群644642474', itemTitle: 'qq群644642474',
itemLink: 'javascript:' itemLink: 'javascript:'
},{
itemTitle: 'Github Issues',
itemLink: 'https://github.com/YMFE/yapi/issues'
},{
itemTitle: 'Github Pull Requests',
itemLink: 'https://github.com/YMFE/yapi/pulls'
} }
] ]
}, },
{ {
title: 'Copyright © 2017 YApi', title: 'Copyright © 2017 YMFE',
linkList: [ linkList: [
{ {
itemTitle: '版本: '+packageJson.version, itemTitle: '版本: ' + packageJson.version,
itemLink: 'javascript:' itemLink: 'https://yapi.ymfe.org//'
} }
] ]
} }

View File

@ -240,7 +240,7 @@ class MemberList extends Component {
userinfo = [...ownerinfo,...devinfo,...guestinfo]; userinfo = [...ownerinfo,...devinfo,...guestinfo];
return ( return (
<div className="m-panel"> <div className="m-panel">
<Modal {this.state.visible?<Modal
title="添加成员" title="添加成员"
visible={this.state.visible} visible={this.state.visible}
onOk={this.handleOk} onOk={this.handleOk}
@ -262,7 +262,7 @@ class MemberList extends Component {
</Select> </Select>
</Col> </Col>
</Row> </Row>
</Modal> </Modal>:""}
<Table columns={columns} dataSource={userinfo} pagination={false} locale={{emptyText: <ErrMsg type="noMemberInGroup"/>}} /> <Table columns={columns} dataSource={userinfo} pagination={false} locale={{emptyText: <ErrMsg type="noMemberInGroup"/>}} />
</div> </div>
); );

View File

@ -226,7 +226,7 @@ class InterfaceEditForm extends Component {
data: that.state.res_body, data: that.state.res_body,
onChange: function (d) { onChange: function (d) {
if (d.format === true) { if (d.format === true) {
mockPreview.editor.setValue(d.mockText) mockPreview.setValue(d.mockText)
} }
that.setState({ that.setState({
res_body: d.text, res_body: d.text,
@ -269,6 +269,7 @@ class InterfaceEditForm extends Component {
} }
handleJsonType = (key) => { handleJsonType = (key) => {
key = key || 'tpl'; key = key || 'tpl';
this.setState({ this.setState({
jsonType: key jsonType: key

View File

@ -254,7 +254,7 @@ class InterfaceMenu extends Component {
const searchBox = <div className="interface-filter"> const searchBox = <div className="interface-filter">
<Input onChange={this.onFilter} value={this.state.filter} placeholder="搜索接口" /> <Input onChange={this.onFilter} value={this.state.filter} placeholder="搜索接口" />
<Button type="primary" onClick={() => this.changeModal('add_cat_modal_visible', true)} className="btn-filter" >添加分类</Button> <Button type="primary" onClick={() => this.changeModal('add_cat_modal_visible', true)} className="btn-filter" >添加分类</Button>
<Modal {this.state.visible?<Modal
title="添加接口" title="添加接口"
visible={this.state.visible} visible={this.state.visible}
onCancel={() => this.changeModal('visible', false)} onCancel={() => this.changeModal('visible', false)}
@ -262,9 +262,9 @@ class InterfaceMenu extends Component {
className="addcatmodal" className="addcatmodal"
> >
<AddInterfaceForm catdata={this.props.curProject.cat} catid={this.state.curCatid} onCancel={() => this.changeModal('visible', false)} onSubmit={this.handleAddInterface} /> <AddInterfaceForm catdata={this.props.curProject.cat} catid={this.state.curCatid} onCancel={() => this.changeModal('visible', false)} onSubmit={this.handleAddInterface} />
</Modal> </Modal>:""}
<Modal {this.state.add_cat_modal_visible?<Modal
title="添加分类" title="添加分类"
visible={this.state.add_cat_modal_visible} visible={this.state.add_cat_modal_visible}
onCancel={() => this.changeModal('add_cat_modal_visible', false)} onCancel={() => this.changeModal('add_cat_modal_visible', false)}
@ -272,9 +272,9 @@ class InterfaceMenu extends Component {
className="addcatmodal" className="addcatmodal"
> >
<AddInterfaceCatForm onCancel={() => this.changeModal('add_cat_modal_visible', false)} onSubmit={this.handleAddInterfaceCat} /> <AddInterfaceCatForm onCancel={() => this.changeModal('add_cat_modal_visible', false)} onSubmit={this.handleAddInterfaceCat} />
</Modal> </Modal>:""}
<Modal {this.state.change_cat_modal_visible?<Modal
title="修改分类" title="修改分类"
visible={this.state.change_cat_modal_visible} visible={this.state.change_cat_modal_visible}
onCancel={() => this.changeModal('change_cat_modal_visible', false)} onCancel={() => this.changeModal('change_cat_modal_visible', false)}
@ -282,7 +282,7 @@ class InterfaceMenu extends Component {
className="addcatmodal" className="addcatmodal"
> >
<AddInterfaceCatForm catdata={this.state.curCatdata} onCancel={() => this.changeModal('change_cat_modal_visible', false)} onSubmit={this.handleChangeInterfaceCat} /> <AddInterfaceCatForm catdata={this.state.curCatdata} onCancel={() => this.changeModal('change_cat_modal_visible', false)} onSubmit={this.handleChangeInterfaceCat} />
</Modal> </Modal>:""}
</div> </div>
if(menuList.length === 0){ if(menuList.length === 0){
return searchBox; return searchBox;

View File

@ -210,7 +210,7 @@ class ProjectMember extends Component {
return ( return (
<div className="g-row"> <div className="g-row">
<div className="m-panel"> <div className="m-panel">
<Modal {this.state.visible?<Modal
title="添加成员" title="添加成员"
visible={this.state.visible} visible={this.state.visible}
onOk={this.handleOk} onOk={this.handleOk}
@ -232,7 +232,7 @@ class ProjectMember extends Component {
</Select> </Select>
</Col> </Col>
</Row> </Row>
</Modal> </Modal>:""}
<Table columns={columns} dataSource={this.state.projectMemberList} pagination={false} locale={{emptyText: <ErrMsg type="noMemberInProject"/>}} className="setting-project-member"/> <Table columns={columns} dataSource={this.state.projectMemberList} pagination={false} locale={{emptyText: <ErrMsg type="noMemberInProject"/>}} className="setting-project-member"/>
<Card bordered={false} title={this.state.groupName + ' 分组成员 ' + '(' + this.state.groupMemberList.length + ') 人'} noHovering className="setting-group"> <Card bordered={false} title={this.state.groupName + ' 分组成员 ' + '(' + this.state.groupMemberList.length + ') 人'} noHovering className="setting-group">
{this.state.groupMemberList.length ? this.state.groupMemberList.map((item, index) => { {this.state.groupMemberList.length ? this.state.groupMemberList.map((item, index) => {

View File

@ -25,6 +25,7 @@ function mock(mockJSON, context) {
c[i] = p[i]; c[i] = p[i];
if (filters.length > 1) { if (filters.length > 1) {
for (var f = 1, l = filters.length, index; f < l; f++) { for (var f = 1, l = filters.length, index; f < l; f++) {
filters[f] = filters[f].toLowerCase();
if (filters[f] in filtersMap) { if (filters[f] in filtersMap) {
if ((index = newFilters.indexOf(filters[f])) !== -1) { if ((index = newFilters.indexOf(filters[f])) !== -1) {
newFilters.splice(index, 1); newFilters.splice(index, 1);

View File

@ -360,8 +360,10 @@ class interfaceController extends baseController {
catid: 'number' catid: 'number'
}); });
params.method = params.method || 'GET'; if (!_.isUndefined(params.method)) {
params.method = params.method.toUpperCase(); params.method = params.method || 'GET';
params.method = params.method.toUpperCase();
}
let id = ctx.request.body.id; let id = ctx.request.body.id;
@ -482,7 +484,7 @@ class interfaceController extends baseController {
if (data.catid) { if (data.catid) {
this.catModel.get(+data.catid).then((cate) => { this.catModel.get(+data.catid).then((cate) => {
yapi.commons.saveLog({ yapi.commons.saveLog({
content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${data.title}"`, content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${interfaceData.title}"`,
type: 'project', type: 'project',
uid: this.getUid(), uid: this.getUid(),
username: username, username: username,
@ -494,7 +496,7 @@ class interfaceController extends baseController {
let cateid = interfaceData.catid; let cateid = interfaceData.catid;
this.catModel.get(cateid).then((cate) => { this.catModel.get(cateid).then((cate) => {
yapi.commons.saveLog({ yapi.commons.saveLog({
content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${data.title}"`, content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${interfaceData.title}"`,
type: 'project', type: 'project',
uid: this.getUid(), uid: this.getUid(),
username: username, username: username,