Merge pull request 'issue修改' (#113) from caishi/forgeplus-react:feature_repo_second_page into feature_repo_second_page

This commit is contained in:
jasder 2021-10-08 14:27:40 +08:00
commit 63dc5b5572
6 changed files with 46 additions and 17 deletions

View File

@ -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 = (
<SelectOverlay
changeBranch={changeBranch}
tagflag={tagflag}
projectsId={projectsId}
owner={owner}
branchList={branchList}
<div ref={refFa}>
<SelectOverlay
changeBranch={ChangeB}
tagflag={tagflag}
projectsId={projectsId}
owner={owner}
branchList={branchList}
/>
</div>
);
return(
<Dropdown placement='bottomLeft' overlay={menu} overlayClassName="branch-tagBox-list" trigger={['click']} >
<div className="branch-tagBox">
<Dropdown placement='bottomLeft' visible={visible} overlay={menu} overlayClassName="branch-tagBox-list" trigger={['click']} >
<div className="branch-tagBox" ref={refBox} onClick={()=>setVisible(true)}>
{/* {nav === 0 ?"分支":"标签"} */}
<span className="color-grey-9 mr3 ml8"><i className="iconfont icon-fenzhi2 font-18"></i></span>
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px",maxWidth:"270px"}}>

View File

@ -424,7 +424,7 @@ function CoderDepot(props){
<div className="addOptionBtn">
{
projectDetail.type !== 2 && pullsFlag &&
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/pulls/new`)} >+ 合并请求</CheckProfile>
<CheckProfile {...props} sureFunc={()=>urlLink(`/${owner}/${projectsId}/pulls/new/${branchName || defaultBranch}`)} >+ 合并请求</CheckProfile>
}
{
issuesFlag &&

View File

@ -121,6 +121,7 @@ export default (props) => {
data={data}
owner={owner}
projectsId={projectsId}
parentsSha={parents && parents.length > 0 && parents[0].sha}
/>
</Spin>
</div>

View File

@ -79,7 +79,7 @@ function Index(props) {
<div>
<span>
<img src={Tree} alt="sha" width={"16px"}/>
<Link to={`/${owner}/${projectsId}/commits/branch/${truncateCommitId(last_commit && last_commit.sha)}`}>{truncateCommitId(last_commit && last_commit.sha)}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(last_commit && last_commit.sha)}`}>{truncateCommitId(last_commit && last_commit.sha)}</Link>
<input type="text" id={`value${key}${k}`} value={`${truncateCommitId(last_commit && last_commit.sha)}`}/>
</span>
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${key}${k}`}/>

View File

@ -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){
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
<span className="ml10">{item.addition+item.deletion}</span>
</Tooltip>
<span className="see-file-btn" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(item.sha)}/${item.name}`)}}>查看文件</span>
<span className="see-file-btn" onClick={()=>{history.push(`/${owner}/${projectsId}${item.isDeleted ? `/commits/${truncateCommitId(parentsSha)}`:`/tree/${truncateCommitId(item.sha)}/${item.name}`}`)}}>查看文件</span>
</div>
</FlexAJ>
{

View File

@ -87,7 +87,7 @@ export default Form.create()(
}
],
<Input
addonBefore={`https://`+ port ? `${hostname}:${port}/organize`:`${hostname}/organize`}
addonBefore={`https://`+ port ? `${hostname}:${port}`:`${hostname}`}
placeholder="组织账号" maxLength={100}
/>
)}