From bb2691767befc6614041d8fa1eab1763090835d7 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Fri, 3 Jan 2020 19:03:09 +0800
Subject: [PATCH] build
---
public/react/src/forge/Branch/SelectBranch.js | 31 ++++++++++
.../src/forge/Main/CoderRootDirectory.js | 61 +++++++++----------
public/react/src/forge/Main/Detail.js | 11 ++--
public/react/src/forge/New/Index.js | 1 +
4 files changed, 68 insertions(+), 36 deletions(-)
create mode 100644 public/react/src/forge/Branch/SelectBranch.js
diff --git a/public/react/src/forge/Branch/SelectBranch.js b/public/react/src/forge/Branch/SelectBranch.js
new file mode 100644
index 000000000..ca5ee9413
--- /dev/null
+++ b/public/react/src/forge/Branch/SelectBranch.js
@@ -0,0 +1,31 @@
+import React , { Component } from 'react';
+import { Dropdown , Icon , Menu } from 'antd';
+
+class SelectBranch extends Component{
+
+ render(){
+ const { branchs , branch , changeBranch } = this.props;
+ const menu = (
+
+ );
+ return(
+
+ )
+ }
+}
+export default SelectBranch;
\ No newline at end of file
diff --git a/public/react/src/forge/Main/CoderRootDirectory.js b/public/react/src/forge/Main/CoderRootDirectory.js
index 2b83644e9..038f841a8 100644
--- a/public/react/src/forge/Main/CoderRootDirectory.js
+++ b/public/react/src/forge/Main/CoderRootDirectory.js
@@ -5,6 +5,8 @@ import {Link} from 'react-router-dom';
import { getImageUrl } from 'educoder';
import axios from 'axios';
+import SelectBranch from '../Branch/SelectBranch'
+
// 点击按钮复制功能
function jsCopy(){
var e = document.getElementById("copy_rep_content");
@@ -16,7 +18,8 @@ class CoderRootDirectory extends Component{
super(props);
this.state={
address:"http",
- ref:"master",
+ branch:"master",
+ http_url:undefined,
rootList:undefined,
branchList:undefined,
@@ -54,21 +57,22 @@ class CoderRootDirectory extends Component{
this.setState({
branchList:result.data,
branchs,
- branchLastCommit:result.data[0]
+ branchLastCommit:result.data[0],
+ http_url:result.data[0].http_url
})
}
}).catch((error)=>{})
}
// 获取分支文件
- getProjectRoot=(ref)=>{
+ getProjectRoot=(branch)=>{
const { login } = this.props.current_user;
const { projectsId } = this.props.match.params;
const url = `/${login}/${projectsId}/entries.json`;
axios.get((url),{
params:{
- ref
+ branch
}
}).then((result)=>{
if(result && result.data && result.data.length > 0){
@@ -96,8 +100,9 @@ class CoderRootDirectory extends Component{
let branchLastCommit = branchList[parseInt(value.key)];
this.setState({
- ref:branchLastCommit.name,
- branchLastCommit
+ branch:branchLastCommit.name,
+ branchLastCommit,
+ http_url:branchLastCommit.http_url
})
}
@@ -114,18 +119,8 @@ class CoderRootDirectory extends Component{
}
];
- const { address , ref , rootList , branchList , branchs, branchLastCommit } = this.state;
- const menu = (
-
- );
+ const { branch , rootList , branchs, branchLastCommit , http_url } = this.state;
+
const title = () =>{
if(branchLastCommit && branchLastCommit.last_commit){
@@ -134,7 +129,7 @@ class CoderRootDirectory extends Component{
{
branchLastCommit.author ?
-
+
{branchLastCommit.author.login}
:""
@@ -148,6 +143,17 @@ class CoderRootDirectory extends Component{
return undefined;
}
}
+
+ const downloadUrl = ()=>{
+ if(branchLastCommit && branchLastCommit.zip_url){
+ return(
+
+ )
+ }
+ }
return(
@@ -156,21 +162,14 @@ class CoderRootDirectory extends Component{
-
+
-
this.changeAddress("http")}>HTTP
-
this.changeAddress("ssh")}>SSH
-
+
this.changeAddress("http")}>HTTP
+ {/*
this.changeAddress("ssh")}>SSH */}
+
jsCopy()}>
-
+
diff --git a/public/react/src/forge/Main/Detail.js b/public/react/src/forge/Main/Detail.js
index c533a48bc..d22f1fe67 100644
--- a/public/react/src/forge/Main/Detail.js
+++ b/public/react/src/forge/Main/Detail.js
@@ -24,6 +24,7 @@ class Detail extends Component{
}
render(){
const { currentKey } = this.state;
+ const { projectsId } = this.props.match.params;
return(
@@ -38,11 +39,11 @@ class Detail extends Component{
- - 代码
- - 工单
- - 合并请求
- - 版本发布
- - 动态
+ - 代码
+ - 工单
+ - 合并请求
+ - 版本发布
+ - 动态
diff --git a/public/react/src/forge/New/Index.js b/public/react/src/forge/New/Index.js
index b07805e56..e83e07435 100644
--- a/public/react/src/forge/New/Index.js
+++ b/public/react/src/forge/New/Index.js
@@ -107,6 +107,7 @@ class Index extends Component{
if(result){
if(result.data.id){
this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`);
+ this.history.push('/projects');
}
}
}).catch((error)=>{