diff --git a/src/forge/Component/DrawerPanel.jsx b/src/forge/Component/DrawerPanel.jsx index 8070f3fa3..e9777173c 100644 --- a/src/forge/Component/DrawerPanel.jsx +++ b/src/forge/Component/DrawerPanel.jsx @@ -71,7 +71,7 @@ function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , li let dataref = event.node.props.dataRef; if(dataref.type==="file"){ onClose(); - history.push(`/projects/${owner}/${projectsId}/tree/${branch}/${dataref.path}`); + history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}/${dataref.path}`); } } diff --git a/src/forge/DevOps/Dispose/List.jsx b/src/forge/DevOps/Dispose/List.jsx index 72a267853..e9c9a6a90 100644 --- a/src/forge/DevOps/Dispose/List.jsx +++ b/src/forge/DevOps/Dispose/List.jsx @@ -66,7 +66,7 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){ ellipsis:true, render:(value,item)=>{ return( - {value} + {value} ) } }, diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index d2b63d875..842ea563b 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -50,7 +50,8 @@ function CoderDepot(props){ const owner = props.match.params.owner; const projectsId = props.match.params.projectsId; - const branchName = props.match.params.branchName; + let branchName = props.match.params.branchName; + branchName = branchName && branchName.replaceAll("%2F",'/'); const details = props.projectDetail; let pathname = props.history.location.pathname; @@ -75,8 +76,9 @@ function CoderDepot(props){ useEffect(()=>{ if (projectsId && owner && defaultBranch){ - if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) { - let url = pathname.split(`/tree/${branchName}/`)[1]; + let b = branchName && branchName.replaceAll("/","%2F"); + if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) { + let url = pathname.split(`/tree/${b}/`)[1]; setTreeValue(url); getFileInfo(url,branchName); setType("file"); @@ -92,6 +94,7 @@ function CoderDepot(props){ function getDirInfo(branch){ setIsSpin(true); const url = `/${owner}/${projectsId}/entries.json`; + axios.get(url, { params: { ref: branch } }).then((result) => { @@ -158,17 +161,20 @@ function CoderDepot(props){ // 切换分支或者标签 function changeBranch(value){ - let url = `/projects/${owner}/${projectsId}${value && `/tree/${value}`}${treeValue ? `/${treeValue}`:""}`; + let url = `/projects/${owner}/${projectsId}${value && `/tree/${value.replaceAll("/","%2F")}`}${treeValue ? `/${treeValue}`:""}`; props.history.push(url); } // 文件相关的下拉项 - const fileMenu =( + function fileMenu(){ + let b = branchName || defaultBranch; + return ( - urlLink(`/projects/${owner}/${projectsId}/${branchName || defaultBranch}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件 - urlLink(`/projects/${owner}/${projectsId}/${branchName || defaultBranch}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件 + urlLink(`/projects/${owner}/${projectsId}/${b.replaceAll("/","%2F")}/uploadfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>上传文件 + urlLink(`/projects/${owner}/${projectsId}/${b.replaceAll("/","%2F")}/newfile${treeValue === undefined ? "" : `/${treeValue}`}`)}>新建文件 - ) + ) + } function getPathUrl(array,index){ if(array && array.length>0 && index){ @@ -183,16 +189,18 @@ function CoderDepot(props){ function returnMain(){ setTreeValue(undefined); let branch = branchName || defaultBranch; - props.history.push(`/projects/${owner}/${projectsId}/tree/${branch}`); + props.history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}`); }; // 子目录路径返回链接 function returnUlr(url){ - props.history.push(`/projects/${owner}/${projectsId}/tree${branchName?`/${branchName}`:""}/${url}`); + let enBranch = branchName && branchName.replaceAll("/","%2F"); + props.history.push(`/projects/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`); } // 点击跳转到子目录 function goToSubRoot(path,type,filename){ + let enBranch = branchName || defaultBranch; setType(type); - props.history.push(`/projects/${owner}/${projectsId}${`/tree/${branchName || defaultBranch}`}${path?`/${path}`:""}`); + props.history.push(`/projects/${owner}/${projectsId}${`/tree/${enBranch.replaceAll("/","%2F")}`}${path?`/${path}`:""}`); } function onEdit(readOnly){ @@ -317,7 +325,7 @@ function CoderDepot(props){ urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务 { fileOperate && - + } diff --git a/src/forge/Main/CoderRootBranch.js b/src/forge/Main/CoderRootBranch.js index 5e9a84ca0..012429e08 100644 --- a/src/forge/Main/CoderRootBranch.js +++ b/src/forge/Main/CoderRootBranch.js @@ -32,7 +32,7 @@ export default ((props)=>{ return(
  • - {item.name} + {item.name}

    {item.last_commit && truncateCommitId(item.last_commit.sha)} {item.last_commit && item.last_commit.message} diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index abf713224..e87fd0370 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -99,33 +99,43 @@ class MergeItem extends Component { {item.pr_time} - - - {item.is_original - ? item.fork_project_user - : project_author_name} - :{item.pull_request_head} - - - - - - - - {/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */} - {project_author_name}:{item.pull_request_base} - - + { + item.pull_request_head && + + + {item.is_original + ? item.fork_project_user + : project_author_name} + :{item.pull_request_head} + + + } + { + item.pull_request_base && + + + + } + { + item.pull_request_base && + + + {/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */} + {project_author_name}:{item.pull_request_base} + + + } +

    diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 064e34444..4313ed0e7 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -337,10 +337,10 @@ class MessageCount extends Component {
    - {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head} + {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head && data.pull_request.head.replaceAll("/","%2F")} diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index 3a35467cc..f987ead6d 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -59,7 +59,7 @@ class UserSubmitComponent extends Component { const url = `/${owner}/${projectsId}/create_file.json`; axios.post(url, { filepath: filename ? filename : path, - branch: branch, + branch: branch && branch.replaceAll("%2F","/"), new_branch: submitType === "1" ? values.branchname : undefined, content, message: values.desc, @@ -72,7 +72,7 @@ class UserSubmitComponent extends Component { const { getTopCount } = this.props; getTopCount && getTopCount(values.branchname); } - let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${values.branchname}`: (branch ? `/tree/${branch}` : "")}`; + let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${values.branchname.replaceAll('/',"%2F")}`: (branch ? `/tree/${branch.replaceAll('/',"%2F")}` : "")}`; this.props.history.push(url); } }) @@ -93,12 +93,13 @@ class UserSubmitComponent extends Component { const { projectsId , owner } = this.props.match.params; const { submitType } = this.state; const url = `/${owner}/${projectsId}/update_file.json`; + let b = currentBranch || branch; this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { axios .put(url, { filepath: detail.path, - branch: submitType === "1" ? undefined : (currentBranch || branch), + branch: submitType === "1" ? undefined : b.replaceAll('%2F',"/"), new_branch: submitType === "1" ? values.branchname : undefined, content: content, sha: detail.sha, @@ -107,7 +108,8 @@ class UserSubmitComponent extends Component { .then((result) => { this.setState({ isSpin: false }); if (result.data && result.data.status === 1) { - let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${values.branchname}` : ((currentBranch || branch) ? `/tree/${currentBranch || branch}`:""))}`; + let b = currentBranch || branch; + let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${values.branchname.replaceAll('/',"%2F")}` : (b ? `/tree/${b.replaceAll('/',"%2F")}`:""))}`; this.props.history.push(url); this.props.showNotification("文件修改成功!"); } @@ -130,6 +132,7 @@ class UserSubmitComponent extends Component { const { current_user, filepath, projectDetail , currentBranch } = this.props; const { editor_type } = this.props; + let b = currentBranch || branch; return (
    @@ -188,7 +191,7 @@ class UserSubmitComponent extends Component { > - 直接提交至{currentBranch || branch}分支 + 直接提交至{b.replaceAll('%2F',"/")}分支