From 7b4e7d35422b4ff6dde31feef383f6670d0253be Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 8 Oct 2021 10:11:35 +0800 Subject: [PATCH 1/2] issue --- src/forge/Main/CoderDepot.jsx | 2 +- src/forge/Main/tag/Index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 9bf831933..c3a2599a9 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -424,7 +424,7 @@ function CoderDepot(props){
{ projectDetail.type !== 2 && pullsFlag && - urlLink(`/${owner}/${projectsId}/pulls/new`)} >+ 合并请求 + urlLink(`/${owner}/${projectsId}/pulls/new/${branchName || defaultBranch}`)} >+ 合并请求 } { issuesFlag && diff --git a/src/forge/Main/tag/Index.jsx b/src/forge/Main/tag/Index.jsx index 5e296e131..c4a2b4200 100644 --- a/src/forge/Main/tag/Index.jsx +++ b/src/forge/Main/tag/Index.jsx @@ -59,7 +59,7 @@ function Tags(props) { return ( 提交ID - {truncateCommitId(item.id)} + {truncateCommitId(item.id)} ) } From b22649527762885d3ca4cb0f87e08e758bfb543f Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 8 Oct 2021 14:14:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?issue=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Branch/Select.jsx | 51 +++++++++++++++++++++++++++-------- src/forge/Main/Diff.jsx | 1 + src/forge/Main/tag/Index.jsx | 2 +- src/forge/Main/tree/Index.jsx | 2 +- src/forge/Merge/Files.jsx | 5 ++-- src/forge/Team/New.jsx | 2 +- 6 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/forge/Branch/Select.jsx b/src/forge/Branch/Select.jsx index 4937686d1..8083082da 100644 --- a/src/forge/Branch/Select.jsx +++ b/src/forge/Branch/Select.jsx @@ -1,28 +1,57 @@ -import React , { useState , useEffect } from 'react'; -import { Popover , Dropdown , Input , Spin } from 'antd'; +import React , { useState , useEffect , useRef } from 'react'; +import { Dropdown} from 'antd'; import './branch.scss'; -import { getBranch , getTag } from '../GetData/getData'; import SelectOverlay from './SelectOverlay'; +import { findDOMNode } from 'react-dom'; export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{ const [ showValue , setShowValue ] = useState(branch); + const [ visible , setVisible ] = useState(false); + + const refFa = useRef(null); + const refBox = useRef(null); + + useEffect(() => { + document.addEventListener('click', clickMe , false); + }, []) + + const clickMe = ({ target }) => { + // 查找父组件 + const faComponent = findDOMNode(refFa.current); + const boxComponent = findDOMNode(refBox.current); + + if (faComponent && boxComponent) { + const isChild = faComponent.contains(target); + const isBox = boxComponent.contains(target); + if(!isChild && !isBox){ + setVisible(false); + } + } + } useEffect(()=>{ setShowValue(branch); },[branch]) + function ChangeB(params) { + setVisible(false); + changeBranch(params); + } + const menu = ( - + +
); return( - -
+ +
setVisible(true)}> {/* {nav === 0 ?"分支":"标签"} */} diff --git a/src/forge/Main/Diff.jsx b/src/forge/Main/Diff.jsx index fe9c130fe..457426eaa 100644 --- a/src/forge/Main/Diff.jsx +++ b/src/forge/Main/Diff.jsx @@ -121,6 +121,7 @@ export default (props) => { data={data} owner={owner} projectsId={projectsId} + parentsSha={parents && parents.length > 0 && parents[0].sha} />
diff --git a/src/forge/Main/tag/Index.jsx b/src/forge/Main/tag/Index.jsx index c4a2b4200..5e296e131 100644 --- a/src/forge/Main/tag/Index.jsx +++ b/src/forge/Main/tag/Index.jsx @@ -59,7 +59,7 @@ function Tags(props) { return ( 提交ID - {truncateCommitId(item.id)} + {truncateCommitId(item.id)} ) } diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index d38b48bb2..5d3480189 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -79,7 +79,7 @@ function Index(props) {
sha - {truncateCommitId(last_commit && last_commit.sha)} + {truncateCommitId(last_commit && last_commit.sha)} diff --git a/src/forge/Merge/Files.jsx b/src/forge/Merge/Files.jsx index fef63198b..2e5cd7cce 100644 --- a/src/forge/Merge/Files.jsx +++ b/src/forge/Merge/Files.jsx @@ -5,8 +5,7 @@ import { Button, Tooltip,Progress, Popover, Anchor } from 'antd'; import './merge.css'; import './Index.scss'; -function Files(props){ - const { data,history,owner,projectsId } = props; +function Files({ data,history,owner,projectsId , parentsSha }){ const [ files , setFiles ] = useState(data && data.files); const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径"); const [ isOpen, setIsOpen] = useState(false); @@ -116,7 +115,7 @@ function Files(props){ {item.addition+item.deletion}处 - {history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(item.sha)}/${item.name}`)}}>查看文件 + {history.push(`/${owner}/${projectsId}${item.isDeleted ? `/commits/${truncateCommitId(parentsSha)}`:`/tree/${truncateCommitId(item.sha)}/${item.name}`}`)}}>查看文件
{ diff --git a/src/forge/Team/New.jsx b/src/forge/Team/New.jsx index 414a8d158..a6f567ebc 100644 --- a/src/forge/Team/New.jsx +++ b/src/forge/Team/New.jsx @@ -87,7 +87,7 @@ export default Form.create()( } ], )}