Merge branch 'feature_repo_second_page' of https://git.trustie.net/Gitlink/forgeplus-react into feature_repo_second_page_xiesi
This commit is contained in:
commit
0ad1af9f51
|
@ -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"}}>
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -121,6 +121,7 @@ export default (props) => {
|
|||
data={data}
|
||||
owner={owner}
|
||||
projectsId={projectsId}
|
||||
parentsSha={parents && parents.length > 0 && parents[0].sha}
|
||||
/>
|
||||
</Spin>
|
||||
</div>
|
||||
|
|
|
@ -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}`}/>
|
||||
|
|
|
@ -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);
|
||||
|
@ -101,7 +100,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>
|
||||
{
|
||||
|
|
|
@ -94,7 +94,6 @@ class m_editor extends Component {
|
|||
<div>
|
||||
<div className="">
|
||||
<Editor
|
||||
height={"400px"}
|
||||
language={language ? language : "plaintext"}
|
||||
theme={"vs-grey"}
|
||||
placeholder="请输入内容"
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue