mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev
This commit is contained in:
commit
7d761ab16e
@ -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 = '暂无数据';
|
||||||
|
@ -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)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
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';
|
||||||
import ErrMsg from '../../../components/ErrMsg/ErrMsg.js';
|
import ErrMsg from '../../../components/ErrMsg/ErrMsg.js';
|
||||||
import { autobind } from 'core-decorators';
|
import { autobind } from 'core-decorators';
|
||||||
import { setBreadcrumb } from '../../../reducer/modules/user';
|
import { setBreadcrumb } from '../../../reducer/modules/user';
|
||||||
|
|
||||||
import './ProjectList.scss'
|
import './ProjectList.scss'
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class ProjectList extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
this.props.setBreadcrumb([{name: '' + (nextProps.currGroup.group_name || '')}]);
|
this.props.setBreadcrumb([{ name: '' + (nextProps.currGroup.group_name || '') }]);
|
||||||
|
|
||||||
// 切换分组
|
// 切换分组
|
||||||
if (this.props.currGroup !== nextProps.currGroup) {
|
if (this.props.currGroup !== nextProps.currGroup) {
|
||||||
@ -101,13 +101,19 @@ class ProjectList extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const projectData = this.state.projectData;
|
const projectData = this.state.projectData;
|
||||||
return (
|
return (
|
||||||
<div style={{paddingTop: '20px'}} className="m-panel card-panel card-panel-s project-list" >
|
<div style={{ paddingTop: '20px' }} className="m-panel card-panel card-panel-s project-list" >
|
||||||
<Row className="project-list-header">
|
<Row className="project-list-header">
|
||||||
<Col span={16} style={{textAlign: 'left'}}>
|
<Col span={16} style={{ textAlign: 'left' }}>
|
||||||
{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>
|
||||||
@ -117,7 +123,7 @@ class ProjectList extends Component {
|
|||||||
<Col span={8} key={index}>
|
<Col span={8} key={index}>
|
||||||
<ProjectCard projectData={item} callbackResult={this.receiveRes} />
|
<ProjectCard projectData={item} callbackResult={this.receiveRes} />
|
||||||
</Col>);
|
</Col>);
|
||||||
}) : <ErrMsg type="noProject"/>}
|
}) : <ErrMsg type="noProject" />}
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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)=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user