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 React , { useState , useEffect , useRef } from 'react';
|
||||||
import { Popover , Dropdown , Input , Spin } from 'antd';
|
import { Dropdown} from 'antd';
|
||||||
import './branch.scss';
|
import './branch.scss';
|
||||||
import { getBranch , getTag } from '../GetData/getData';
|
|
||||||
import SelectOverlay from './SelectOverlay';
|
import SelectOverlay from './SelectOverlay';
|
||||||
|
import { findDOMNode } from 'react-dom';
|
||||||
|
|
||||||
export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{
|
export default (({ projectsId , branch , owner , changeBranch , branchList , tagflag = true })=>{
|
||||||
const [ showValue , setShowValue ] = useState(branch);
|
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(()=>{
|
useEffect(()=>{
|
||||||
setShowValue(branch);
|
setShowValue(branch);
|
||||||
},[branch])
|
},[branch])
|
||||||
|
|
||||||
|
function ChangeB(params) {
|
||||||
|
setVisible(false);
|
||||||
|
changeBranch(params);
|
||||||
|
}
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
<SelectOverlay
|
<div ref={refFa}>
|
||||||
changeBranch={changeBranch}
|
<SelectOverlay
|
||||||
tagflag={tagflag}
|
changeBranch={ChangeB}
|
||||||
projectsId={projectsId}
|
tagflag={tagflag}
|
||||||
owner={owner}
|
projectsId={projectsId}
|
||||||
branchList={branchList}
|
owner={owner}
|
||||||
|
branchList={branchList}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
return(
|
return(
|
||||||
<Dropdown placement='bottomLeft' overlay={menu} overlayClassName="branch-tagBox-list" trigger={['click']} >
|
<Dropdown placement='bottomLeft' visible={visible} overlay={menu} overlayClassName="branch-tagBox-list" trigger={['click']} >
|
||||||
<div className="branch-tagBox">
|
<div className="branch-tagBox" ref={refBox} onClick={()=>setVisible(true)}>
|
||||||
{/* {nav === 0 ?"分支":"标签"} */}
|
{/* {nav === 0 ?"分支":"标签"} */}
|
||||||
<span className="color-grey-9 mr3 ml8"><i className="iconfont icon-fenzhi2 font-18"></i></span>
|
<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"}}>
|
<span className="ant-dropdown-link task-hide" style={{fontWeight:"500",minWidth:"45px",maxWidth:"270px"}}>
|
||||||
|
|
|
@ -424,7 +424,7 @@ function CoderDepot(props){
|
||||||
<div className="addOptionBtn">
|
<div className="addOptionBtn">
|
||||||
{
|
{
|
||||||
projectDetail.type !== 2 && pullsFlag &&
|
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 &&
|
issuesFlag &&
|
||||||
|
|
|
@ -121,6 +121,7 @@ export default (props) => {
|
||||||
data={data}
|
data={data}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
projectsId={projectsId}
|
projectsId={projectsId}
|
||||||
|
parentsSha={parents && parents.length > 0 && parents[0].sha}
|
||||||
/>
|
/>
|
||||||
</Spin>
|
</Spin>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -79,7 +79,7 @@ function Index(props) {
|
||||||
<div>
|
<div>
|
||||||
<span>
|
<span>
|
||||||
<img src={Tree} alt="sha" width={"16px"}/>
|
<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)}`}/>
|
<input type="text" id={`value${key}${k}`} value={`${truncateCommitId(last_commit && last_commit.sha)}`}/>
|
||||||
</span>
|
</span>
|
||||||
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${key}${k}`}/>
|
<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 './merge.css';
|
||||||
import './Index.scss';
|
import './Index.scss';
|
||||||
|
|
||||||
function Files(props){
|
function Files({ data,history,owner,projectsId , parentsSha }){
|
||||||
const { data,history,owner,projectsId } = props;
|
|
||||||
const [ files , setFiles ] = useState(data && data.files);
|
const [ files , setFiles ] = useState(data && data.files);
|
||||||
const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径");
|
const [ copyfileTipTitle, setCopyfileTipTitle] = useState("复制文件路径");
|
||||||
const [ isOpen, setIsOpen] = useState(false);
|
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} />
|
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
|
||||||
<span className="ml10">{item.addition+item.deletion}处</span>
|
<span className="ml10">{item.addition+item.deletion}处</span>
|
||||||
</Tooltip>
|
</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>
|
</div>
|
||||||
</FlexAJ>
|
</FlexAJ>
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,6 @@ class m_editor extends Component {
|
||||||
<div>
|
<div>
|
||||||
<div className="">
|
<div className="">
|
||||||
<Editor
|
<Editor
|
||||||
height={"400px"}
|
|
||||||
language={language ? language : "plaintext"}
|
language={language ? language : "plaintext"}
|
||||||
theme={"vs-grey"}
|
theme={"vs-grey"}
|
||||||
placeholder="请输入内容"
|
placeholder="请输入内容"
|
||||||
|
|
|
@ -87,7 +87,7 @@ export default Form.create()(
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
<Input
|
<Input
|
||||||
addonBefore={`https://`+ port ? `${hostname}:${port}/organize`:`${hostname}/organize`}
|
addonBefore={`https://`+ port ? `${hostname}:${port}`:`${hostname}`}
|
||||||
placeholder="组织账号" maxLength={100}
|
placeholder="组织账号" maxLength={100}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue