forked from Gitlink/forgeplus-react
权限:易修和合并请求的新建修改等操作权限
This commit is contained in:
parent
2d312b6176
commit
79996bd185
|
@ -33,7 +33,7 @@
|
|||
li{
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding:0px;
|
||||
padding:0px!important;
|
||||
cursor: default;
|
||||
&:hover{
|
||||
background-color: #fff;
|
||||
|
|
|
@ -2,6 +2,7 @@ import React , { Component } from 'react';
|
|||
import { Spin , Pagination } from 'antd';
|
||||
import { getImageUrl } from 'educoder';
|
||||
import { truncateCommitId } from '../common/util';
|
||||
import { AlignTop } from '../Component/layout';
|
||||
import SelectBranch from '../Branch/Select';
|
||||
import Nodata from '../Nodata';
|
||||
|
||||
|
@ -132,10 +133,10 @@ class CoderRootCommit extends Component{
|
|||
commitDatas && commitDatas.length > 0 && commitDatas.map((item,k)=>{
|
||||
return(
|
||||
<div key={k}>
|
||||
<p className="f-wrap-alignCenter">
|
||||
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0}}>{truncateCommitId(`${item.sha}`)}</Link>
|
||||
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="flex1 ml20 font-16 color-grey-3">{item.message}</Link>
|
||||
</p>
|
||||
<AlignTop>
|
||||
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitKey" style={{marginLeft:0,marginTop:"3px"}}>{truncateCommitId(`${item.sha}`)}</Link>
|
||||
<Link to={`/projects/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="commitDesc">{item.message}</Link>
|
||||
</AlignTop>
|
||||
<p className="f-wrap-alignCenter mt15">
|
||||
{
|
||||
item.id ?
|
||||
|
|
|
@ -43,7 +43,7 @@ class MergeItem extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { issues, project_name, project_author_name } = this.props;
|
||||
const { issues, project_name, project_author_name , user_admin_or_member} = this.props;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { current_user } = this.props;
|
||||
const renderList = () => {
|
||||
|
@ -177,7 +177,7 @@ class MergeItem extends Component {
|
|||
) : (
|
||||
""
|
||||
)}
|
||||
{current_user && current_user.login ? (
|
||||
{user_admin_or_member ? (
|
||||
<div
|
||||
className="milepostleft"
|
||||
style={{
|
||||
|
|
|
@ -41,6 +41,7 @@ class MessageCount extends Component {
|
|||
edit_spin: false,
|
||||
pr_status: undefined,
|
||||
pull_request:undefined,
|
||||
conflict_files:[],
|
||||
|
||||
copyVisible:false,
|
||||
};
|
||||
|
@ -75,7 +76,8 @@ class MessageCount extends Component {
|
|||
data: result.data,
|
||||
SpinFlag: false,
|
||||
pr_status: result.data.pull_request && result.data.pull_request.status,
|
||||
pull_request:result.data.pull_request
|
||||
pull_request:result.data.pull_request,
|
||||
conflict_files:result.data.conflict_files
|
||||
});
|
||||
} else {
|
||||
this.setState({ SpinFlag: false });
|
||||
|
@ -263,13 +265,28 @@ class MessageCount extends Component {
|
|||
</div>
|
||||
)
|
||||
}
|
||||
mergeabledDesc=(base,head)=>{
|
||||
mergeabledDesc=(base,head,conflict_files)=>{
|
||||
return(
|
||||
<ul id="descContent">
|
||||
<li>git fetch origin</li>
|
||||
<li>git checkout -b {`${base}`} origin/{`${base}`}</li>
|
||||
<li>git merge {`${head}`}</li>
|
||||
</ul>
|
||||
<div>
|
||||
<ul id="descContent">
|
||||
<li>git fetch origin</li>
|
||||
<li>git checkout -b {`${base}`} origin/{`${base}`}</li>
|
||||
<li>git merge {`${head}`}</li>
|
||||
</ul>
|
||||
{
|
||||
conflict_files && conflict_files.length>0 &&
|
||||
<div>
|
||||
<p className="mt10 font-16 pt10" style={{borderTop:"1px solid #f9d7d5"}}>如下文件有代码冲突:</p>
|
||||
<p>
|
||||
{
|
||||
conflict_files.map((i,k)=>{
|
||||
return k>0 ? ","+i : i
|
||||
})
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -284,7 +301,8 @@ class MessageCount extends Component {
|
|||
ismesrge,
|
||||
SpinFlag,
|
||||
copyVisible,
|
||||
pull_request
|
||||
pull_request,
|
||||
conflict_files
|
||||
} = this.state;
|
||||
const { current_user, projectDetail } = this.props;
|
||||
const menu = (
|
||||
|
@ -495,7 +513,7 @@ class MessageCount extends Component {
|
|||
<Alert
|
||||
message={this.mergeabledMes()}
|
||||
type="error"
|
||||
description={this.mergeabledDesc(pull_request.base,pull_request.head)}
|
||||
description={this.mergeabledDesc(pull_request.base,pull_request.head,conflict_files)}
|
||||
showIcon
|
||||
/>
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ class merge extends Component {
|
|||
|
||||
renderMenu = (array, name, id) => {
|
||||
return (
|
||||
<Menu>
|
||||
<Menu className="orderCondition">
|
||||
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>
|
||||
{name}
|
||||
</Menu.Item>
|
||||
|
@ -214,14 +214,9 @@ class merge extends Component {
|
|||
this.getIssueList();
|
||||
};
|
||||
|
||||
islogin() {
|
||||
checkOperation() {
|
||||
const { projectsId,owner } = this.props.match.params;
|
||||
if (this.props.checkIfLogin() === false) {
|
||||
this.props.showLoginDialog();
|
||||
return;
|
||||
} else {
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new`);
|
||||
}
|
||||
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new`);
|
||||
}
|
||||
render() {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
|
@ -263,9 +258,12 @@ class merge extends Component {
|
|||
style={{ width: 300 }}
|
||||
/>
|
||||
</div>
|
||||
<a className="topWrapper_btn ml10" onClick={() => this.islogin()}>
|
||||
+ 新建合并请求
|
||||
</a>
|
||||
{
|
||||
data && data.user_admin_or_member &&
|
||||
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
|
||||
+ 新建合并请求
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<div className="f-wrap-between screenWrap">
|
||||
<div className="df">
|
||||
|
@ -402,6 +400,7 @@ class merge extends Component {
|
|||
project_author_name={data.project_author_name}
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
user_admin_or_member={data && data.user_admin_or_member}
|
||||
></OrderItem>
|
||||
</div>
|
||||
):""}
|
||||
|
|
|
@ -249,7 +249,7 @@ class Detail extends Component {
|
|||
添加于 {data && data.created_at}
|
||||
</span>
|
||||
{data && data.user_permission ? (
|
||||
<span className="pull-right">
|
||||
<span className="pull-right 123123">
|
||||
<a className="color-blue fr" onClick={this.copydetail}>
|
||||
复制
|
||||
</a>
|
||||
|
|
|
@ -153,7 +153,7 @@ class Milepost extends Component {
|
|||
const { data, limit, page, openselect, closeselect, spinings } = this.state;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const menu = (
|
||||
<Menu onClick={this.arrayList}>
|
||||
<Menu className="orderCondition" onClick={this.arrayList}>
|
||||
<Menu.Item key={'created_on'} value="desc">到期日从近到远</Menu.Item>
|
||||
<Menu.Item key={'created_on'} value="asc">到期日从远到近</Menu.Item>
|
||||
<Menu.Item key={'percent'} value="desc">完成度从低到高</Menu.Item>
|
||||
|
|
|
@ -162,7 +162,7 @@ class MilepostDetail extends Component {
|
|||
|
||||
renderMenu = (array, name, id) => {
|
||||
return (
|
||||
<Menu>
|
||||
<Menu className="orderCondition">
|
||||
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>{name}</Menu.Item>
|
||||
{
|
||||
array && array.length > 0 && array.map((item, key) => {
|
||||
|
|
|
@ -42,10 +42,9 @@ class OrderItem extends Component {
|
|||
})
|
||||
}
|
||||
render() {
|
||||
const { item , checkbox , mile } = this.props;
|
||||
const { item , checkbox , mile , user_admin_or_member } = this.props;
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { current_user } = this.props
|
||||
|
||||
const { current_user } = this.props;
|
||||
return (
|
||||
item &&
|
||||
<div className="issueItem">
|
||||
|
@ -91,7 +90,7 @@ class OrderItem extends Component {
|
|||
<div className="milepostleft">
|
||||
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
|
||||
{
|
||||
current_user && current_user.login ?
|
||||
user_admin_or_member ?
|
||||
<div id="hoverBox" style={{ display: this.state.orderid === item.id && this.state.isdisplay ? 'flex' : 'none' }}>
|
||||
<div className="mr8 ml8 color-grey-9">
|
||||
<Link to={`/projects/${owner}/${projectsId}/issues/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
|
||||
|
|
|
@ -592,7 +592,7 @@ a.issue-type-button.active:hover {
|
|||
}
|
||||
|
||||
/* 发布人、指派人数量过多时要出现滚动条 */
|
||||
.ant-dropdown-menu {
|
||||
.ant-dropdown-menu.orderCondition {
|
||||
max-height: 350px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ class order extends Component {
|
|||
|
||||
renderMenu = (array, name, id, toGet) => {
|
||||
return (
|
||||
<Menu>
|
||||
<Menu className="orderCondition">
|
||||
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name, toGet)}>
|
||||
{name}
|
||||
</Menu.Item>
|
||||
|
@ -347,17 +347,14 @@ class order extends Component {
|
|||
this.props.showLoginDialog();
|
||||
}
|
||||
renderNew =()=>{
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
if (this.props.checkIfLogin()) {
|
||||
const { data } = this.state;
|
||||
if(data && data.user_admin_or_member){
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
return(
|
||||
<Link className="topWrapper_btn ml10" target="_blank" to={`/projects/${owner}/${projectsId}/issues/new`}>
|
||||
+ 创建易修
|
||||
</Link>
|
||||
)
|
||||
}else{
|
||||
return(
|
||||
<a className="topWrapper_btn ml10" onClick={this.islogin}>+ 创建易修</a>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -828,6 +825,7 @@ class order extends Component {
|
|||
{...this.props}
|
||||
{...this.state}
|
||||
deletedetail={this.deletedetail}
|
||||
user_admin_or_member={data && data.user_admin_or_member}
|
||||
></OrderItem>
|
||||
)
|
||||
})}
|
||||
|
|
|
@ -87,6 +87,14 @@ ul,ol,dl{
|
|||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
.commitDesc{
|
||||
flex:1;
|
||||
margin-left:20px;
|
||||
font-size:16px;
|
||||
color:#333;
|
||||
line-height:26px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.normalBox{
|
||||
border-radius: 4px;
|
||||
|
|
Loading…
Reference in New Issue