From 2d312b6176dac1330e34bf8af2c8459f19d0aa74 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 25 Jun 2021 14:10:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=EF=BC=9Atree=E5=90=8E?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=8F=82=E6=95=B0branch=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=90=AB=E6=9C=89/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/DrawerPanel.jsx | 2 +- src/forge/DevOps/Dispose/List.jsx | 2 +- src/forge/Main/CoderDepot.jsx | 32 +++++++----- src/forge/Main/CoderRootBranch.js | 2 +- src/forge/Merge/MergeItem.js | 64 ++++++++++++++---------- src/forge/Merge/MessageCount.js | 4 +- src/forge/Newfile/UserSubmitComponent.js | 13 +++-- 7 files changed, 70 insertions(+), 49 deletions(-) diff --git a/src/forge/Component/DrawerPanel.jsx b/src/forge/Component/DrawerPanel.jsx index 8070f3fa..e9777173 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 72a26785..e9c9a6a9 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 d2b63d87..842ea563 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 (
- ) + ) + } 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 && -
{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 abf71322..e87fd037 100644
--- a/src/forge/Merge/MergeItem.js
+++ b/src/forge/Merge/MergeItem.js
@@ -99,33 +99,43 @@ class MergeItem extends Component {
{item.pr_time}
-