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

This commit is contained in:
wenbo.dong 2017-09-29 18:10:15 +08:00
commit 727f8ef8d9
4 changed files with 27 additions and 9 deletions

View File

@ -57,7 +57,10 @@ class Follows extends Component {
}
render () {
const data = this.state.data;
let data = this.state.data;
data = data.sort((a,b)=>{
return b.up_time - a.up_time;
})
return (
<div>
<div className="g-row" style={{paddingLeft: '32px', paddingRight: '32px'}}>

View File

@ -268,13 +268,13 @@ export default class GroupList extends Component {
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' && this.props.curUserRole !== 'admin') ? <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' && currGroup.role === 'owner'){
if(this.props.currGroup.type==='private' && currGroup.role === 'owner' && this.props.curUserRole !== 'admin'){
menu = null;
}

View File

@ -102,9 +102,22 @@ class ProjectList extends Component {
render() {
let projectData = this.state.projectData;
projectData = projectData.sort((a,b)=>{
let noFollow = [];
let followProject = [];
for(var i in projectData){
if(projectData[i].follow){
followProject.push(projectData[i]);
}else{
noFollow.push(projectData[i]);
}
}
followProject = followProject.sort((a,b)=>{
return b.up_time - a.up_time;
})
noFollow = noFollow.sort((a,b)=>{
return b.up_time - a.up_time;
})
projectData = [...followProject,...noFollow]
return (
<div style={{ paddingTop: '24px' }} className="m-panel card-panel card-panel-s project-list" >
<Row className="project-list-header">
@ -112,8 +125,6 @@ class ProjectList extends Component {
{this.props.currGroup.group_name}分组 {projectData.length} 个项目
</Col>
<Col>
{/(admin)|(owner)|(dev)/.test(this.props.currGroup.role) ?
<Button type="primary"><Link to="/add-project">添加项目</Link></Button>:
<Tooltip title="您没有权限,请联系该分组组长或管理员">

View File

@ -59,7 +59,7 @@ export default class InterfaceCaseContent extends Component {
let currColId = 0;
colList.forEach(col => {
col.caseList.forEach(caseItem => {
if (+caseItem._id === currCaseId) {
if (+caseItem._id === +currCaseId) {
currColId = col._id;
}
})
@ -83,8 +83,12 @@ export default class InterfaceCaseContent extends Component {
async componentWillReceiveProps(nextProps) {
const oldCaseId = this.props.match.params.actionId
const newCaseId = nextProps.match.params.actionId
if (oldCaseId !== newCaseId) {
let currColId = this.getColId(this.props.interfaceColList, newCaseId);
const id = this.props.match.params.id;
const { interfaceColList } = nextProps;
let currColId = this.getColId(interfaceColList, newCaseId);
if(!currColId) {
this.props.history.push('/project/' + id + '/interface/col/' + interfaceColList[0]._id)
} else if (oldCaseId !== newCaseId) {
await this.props.fetchCaseData(newCaseId);
this.props.setColData({currCaseId: +newCaseId, currColId, isShowCol: false})
this.setState({editCasename: this.props.currCase.casename})