forked from Gitlink/forgeplus-react
Merge branch 'feature_repo_second_page' of https://git.trustie.net/Gitlink/forgeplus-react into feature_repo_second_page
This commit is contained in:
commit
f989e62702
|
@ -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 &&
|
||||
|
@ -455,8 +455,8 @@ function CoderDepot(props){
|
|||
lastCommit &&
|
||||
<div className="listtablehead">
|
||||
<User url={getImageUrl(`/${lastCommitAuthor && lastCommitAuthor.image_url}`)} name={lastCommitAuthor && lastCommitAuthor.name} id={lastCommitAuthor && lastCommitAuthor.id} login={lastCommitAuthor && lastCommitAuthor.login}/>
|
||||
<div onClick={()=>props.history.push(`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`)} className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
|
||||
<pre id="ptxt">{lastCommit.message}</pre>
|
||||
<div className={hideBtn && hide ? "ellipsistxt hidetxt" :"ellipsistxt"}>
|
||||
<pre id="ptxt"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(lastCommit.sha)}`}>{lastCommit.message}</Link></pre>
|
||||
</div>
|
||||
{ hideBtn && <span className="ellipsis" onClick={()=>changeHide(hide)}><i className="iconfont icon-shenglvehao"></i></span> }
|
||||
|
||||
|
|
|
@ -25,10 +25,6 @@ function returnbar(str){
|
|||
class CoderRootCommit extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
// const params = new URLSearchParams(location && location.search);
|
||||
// const [commitPage] = [params.get('commitPage')];
|
||||
// console.log('111',commitPage);
|
||||
// commitPage && this.setState({page:commitPage});
|
||||
this.state={
|
||||
commitDatas:undefined,
|
||||
dataCount:undefined,
|
||||
|
@ -61,13 +57,28 @@ class CoderRootCommit extends Component{
|
|||
this.Init();
|
||||
}
|
||||
}
|
||||
|
||||
UrlParamHash(url){
|
||||
const params = {};
|
||||
let h;
|
||||
let hash = url.slice(url.indexOf('?')+1).split('&');
|
||||
for(let i = 0; i<hash.length;i++){
|
||||
h = hash[i].split('=');
|
||||
params[h[0]] = h[1];
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
Init =()=>{
|
||||
const { branchName } = this.props.match.params;
|
||||
const { page , limit } = this.state;
|
||||
const { limit } = this.state;
|
||||
const {search} = this.props.location;
|
||||
const realPage = (search && this.UrlParamHash(search).page) ? parseInt(this.UrlParamHash(search).page) : 1;
|
||||
this.setState({
|
||||
isSpining:true
|
||||
isSpining:true,
|
||||
page:realPage
|
||||
})
|
||||
this.getCommitList( branchName , page , limit );
|
||||
this.getCommitList( branchName , realPage , limit );
|
||||
}
|
||||
|
||||
getCommitList=(branch , page , limit)=>{
|
||||
|
@ -116,19 +127,13 @@ class CoderRootCommit extends Component{
|
|||
}
|
||||
|
||||
ChangePage=(page)=>{
|
||||
const { branchName } = this.props.match.params;
|
||||
const { limit } = this.state;
|
||||
this.setState({
|
||||
page: page
|
||||
})
|
||||
this.getCommitList(branchName , page , limit);
|
||||
this.props.history.push({pathname: this.props.history.location.pathname,search: `page=${page}`})
|
||||
}
|
||||
|
||||
render(){
|
||||
const { commitDatas , dataCount , limit , page , isSpining , branchList } = this.state;
|
||||
const { projectDetail, commit_class , defaultBranch } = this.props;
|
||||
const { projectsId , owner , branchName } = this.props.match.params;
|
||||
console.log(branchName);
|
||||
let branch = returnbar(branchName || defaultBranch);
|
||||
return(
|
||||
<React.Fragment>
|
||||
|
@ -153,7 +158,7 @@ class CoderRootCommit extends Component{
|
|||
<div className="commitList-item f-wrap-between">
|
||||
<div>
|
||||
<AlignTop>
|
||||
<div className="commitDesc"><Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`,query:{commitPage:page}}} className="font-14 color-grey-3 font-bd">{item.message}</Link></div>
|
||||
<div className="commitDesc"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="font-14 color-grey-3 font-bd">{item.message}</Link></div>
|
||||
</AlignTop>
|
||||
<p className="f-wrap-alignCenter mt15 pb5">
|
||||
<User
|
||||
|
@ -170,7 +175,7 @@ class CoderRootCommit extends Component{
|
|||
<div>
|
||||
<span className="treecopy-cont shadow">
|
||||
<img src={Tree} alt="sha" width={"16px"}/>
|
||||
<Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`,query:{page:page}}}>{truncateCommitId(`${item.sha}`)}</Link>
|
||||
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(`${item.sha}`)}</Link>
|
||||
<input type="text" id={`value${k}`} value={`${truncateCommitId(`${item.sha}`)}`}/>
|
||||
</span>
|
||||
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${k}`}/>
|
||||
|
@ -188,7 +193,7 @@ class CoderRootCommit extends Component{
|
|||
{
|
||||
dataCount > limit ?
|
||||
<div className="edu-txt-center pt30 mb30">
|
||||
<Pagination simple defaultCurrent={page} total={dataCount} pageSize={limit} onChange={this.ChangePage}></Pagination>
|
||||
<Pagination simple current={page} total={dataCount} pageSize={limit} onChange={this.ChangePage}></Pagination>
|
||||
</div>
|
||||
:""
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ export default (props) => {
|
|||
<ul className="df">
|
||||
<User
|
||||
id = {committer && committer.id}
|
||||
url={(committer && getImageUrl(`/${committer.image_url}`))|| "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}
|
||||
url={(committer && getImageUrl(`/${committer.image_url}`))}
|
||||
name={committer && committer.name}
|
||||
login={committer && committer.login}
|
||||
/>
|
||||
|
@ -121,6 +121,7 @@ export default (props) => {
|
|||
data={data}
|
||||
owner={owner}
|
||||
projectsId={projectsId}
|
||||
parentsSha={parents && parents.length > 0 && parents[0].sha}
|
||||
/>
|
||||
</Spin>
|
||||
</div>
|
||||
|
|
|
@ -253,7 +253,7 @@
|
|||
background-color: #FAFCFF;
|
||||
.ellipsistxt{
|
||||
margin-top: 6px;
|
||||
cursor: pointer;
|
||||
// cursor: pointer;
|
||||
#ptxt{
|
||||
margin-bottom: 0px;
|
||||
word-break: break-all;
|
||||
|
|
|
@ -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}`}/>
|
||||
|
|
|
@ -247,7 +247,7 @@ export default Form.create()(
|
|||
<div className="infosTip">
|
||||
<p className="font-16 mb14 weight">语义化版本</p>
|
||||
<p>
|
||||
如果你是第一次发布版本,我们强烈建议你阅读<a className="color-blue">语义化版本</a>。
|
||||
如果你是第一次发布版本,我们强烈建议你阅读<a href='https://semver.org/lang/zh-CN' className="color-blue">语义化版本</a>。
|
||||
</p>
|
||||
</div>
|
||||
<div className="infosTip">
|
||||
|
|
|
@ -5,27 +5,11 @@ 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);
|
||||
const commitPage = history && history.location && history.location.query && history.location.query.commitPage;
|
||||
// console.log('222',commitPage);
|
||||
// const nextHref = useRef(null);
|
||||
|
||||
// useEffect(()=>{
|
||||
// const unlisten = history.listen((location)=>{
|
||||
// if(nextHref.current !== location.pathname){
|
||||
// nextHref.current = location.pathname;
|
||||
// history.replace({pathname:location.pathname,search:`commitPage=${commitPage}`});
|
||||
// // history.replace({pathname:location.pathname, query:{page:commitPage}});
|
||||
// } else{
|
||||
// unlisten;
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
if(data){
|
||||
setFiles(data.files);
|
||||
|
@ -64,7 +48,7 @@ function Files(props){
|
|||
<span className="cursor-pointer" data-clipboard-text={item.name}>{item.name}</span>
|
||||
</AlignCenter>
|
||||
<div className="see-file">
|
||||
<Tooltip placement="top" title={`${item.addition+item.deletion}处更改:${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}>
|
||||
<Tooltip placement="top" title={`${item.addition+item.deletion}处更改${item.addition + item.deletion > 0 && ":"}${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}>
|
||||
<Progress showInfo = {false} strokeColor = "#2DB44D" size="small" percent={item.addition/(item.addition+item.deletion)*100} />
|
||||
{item.addition >0 && <span className="color-green ml10">+{item.addition}</span>}
|
||||
{item.deletion >0 && <span className="color-red ml10">-{item.deletion}</span>}
|
||||
|
@ -112,11 +96,11 @@ function Files(props){
|
|||
</Tooltip>
|
||||
</AlignCenter>
|
||||
<div className="see-file">
|
||||
<Tooltip placement="top" title={`${item.addition+item.deletion}处更改:${item.addition>0?item.addition+"处添加":""}${item.addition>0 && item.deletion>0 ?"和":""}${item.deletion>0?item.deletion+"处删除":""}`}>
|
||||
<Tooltip placement="top" title={`${item.addition + item.deletion}处更改${item.addition + item.deletion > 0 && ":"} ${item.addition > 0 ? item.addition + "处添加" : ""}${item.addition > 0 && item.deletion > 0 ? "和" : ""}${item.deletion > 0 ? item.deletion + "处删除" : ""}`}>
|
||||
<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