mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-09 05:00:30 +08:00
Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev
This commit is contained in:
commit
8f89005066
@ -15,20 +15,20 @@ import GuideBtns from '../GuideBtns/GuideBtns.js';
|
||||
|
||||
const MenuUser = (props) => (
|
||||
<Menu theme="dark" className="user-menu" >
|
||||
<Menu.Item style={{"background":"#32363a",color:"white"}} key="0">
|
||||
<Link style={{color:"white"}} to={`/user/profile/${props.uid}`} onClick={props.relieveLink}><Icon type="user"/>个人中心</Link>
|
||||
<Menu.Item key="0">
|
||||
<Link to={`/user/profile/${props.uid}`} onClick={props.relieveLink}><Icon type="user"/>个人中心</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item style={{"background":"#32363a",color:"white"}} key="1">
|
||||
<Link style={{color:"white"}} to={`/follow`} onClick={props.relieveLink}><Icon type="star-o"/>我的关注</Link>
|
||||
<Menu.Item key="1">
|
||||
<Link to={`/follow`} onClick={props.relieveLink}><Icon type="star-o"/>我的关注</Link>
|
||||
</Menu.Item>
|
||||
{
|
||||
props.role === "admin"?<Menu.Item style={{"background":"#32363a",color:"white"}} key="2">
|
||||
<Link style={{color:"white"}} to={`/user/list`}><Icon type="solution" />用户管理</Link>
|
||||
props.role === "admin"?<Menu.Item key="2">
|
||||
<Link to={`/user/list`}><Icon type="solution" />用户管理</Link>
|
||||
</Menu.Item>:""
|
||||
}
|
||||
|
||||
<Menu.Item key="3">
|
||||
<a style={{color:"white"}} onClick={props.logout}><Icon type="logout" />退出</a>
|
||||
<a onClick={props.logout}><Icon type="logout" />退出</a>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
@ -243,6 +243,19 @@ export default class InterfaceColMenu extends Component {
|
||||
this.setState({filterValue: value})
|
||||
}
|
||||
|
||||
onDrop = async (e) => {
|
||||
const projectId = this.props.match.params.id;
|
||||
const dropColIndex = e.node.props.pos.split('-')[1];
|
||||
const dropColId = this.props.interfaceColList[dropColIndex]._id;
|
||||
const id = e.dragNode.props.eventKey;
|
||||
const dragColIndex = e.dragNode.props.pos.split('-')[1];
|
||||
const dragColId = this.props.interfaceColList[dragColIndex]._id;
|
||||
if (id.indexOf('col') === -1 && dropColId !== dragColId) {
|
||||
await axios.post('/api/col/up_case', {id: id.split('_')[1], col_id: dropColId});
|
||||
this.props.fetchInterfaceColList(projectId);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { currColId, currCaseId, isShowCol } = this.props;
|
||||
const { colModalType, colModalVisible, filterValue, importInterVisible } = this.state;
|
||||
@ -282,6 +295,8 @@ export default class InterfaceColMenu extends Component {
|
||||
onSelect={this.onSelect}
|
||||
autoExpandParent
|
||||
onExpand={this.onExpand}
|
||||
draggable
|
||||
onDrop={this.onDrop}
|
||||
>
|
||||
{
|
||||
this.props.interfaceColList.filter(col =>{
|
||||
|
@ -248,6 +248,21 @@ class InterfaceMenu extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
onDrop = async (e) => {
|
||||
const dropCatIndex = e.node.props.pos.split('-')[1] - 1;
|
||||
const dragCatIndex = e.dragNode.props.pos.split('-')[1] - 1;
|
||||
if (dropCatIndex < 0 || dragCatIndex < 0) {
|
||||
return ;
|
||||
}
|
||||
const dropCatId = this.props.list[dropCatIndex]._id;
|
||||
const id = e.dragNode.props.eventKey;
|
||||
const dragCatId = this.props.list[dragCatIndex]._id;
|
||||
if (id.indexOf('cat') === -1 && dropCatId !== dragCatId) {
|
||||
await axios.post('/api/interface/up', {id, catid: dropCatId});
|
||||
this.props.fetchInterfaceList(this.props.projectId);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const matchParams = this.props.match.params;
|
||||
let menuList = this.state.list;
|
||||
@ -421,6 +436,8 @@ class InterfaceMenu extends Component {
|
||||
selectedKeys={currentKes.selects}
|
||||
onSelect={this.onSelect}
|
||||
onExpand={this.onExpand}
|
||||
draggable
|
||||
onDrop={this.onDrop}
|
||||
>
|
||||
<TreeNode className="item-all-interface" title={<Link style={{ fontSize: '14px' }} to={"/project/" + matchParams.id + "/interface/api"}><Icon type="folder" style={{ marginRight: 5 }} />全部接口</Link>} key="root" />
|
||||
{menuList.map((item) => {
|
||||
|
@ -328,9 +328,9 @@ class interfaceColController extends baseController{
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '用例id不能为空');
|
||||
}
|
||||
|
||||
if(!params.casename){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '用例名称不能为空');
|
||||
}
|
||||
// if(!params.casename){
|
||||
// return ctx.body = yapi.commons.resReturn(null, 400, '用例名称不能为空');
|
||||
// }
|
||||
|
||||
let caseData = await this.caseModel.get(params.id);
|
||||
let auth = await this.checkAuth(caseData.project_id, 'project', 'edit');
|
||||
@ -342,13 +342,13 @@ class interfaceColController extends baseController{
|
||||
|
||||
delete params.interface_id;
|
||||
delete params.project_id;
|
||||
delete params.col_id;
|
||||
// delete params.col_id;
|
||||
|
||||
let result = await this.caseModel.up(params.id, params);
|
||||
let username = this.getUsername();
|
||||
this.colModel.get(caseData.col_id).then((col)=>{
|
||||
yapi.commons.saveLog({
|
||||
content: `用户 "${username}" 在接口集 "${col.name}" 更新了接口用例 "${params.casename}"`,
|
||||
content: `用户 "${username}" 在接口集 "${col.name}" 更新了接口用例 "${params.casename || caseData.casename}"`,
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
|
Loading…
Reference in New Issue
Block a user