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

This commit is contained in:
wenbo.dong 2017-09-14 15:31:28 +08:00
commit 7d761ab16e
5 changed files with 27 additions and 23 deletions

View File

@ -58,7 +58,7 @@ class ErrMsg extends Component {
break; break;
case 'noProject': case 'noProject':
title = '该分组还没有项目呢'; title = '该分组还没有项目呢';
desc = <span>请点击右上角 <Icon type="plus-circle" /> 按钮新建项目</span>; desc = <span>请点击右上角添加项目按钮新建项目</span>;
break; break;
case 'noData': case 'noData':
title = '暂无数据'; title = '暂无数据';

View File

@ -192,7 +192,7 @@ export default class Run extends Component {
const href = URL.format({ const href = URL.format({
protocol: urlObj.protocol || 'http', protocol: urlObj.protocol || 'http',
host: urlObj.host, host: urlObj.host,
pathname: path, pathname: urlObj.pathname? urlObj.pathname + path : path,
query: this.getQueryObj(query) query: this.getQueryObj(query)
}); });

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Row, Col, Button } from 'antd'; import { Row, Col, Button, Tooltip } from 'antd';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { addProject, fetchProjectList, delProject, changeUpdateModal } from '../../../reducer/modules/project'; import { addProject, fetchProjectList, delProject, changeUpdateModal } from '../../../reducer/modules/project';
import ProjectCard from '../../../components/ProjectCard/ProjectCard.js'; import ProjectCard from '../../../components/ProjectCard/ProjectCard.js';
@ -107,7 +107,13 @@ class ProjectList extends Component {
{this.props.currGroup.group_name}分组 {projectData.length} 个项目 {this.props.currGroup.group_name}分组 {projectData.length} 个项目
</Col> </Col>
<Col> <Col>
<Link to="/add-project"> <Button type="primary" >添加项目</Button></Link>
<Tooltip title="您没有权限,请联系该分组组长或管理员">
{this.props.currGroup.role ?
<Button type="primary" ><Link to="/add-project">添加项目</Link></Button> :
<Button type="primary" disabled >添加项目</Button>}
</Tooltip>
</Col> </Col>
</Row> </Row>

View File

@ -231,14 +231,14 @@ class ProjectMessage extends Component {
validator(rule, value, callback) { validator(rule, value, callback) {
if (value) { if (value) {
if (value.length === 0) { if (value.length === 0) {
callback('请输入环境名'); callback('请输入环境');
} else if (!/\S/.test(value)) { } else if (!/\S/.test(value)) {
callback('请输入环境名'); callback('请输入环境');
} else { } else {
return callback(); return callback();
} }
} else { } else {
callback('请输入环境名'); callback('请输入环境');
} }
} }
}] }]
@ -266,8 +266,6 @@ class ProjectMessage extends Component {
callback('请输入环境域名!'); callback('请输入环境域名!');
} else if (/\s/.test(value)) { } else if (/\s/.test(value)) {
callback('环境域名不允许出现空格!'); callback('环境域名不允许出现空格!');
} else if (/\//.test(value)) {
callback('环境域名不允许出现‘\/!');
} else { } else {
return callback(); return callback();
} }

View File

@ -76,13 +76,13 @@ class interfaceController extends baseController {
return ctx.body = yapi.commons.resReturn(null, 400, '接口请求路径不能为空'); return ctx.body = yapi.commons.resReturn(null, 400, '接口请求路径不能为空');
} }
let http_path = url.parse(params.path); let http_path = url.parse(params.path, true);
params.path = http_path.pathname;
if (!yapi.commons.verifyPath(http_path.path)) { if (!yapi.commons.verifyPath(http_path.pathname)) {
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'); return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
} }
params.req_query = params.req_query || [];
if(!params.req_query){ if(!params.req_query){
params.req_query = []; params.req_query = [];
Object.keys(http_path.query).forEach((item)=>{ Object.keys(http_path.query).forEach((item)=>{