|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
import React , { Component } from 'react';
|
|
|
|
|
import { Dropdown , Icon , Menu , Table } from 'antd';
|
|
|
|
|
import {Link} from 'react-router-dom';
|
|
|
|
|
|
|
|
|
|
import { getImageUrl } from 'educoder';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
// 点击按钮复制功能
|
|
|
|
@ -16,7 +18,10 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
address:"http",
|
|
|
|
|
ref:"master",
|
|
|
|
|
|
|
|
|
|
rootList:undefined
|
|
|
|
|
rootList:undefined,
|
|
|
|
|
branchList:undefined,
|
|
|
|
|
branchs:undefined,
|
|
|
|
|
branchLastCommit:undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -37,8 +42,20 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
|
|
|
|
|
const url =`/projects/${projectsId}/branches.json`;
|
|
|
|
|
axios.get(url).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
|
|
|
|
|
if(result && result.data.length>0){
|
|
|
|
|
const branchs = [];
|
|
|
|
|
result.data.map((item,key)=>{
|
|
|
|
|
branchs.push({
|
|
|
|
|
index:key,
|
|
|
|
|
name:item.name
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
branchList:result.data,
|
|
|
|
|
branchs,
|
|
|
|
|
branchLastCommit:result.data[0]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
}
|
|
|
|
@ -73,17 +90,19 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 选择分支
|
|
|
|
|
changeBranch=(value)=>{
|
|
|
|
|
const { branchList } = this.state;
|
|
|
|
|
let branchLastCommit = branchList[parseInt(value.key)];
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
ref:branchLastCommit.name,
|
|
|
|
|
branchLastCommit
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
const menu = (
|
|
|
|
|
<Menu>
|
|
|
|
|
<Menu.Item key="0">
|
|
|
|
|
<a href="http://www.alipay.com/">1st menu item</a>
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
<Menu.Item key="1">
|
|
|
|
|
<a href="http://www.taobao.com/">2nd menu item</a>
|
|
|
|
|
</Menu.Item>
|
|
|
|
|
</Menu>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
@ -95,19 +114,40 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const { address , ref , rootList , branchList , branchs, branchLastCommit } = this.state;
|
|
|
|
|
const menu = (
|
|
|
|
|
<Menu>
|
|
|
|
|
{
|
|
|
|
|
branchs && branchs.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Menu.Item key={item.index} onClick={this.changeBranch}>{item.name}</Menu.Item>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Menu>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const title = () =>{
|
|
|
|
|
return(
|
|
|
|
|
<div className="f-wrap-alignCenter">
|
|
|
|
|
<img src={``} alt=""/>
|
|
|
|
|
<span>蔡蔡</span>
|
|
|
|
|
<Link to={``} className="commitKey">asljfowfjoer</Link>
|
|
|
|
|
<span className="color-blue flex-1 hide-1">first commit</span>
|
|
|
|
|
<span>3小时前</span>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
if(branchLastCommit && branchLastCommit.last_commit){
|
|
|
|
|
return(
|
|
|
|
|
<div className="f-wrap-alignCenter">
|
|
|
|
|
{
|
|
|
|
|
branchLastCommit.author ?
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<img src={getImageUrl(`/images${branchLastCommit.author.image_url}`)} alt=""/>
|
|
|
|
|
<span className="mr15">{branchLastCommit.author.login}</span>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
:""
|
|
|
|
|
}
|
|
|
|
|
<Link to={``} className="commitKey">{branchLastCommit.last_commit.id}</Link>
|
|
|
|
|
<span className="color-blue flex-1 hide-1">{branchLastCommit.last_commit.message}</span>
|
|
|
|
|
<span>{branchLastCommit.last_commit.time_from_now}</span>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}else{
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { address , ref , rootList } = this.state;
|
|
|
|
|
return(
|
|
|
|
|
<div className="main">
|
|
|
|
|
<p className="branch-wrapper">
|
|
|
|
@ -128,7 +168,7 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
<span className={address ==="http" ? "addressType active":"addressType"} onClick={()=>this.changeAddress("http")}>HTTP</span>
|
|
|
|
|
<span className={address ==="ssh" ? "addressType active":"addressType"} onClick={()=>this.changeAddress("ssh")}>SSH</span>
|
|
|
|
|
<input type="text" id="copy_rep_content" value={"git@testgitea.trustie.net:sylor/test11.git"}/>
|
|
|
|
|
<span><i className="iconfont icon-fuzhi"></i></span>
|
|
|
|
|
<span onClick={()=>jsCopy()}><i className="iconfont icon-fuzhi"></i></span>
|
|
|
|
|
<span>
|
|
|
|
|
<Dropdown overlay={menu} trigger={['click']} placement="bottomRight">
|
|
|
|
|
<a className="ant-dropdown-link">
|
|
|
|
|