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

This commit is contained in:
wenbo.dong 2017-09-29 17:03:23 +08:00
commit cb0031a130
8 changed files with 15589 additions and 31 deletions

View File

@ -259,25 +259,26 @@ export default class GroupList extends Component {
let menu = <Menu>
{
this.props.curUserRole === "admin" ? (editmark) : ''
this.props.curUserRole === "admin" && this.props.currGroup.type!=='private' ? (editmark) : ''
}
{
this.props.curUserRole === "admin" || currGroup.role === 'owner' ? (delmark) : ''
(this.props.curUserRole === "admin" || currGroup.role === 'owner') && this.props.currGroup.type!=='private' ? (delmark) : ''
}
{
this.props.curUserRole === 'admin' ? (addmark) : ''
}
</Menu>;
menu = currGroup.role === 'owner' ? <a className="editSet"><Icon type="setting" onClick={() => this.showModal(TYPE_EDIT)} /></a> : <Dropdown overlay={menu}>
menu = currGroup.role === 'owner' ? <a className="editSet"><Icon type="setting" onClick={() => this.showModal(TYPE_EDIT)} /></a> : <Dropdown overlay={menu}>
<a className="ant-dropdown-link" href="#">
<Icon type="setting" />
</a>
</Dropdown>;
if( this.props.currGroup.type==='private'){
if(this.props.currGroup.type!=='private' && currGroup.role === 'owner'){
menu = null;
}
return (
<div className="m-group">
{!this.props.study ? <div className="study-mask"></div> : null}

View File

@ -299,8 +299,8 @@ class InterfaceColContent extends Component {
let newColId = nextProps.match.params.actionId
if (!interfaceColList.find(item => +item._id === +newColId)) {
this.props.history.push('/project/' + id + '/interface/col/' + interfaceColList[0]._id)
} else if (oldColId !== newColId) {
if ((newColId && newColId != 0) || interfaceColList !== this.props.interfaceColList) {
} else if ((oldColId !== newColId) || interfaceColList !== this.props.interfaceColList) {
if (newColId && newColId != 0) {
await this.props.fetchCaseList(newColId);
this.props.setColData({ currColId: +newColId, isShowCol: true })
this.handleColdata(this.props.currCaseList)

View File

@ -295,9 +295,9 @@ export default class InterfaceColMenu extends Component {
<div className="menu-title">
<span><Icon type="folder-open" style={{marginRight: 5}} /><span>{col.name}</span></span>
<div className="btns">
<Icon type='delete' className="interface-delete-icon" onClick={() => {this.showDelColConfirm(col._id)}} />
<Icon type='edit' className="interface-delete-icon" onClick={() => {this.showColModal('edit', col)}} />
<Icon type='plus' className="interface-delete-icon" onClick={() => this.showImportInterfaceModal(col._id)} />
<Icon type='delete' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showDelColConfirm(col._id)}} />
<Icon type='edit' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showColModal('edit', col)}} />
<Icon type='plus' className="interface-delete-icon" onClick={(e) => {e.stopPropagation();this.showImportInterfaceModal(col._id)}} />
</div>
{/*<Dropdown overlay={menu(col)} trigger={['click']} onClick={e => e.stopPropagation()}>
<Icon className="opts-icon" type='ellipsis'/>
@ -318,7 +318,7 @@ export default class InterfaceColMenu extends Component {
title={
<div className="menu-title" title={interfaceCase.casename}>
<span className="casename">{interfaceCase.casename}</span>
<Icon type='delete' className="case-delete-icon" onClick={() => { this.showDelCaseConfirm(interfaceCase._id) }} />
<Icon type='delete' className="case-delete-icon" onClick={(e) => { e.stopPropagation();this.showDelCaseConfirm(interfaceCase._id) }} />
</div>
}
></TreeNode>

View File

@ -339,8 +339,8 @@ class InterfaceMenu extends Component {
title={<div className="container-title" onMouseEnter={() => this.enterItem(item._id)} onMouseLeave={this.leaveItem} >
<Link className="interface-item" to={"/project/" + matchParams.id + "/interface/api/" + item._id} >{item.title}</Link>
<div className="btns">
<Icon type='delete' className="interface-delete-icon" onClick={() => { this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
<Icon type='copy' className="interface-delete-icon" onClick={() => { this.copyInterface(item) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
<Icon type='copy' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.copyInterface(item) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />
</div>
{/*<Dropdown overlay={menu(item)} trigger={['click']} onClick={e => e.stopPropagation()}>
<Icon type='ellipsis' className="interface-delete-icon" style={{ opacity: this.state.delIcon == item._id ? 1 : 0 }}/>
@ -420,14 +420,16 @@ class InterfaceMenu extends Component {
return <TreeNode title={<div className="container-title" onMouseEnter={() => this.enterItem(item._id)} onMouseLeave={this.leaveItem} >
<Link className="interface-item" to={"/project/" + matchParams.id + "/interface/api/cat_" + item._id} ><Icon type="folder-open" style={{ marginRight: 5 }} />{item.name}</Link>
<div className="btns">
<Icon type='delete' className="interface-delete-icon" onClick={() => { this.showDelCatConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }}/>
<Icon type='edit' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={() => {
<Icon type='delete' className="interface-delete-icon" onClick={(e) => { e.stopPropagation();this.showDelCatConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }}/>
<Icon type='edit' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={(e) => {
e.stopPropagation();
this.changeModal('change_cat_modal_visible', true);
this.setState({
curCatdata: item
})
}} />
<Icon type='plus' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={() => {
<Icon type='plus' className="interface-delete-icon" style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} onClick={(e) => {
e.stopPropagation();
this.changeModal('visible', true);
this.setState({
curCatid: item._id

15551
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -200,13 +200,15 @@ class groupController extends baseController {
dev: "开发者",
guest: "访客"
};
yapi.commons.saveLog({
content: `用户 "${username}" 新增了分组成员 "${add_members.reduce((str, item) => (str ? str + '、' : '') + item.username, '')}" 为 "${rolename[params.role]}"`,
type: 'group',
uid: this.getUid(),
username: username,
typeid: params.id
});
if(add_members.length){
yapi.commons.saveLog({
content: `用户 "${username}" 新增了分组成员 "${add_members.reduce((str, item) => (str ? str + '、' : '') + item.username, '')}" 为 "${rolename[params.role]}"`,
type: 'group',
uid: this.getUid(),
username: username,
typeid: params.id
});
}
ctx.body = yapi.commons.resReturn({
result,
add_members,

View File

@ -203,14 +203,16 @@ class projectController extends baseController {
try {
let result = await this.Model.addMember(params.id, add_members);
let username = this.getUsername();
yapi.commons.saveLog({
content: `用户 "${username}" 添加了项目成员 "${add_members.reduce((str, item) => (str ? str + '、' : '') + item.username, '')}"`,
type: 'project',
uid: this.getUid(),
username: username,
typeid: params.id
});
if(add_members.length){
let username = this.getUsername();
yapi.commons.saveLog({
content: `用户 "${username}" 添加了项目成员 "${add_members.reduce((str, item) => (str ? str + '、' : '') + item.username, '')}"`,
type: 'project',
uid: this.getUid(),
username: username,
typeid: params.id
});
}
ctx.body = yapi.commons.resReturn({
result,
add_members,

View File

@ -13,7 +13,7 @@ class groupModel extends baseModel {
group_desc: String,
add_time: Number,
up_time: Number,
type: {type:String,default: 'private', enum: ['public', 'private']},
type: {type:String,default: 'public', enum: ['public', 'private']},
members: [
{
uid: Number,