issue-同步镜像项目不能对仓库进行操作(新建合并请求、新建发行版等)

This commit is contained in:
caishi 2021-08-05 17:13:57 +08:00
parent 14f80d56ad
commit e2ad3b1308
7 changed files with 42 additions and 17 deletions

View File

@ -2,7 +2,7 @@ import React from 'react';
import { AlignCenter , AlignTop , FlexAJ } from '../Component/layout';
import { Link } from 'react-router-dom';
function Releases({owner,projectsId,releaseVersions , baseOperate}){
function Releases({owner,projectsId,releaseVersions , baseOperate , projectType}){
return(
<div>
@ -10,7 +10,7 @@ function Releases({owner,projectsId,releaseVersions , baseOperate}){
<AlignCenter><span className="font-16 color-grey-6">发行版</span>
{ releaseVersions && releaseVersions.total_count > 0 && <span className="infoCount">{releaseVersions.total_count}</span>}
</AlignCenter>
{ releaseVersions && releaseVersions.total_count > 0 ?
{ (releaseVersions && releaseVersions.total_count > 0) || projectType ===2 ?
<Link className="font-12 color-grey-9" to={`/projects/${owner}/${projectsId}/releases`}>全部</Link>
:
baseOperate && <Link className="font-12 color-blue" to={`/projects/${owner}/${projectsId}/releases/new`}>新建</Link>

View File

@ -63,6 +63,8 @@ function CoderDepot(props){
const [ readme , setReadme ] = useState(undefined);
const [ defaultBranch , setDefaultBranch ] = useState(undefined);
const [ editReadme , setEditReadme ] = useState(false);
const [ pullsFlag , setPullsFlag ] = useState(true);
const [ issuesFlag , setIssuesFlag ] = useState(true);
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
@ -70,6 +72,22 @@ function CoderDepot(props){
branchName = returnbar(branchName);
const details = props.projectDetail;
let pathname = props.history.location.pathname;
const { bannerList } = props;
useEffect(()=>{
if(bannerList && bannerList.length>0){
let a = bannerList.filter(i=>i.menu_name === "pulls");
let i = bannerList.filter(i=>i.menu_name === "issues");
if(a && a.length === 0){
setPullsFlag(false);
}
if(i && i.length === 0){
setIssuesFlag(false);
}
}
},[bannerList])
useEffect(()=>{
if(details){
@ -344,10 +362,13 @@ function CoderDepot(props){
baseOperate &&
<div className="mr20 addOptionBtn">
{
projectDetail.type !== 2 &&
projectDetail.type !== 2 && pullsFlag &&
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</a>
}
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
{
issuesFlag &&
<a onClick={()=>urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务</a>
}
</div>
}
{ fileOperate &&
@ -484,6 +505,7 @@ function CoderDepot(props){
releaseVersions={projectDetail.release_versions}
history={props.history}
baseOperate={baseOperate}
projectType={projectDetail.type}
/>
</React.Fragment>
}

View File

@ -17,8 +17,7 @@ export default ((props)=>{
const [ isSpin , setIsSpin ] =useState(true);
const { projectsId , owner } = props.match.params;
const { isManager , isDeveloper} = props;
console
const { isManager , isDeveloper , projectDetail } = props;
useEffect(()=>{
getBranchs(projectsId, owner);
},[projectsId])
@ -48,7 +47,7 @@ export default ((props)=>{
</div>
<span>
{
(isManager || isDeveloper) &&
(isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) &&
<Link to={`/projects/${owner}/${projectsId}/pulls/new/${item.name}`} className="mr20 color-blue mr30">创建合并请求</Link>
}
<Dropdown overlay={menu(item.zip_url,item.tar_url)} trigger={['click']} placement="bottomRight" className="color-green-file">

View File

@ -346,7 +346,7 @@ class MergeForm extends Component {
</Select>
)}
</Form.Item>
<Form.Item label="其他">
{/* <Form.Item label="">
{getFieldDecorator("checkbox-group")(
<Checkbox.Group>
<div>
@ -360,7 +360,7 @@ class MergeForm extends Component {
</div>
</Checkbox.Group>
)}
</Form.Item>
</Form.Item> */}
</div>
</div>
</div>

View File

@ -154,8 +154,8 @@ class Milepost extends Component {
const { projectsId , owner } = this.props.match.params;
const menu = (
<Menu className="orderCondition" onClick={this.arrayList}>
<Menu.Item key={'effective_date'} value="desc">到期日从近到远</Menu.Item>
<Menu.Item key={'effective_date'} value="asc">到期日从远到近</Menu.Item>
<Menu.Item key={'effective_date'} value="desc">到期日从后到先</Menu.Item>
<Menu.Item key={'effective_date'} value="asc">到期日从先到后</Menu.Item>
<Menu.Item key={'percent'} value="asc">完成度从低到高</Menu.Item>
<Menu.Item key={'percent'} value="desc">完成度从高到低</Menu.Item>
<Menu.Item key={'issues_count'} value="desc">任务从多到少</Menu.Item>

View File

@ -23,6 +23,7 @@ export default ((props)=>{
const [ page , setPage ] = useState(1);
let defaultBranch = props.defaultBranch;
useEffect(()=>{
if(defaultBranch){
setBranch(defaultBranch);
@ -76,6 +77,8 @@ export default ((props)=>{
.then((result) => {
if (result) {
props.showNotification(`分支设置成功!`);
const { getDetail } = props;
getDetail && getDetail();
}
})
.catch((error) => {
@ -95,7 +98,7 @@ export default ((props)=>{
return(
<WhiteBack>
<Title>分支设置</Title>
<Title><span className="font-18">分支设置</span></Title>
<Div>
<div className="pb20" style={{borderBottom:"1px dashed #eee"}}>
<p className="color-grey-3 mb10 font-18">默认分支</p>

View File

@ -58,8 +58,9 @@ class version extends Component {
renderList = (releases) => {
const { projectsId , owner } = this.props.match.params;
const { isManager , isDeveloper , isReporter } = this.props;
console.log(isDeveloper,isManager,isReporter);
const { isManager , isDeveloper } = this.props;
const type = this.props.projectDetail && this.props.projectDetail.type;
if (releases && releases.length > 0) {
return (
releases.map((item, key) => {
@ -77,7 +78,7 @@ class version extends Component {
<span className="versionName">
<span className="task-hide">{item.name}</span>
{
(isManager || isDeveloper) &&
(isManager || isDeveloper) && type !==2 &&
<Link to={`/projects/${owner}/${projectsId}/releases/${item.version_id}/update`} className="color-blue ml3 font-12">编辑</Link>
}
</span>
@ -106,13 +107,13 @@ class version extends Component {
render() {
const { projectsId ,owner } = this.props.match.params;
const { data , releases , isSpin } = this.state;
const type = this.props.projectDetail && this.props.projectDetail.type;
return (
<div className="main" style={{padding:"0px"}}>
<div className="topWrapper" style={{padding:"15px 20px"}}>
<span className="font-18 color-grey-3">版本发布</span>
{
data && data.user_permission ?
data && data.user_permission && type !== 2 ?
<Link to={`/projects/${owner}/${projectsId}/releases/new`} className="topWrapper_btn_new">+ 发布新版</Link>
: ''
}