2020-03-16 14:12:11 +08:00
|
|
|
|
import React , { Component } from 'react';
|
|
|
|
|
|
import {Menu, Spin} from 'antd';
|
2020-05-22 15:20:36 +08:00
|
|
|
|
import { getImageUrl } from 'educoder';
|
2020-04-29 10:42:53 +08:00
|
|
|
|
import { Link } from 'react-router-dom';
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
|
|
|
|
|
import './list.css';
|
|
|
|
|
|
import SelectBranch from '../Branch/SelectBranch';
|
|
|
|
|
|
import CloneAddress from '../Branch/CloneAddress';
|
|
|
|
|
|
import RootTable from './RootTable';
|
|
|
|
|
|
import CoderRootFileDetail from './CoderRootFileDetail';
|
2020-03-30 10:21:22 +08:00
|
|
|
|
import { truncateCommitId } from '../common/util';
|
2020-04-29 10:42:53 +08:00
|
|
|
|
import RenderHtml from '../../components/render-html';
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
/**
|
|
|
|
|
|
* address:http和SSH,http_url(对应git地址)
|
|
|
|
|
|
* branch:当前分支
|
|
|
|
|
|
* filePath:点击目录时当前目录的路径
|
|
|
|
|
|
* subfileType:保存当前点击目录的文件类型(显示目录列表时才显示新建文件,如果点击的是文件就不显示新建文件按钮)
|
|
|
|
|
|
* readMeContent:根目录下面的readme文件内容
|
|
|
|
|
|
*/
|
2020-04-20 15:37:01 +08:00
|
|
|
|
|
2020-03-16 14:12:11 +08:00
|
|
|
|
class CoderRootDirectory extends Component{
|
|
|
|
|
|
constructor(props){
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
this.state={
|
|
|
|
|
|
address:"http",
|
|
|
|
|
|
branch:"master",
|
2020-04-17 17:35:47 +08:00
|
|
|
|
filePath:undefined,
|
2020-04-24 09:15:52 +08:00
|
|
|
|
subFileType:undefined,
|
2020-03-16 14:12:11 +08:00
|
|
|
|
readMeContent:undefined,
|
2020-04-13 17:45:36 +08:00
|
|
|
|
readMeFile: undefined,
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
|
|
|
|
|
isSpin:true,
|
|
|
|
|
|
|
|
|
|
|
|
branchList:undefined,
|
|
|
|
|
|
fileDetail:undefined,
|
|
|
|
|
|
branchLastCommit:undefined,
|
2020-06-03 14:42:13 +08:00
|
|
|
|
lastCommitAuthor:undefined,
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
2020-04-17 17:35:47 +08:00
|
|
|
|
rootList:undefined,
|
2020-06-03 14:42:13 +08:00
|
|
|
|
readOnly: true,
|
|
|
|
|
|
zip_url:undefined,
|
|
|
|
|
|
tar_url:undefined
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
changeAddress=(address)=>{
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
address
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-17 17:35:47 +08:00
|
|
|
|
|
2020-03-16 14:12:11 +08:00
|
|
|
|
componentDidMount=()=>{
|
2020-04-17 17:35:47 +08:00
|
|
|
|
this.Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate=(prevState)=>{
|
|
|
|
|
|
const {location} = this.props;
|
|
|
|
|
|
const prevlocation = prevState && prevState.location;
|
|
|
|
|
|
if(location !== prevlocation){
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
isSpin:true
|
|
|
|
|
|
})
|
|
|
|
|
|
this.Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-30 18:51:30 +08:00
|
|
|
|
|
2020-04-17 17:35:47 +08:00
|
|
|
|
Init=()=>{
|
2020-03-16 14:12:11 +08:00
|
|
|
|
let { search } = this.props.history.location;
|
|
|
|
|
|
let branchName = undefined;
|
2020-04-24 09:15:52 +08:00
|
|
|
|
if(search && search.indexOf("?branch=")>-1){
|
|
|
|
|
|
branchName = search.split("?branch=")[1];
|
2020-03-16 14:12:11 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
|
branch:branchName
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2020-04-24 09:15:52 +08:00
|
|
|
|
if(search && search.indexOf("?url=")>-1){
|
|
|
|
|
|
let url =search.split("?url=")[1];
|
2020-04-17 17:35:47 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
|
filePath:url
|
|
|
|
|
|
})
|
|
|
|
|
|
this.getFileDetail(url);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
const { branch } = this.state;
|
|
|
|
|
|
this.getProjectRoot( branchName || branch);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 页面地址返回到主目录
|
|
|
|
|
|
returnMain=(branch)=>{
|
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
this.props.history.push(`/projects/${projectsId}/coders`);
|
|
|
|
|
|
this.getProjectRoot(branch);
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取根目录
|
|
|
|
|
|
getProjectRoot=(branch)=>{
|
2020-03-20 20:50:30 +08:00
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
const url = `/repositories/${projectsId}/entries.json`;
|
2020-03-16 14:12:11 +08:00
|
|
|
|
axios.get((url),{
|
|
|
|
|
|
params:{
|
|
|
|
|
|
branch
|
|
|
|
|
|
}
|
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
|
if(result){
|
2020-06-03 14:42:13 +08:00
|
|
|
|
let last_commit = result.data && result.data.last_commit;
|
|
|
|
|
|
let entries = result.data && result.data.entries;
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
filePath:undefined,
|
|
|
|
|
|
fileDetail:undefined,
|
|
|
|
|
|
isSpin: false,
|
|
|
|
|
|
branchLastCommit:last_commit && last_commit.commit,
|
|
|
|
|
|
lastCommitAuthor:last_commit && (last_commit.author || (last_commit.commit && last_commit.commit.author)),
|
|
|
|
|
|
zip_url:result.data.zip_url,
|
|
|
|
|
|
tar_url:result.data.tar_url
|
|
|
|
|
|
})
|
|
|
|
|
|
if(entries && entries.length > 0){
|
|
|
|
|
|
this.renderData(entries);
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.setState({
|
2020-06-03 14:42:13 +08:00
|
|
|
|
rootList:entries,
|
2020-04-24 09:15:52 +08:00
|
|
|
|
subFileType:true
|
2020-03-16 14:12:11 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-13 17:45:36 +08:00
|
|
|
|
ChangeFile=(arr,readOnly)=>{
|
2020-04-17 17:35:47 +08:00
|
|
|
|
const { projectsId } = this.props.match.params;
|
2020-03-30 18:51:30 +08:00
|
|
|
|
//点击直接跳转页面 加载一次路由
|
2020-04-24 09:15:52 +08:00
|
|
|
|
this.props.history.push(`/projects/${projectsId}/coders?url=${arr.path}`);
|
2020-03-16 14:12:11 +08:00
|
|
|
|
this.setState({
|
2020-04-13 17:45:36 +08:00
|
|
|
|
readOnly: readOnly
|
2020-03-16 14:12:11 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderUrl=(name,path,type)=>{
|
|
|
|
|
|
let list =[];
|
|
|
|
|
|
const { filePath } = this.state;
|
|
|
|
|
|
if(path.indexOf("/")){
|
|
|
|
|
|
const array = path.split("/");
|
|
|
|
|
|
let str = "";
|
|
|
|
|
|
array.map((i,k)=>{
|
|
|
|
|
|
str += '/'+i;
|
|
|
|
|
|
return list.push({
|
2020-05-09 16:08:30 +08:00
|
|
|
|
key:k,
|
2020-03-16 14:12:11 +08:00
|
|
|
|
index:k,
|
|
|
|
|
|
name:i,
|
|
|
|
|
|
path:str.substr(1),
|
|
|
|
|
|
type:(filePath && filePath.length>0) ? (filePath[k] ? filePath[k].type : type) : type
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2020-04-17 17:35:47 +08:00
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
//点击直接跳转页面 加载一次路由
|
2020-04-24 09:15:52 +08:00
|
|
|
|
this.props.history.push(`/projects/${projectsId}/coders?url=${str.substr(1)}`);
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}else{
|
|
|
|
|
|
list.push({
|
|
|
|
|
|
index:0,
|
|
|
|
|
|
name,path,type
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
filePath:list
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取子目录
|
2020-04-23 14:11:43 +08:00
|
|
|
|
getFileDetail=(path,ref)=>{
|
2020-03-16 14:12:11 +08:00
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
const { branch } = this.state;
|
2020-03-20 20:50:30 +08:00
|
|
|
|
const url =`/repositories/${projectsId}/sub_entries.json`;
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
|
|
|
|
|
axios.get(url,{
|
|
|
|
|
|
params:{
|
2020-04-17 17:35:47 +08:00
|
|
|
|
filepath:path,
|
2020-04-23 14:11:43 +08:00
|
|
|
|
ref:ref || branch
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}).then((result)=>{
|
2020-06-03 14:42:13 +08:00
|
|
|
|
let entries = result.data && result.data.entries
|
|
|
|
|
|
if(entries && entries.length > 0){
|
2020-04-17 17:35:47 +08:00
|
|
|
|
// 当前返回的子目录只有一条数据,且这条数据返回的是文件类型
|
2020-06-03 14:42:13 +08:00
|
|
|
|
if(entries.length === 1 && entries[0].type === "file"){
|
2020-03-16 14:12:11 +08:00
|
|
|
|
this.setState({
|
2020-06-03 14:42:13 +08:00
|
|
|
|
fileDetail:entries,
|
2020-04-17 17:35:47 +08:00
|
|
|
|
rootList:undefined,
|
2020-04-24 09:15:52 +08:00
|
|
|
|
isSpin:false,
|
|
|
|
|
|
subFileType:false
|
2020-03-16 14:12:11 +08:00
|
|
|
|
})
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.setState({
|
2020-04-17 17:35:47 +08:00
|
|
|
|
fileDetail:undefined,
|
2020-06-03 14:42:13 +08:00
|
|
|
|
rootList:entries,
|
|
|
|
|
|
isSpin:false,
|
|
|
|
|
|
branchLastCommit:result.data.last_commit && result.data.last_commit.commit,
|
|
|
|
|
|
lastCommitAuthor:result.data.last_commit && (result.data.last_commit.author || (result.data.last_commit.commit && result.data.last_commit.commit.author))
|
2020-03-16 14:12:11 +08:00
|
|
|
|
})
|
2020-06-03 14:42:13 +08:00
|
|
|
|
this.renderData(entries);
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderData=(data)=>{
|
|
|
|
|
|
const rootList = [];
|
|
|
|
|
|
const readMeContent = [];
|
2020-04-13 17:45:36 +08:00
|
|
|
|
const readMeFile = [];
|
2020-03-16 14:12:11 +08:00
|
|
|
|
data && data.map((item,key)=>{
|
|
|
|
|
|
rootList.push({
|
|
|
|
|
|
key,
|
2020-05-22 15:20:36 +08:00
|
|
|
|
message:item.commit && item.commit.message,
|
2020-03-16 14:12:11 +08:00
|
|
|
|
...item
|
|
|
|
|
|
})
|
|
|
|
|
|
if(item.name === 'README.md'){
|
|
|
|
|
|
readMeContent.push({...item})
|
2020-04-13 17:45:36 +08:00
|
|
|
|
readMeFile.push({...item})
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
rootList:rootList,
|
2020-04-13 17:45:36 +08:00
|
|
|
|
readMeContent,
|
|
|
|
|
|
readMeFile
|
2020-03-16 14:12:11 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-17 17:35:47 +08:00
|
|
|
|
// 点击跳转到子目录
|
|
|
|
|
|
goToSubRoot=(path)=>{
|
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
2020-04-24 09:15:52 +08:00
|
|
|
|
this.props.history.push(`/projects/${projectsId}/coders?url=${path}`);
|
2020-04-17 17:35:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-03-16 14:12:11 +08:00
|
|
|
|
// readme文件内容
|
2020-04-13 17:45:36 +08:00
|
|
|
|
renderReadMeContent=(readMeContent, permission)=>{
|
|
|
|
|
|
const { fileDetail,readMeFile } = this.state;
|
2020-03-16 14:12:11 +08:00
|
|
|
|
if(fileDetail){return;}
|
|
|
|
|
|
if(readMeContent && readMeContent.length > 0){
|
|
|
|
|
|
return(
|
|
|
|
|
|
<div className="commonBox">
|
2020-04-13 17:45:36 +08:00
|
|
|
|
<div className="commonBox-title">
|
2020-05-20 18:11:32 +08:00
|
|
|
|
<span className="mr10"><i className="iconfont icon-xinjianjianliwodejianli font-20 color-grey-9 fl mt3"></i></span>
|
2020-04-13 17:45:36 +08:00
|
|
|
|
<span className="commonBox-title-read">{readMeContent[0].name}</span>
|
|
|
|
|
|
{
|
|
|
|
|
|
permission ?
|
2020-05-20 18:11:32 +08:00
|
|
|
|
<a onClick={()=>this.ChangeFile(readMeFile[0],false)} className="ml20 pull-right"><i className="iconfont icon-bianji2 font-20 color-blue"></i></a>
|
2020-04-13 17:45:36 +08:00
|
|
|
|
: ""
|
|
|
|
|
|
}
|
|
|
|
|
|
</div>
|
2020-03-16 14:12:11 +08:00
|
|
|
|
<div className="commonBox-info">
|
|
|
|
|
|
{
|
|
|
|
|
|
readMeContent[0].content ?
|
2020-04-29 10:42:53 +08:00
|
|
|
|
<RenderHtml className="break_word_comments" value={readMeContent[0].content} />
|
2020-03-16 14:12:11 +08:00
|
|
|
|
:
|
|
|
|
|
|
<span>暂无~</span>
|
|
|
|
|
|
}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 选择分支
|
|
|
|
|
|
changeBranch=(value)=>{
|
2020-06-03 14:42:13 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
|
branch:value,
|
|
|
|
|
|
isSpin: true
|
|
|
|
|
|
})
|
|
|
|
|
|
let { search } = this.props.history.location;
|
|
|
|
|
|
if(search && search.indexOf("?url=")>-1){
|
|
|
|
|
|
let url =search.split("?url=")[1];
|
2020-04-24 10:38:19 +08:00
|
|
|
|
this.setState({
|
2020-06-03 14:42:13 +08:00
|
|
|
|
filePath:url
|
2020-04-24 10:38:19 +08:00
|
|
|
|
})
|
2020-06-03 14:42:13 +08:00
|
|
|
|
this.getFileDetail(url, value);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.getProjectRoot( value );
|
|
|
|
|
|
}
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
render(){
|
2020-06-03 14:42:13 +08:00
|
|
|
|
const { branchLastCommit , lastCommitAuthor , rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin , zip_url , tar_url} = this.state;
|
|
|
|
|
|
const { isManager , isDeveloper , projectDetail } = this.props;
|
2020-03-20 21:40:43 +08:00
|
|
|
|
const { projectsId } = this.props.match.params;
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
|
{
|
|
|
|
|
|
dataIndex: 'name',
|
2020-05-22 15:20:36 +08:00
|
|
|
|
width:"30%",
|
2020-03-16 14:12:11 +08:00
|
|
|
|
render: (text,item) => (
|
2020-05-28 15:18:57 +08:00
|
|
|
|
<a onClick={()=>this.goToSubRoot(item.path)} className="ml12">
|
2020-05-22 17:09:11 +08:00
|
|
|
|
<i className={ item.type === "file" ? "iconfont icon-wenjia font-15 color-green-file mr5":"iconfont icon-wenjianjia1 color-green-file font-15 mr5"}></i>{text}
|
2020-03-16 14:12:11 +08:00
|
|
|
|
</a>
|
|
|
|
|
|
),
|
2020-05-22 13:54:12 +08:00
|
|
|
|
},{
|
2020-05-22 16:58:48 +08:00
|
|
|
|
dataIndex:"commit",
|
2020-05-22 13:54:12 +08:00
|
|
|
|
width:"60%",
|
2020-05-22 15:20:36 +08:00
|
|
|
|
render:(text,item)=>
|
|
|
|
|
|
(
|
2020-05-22 18:13:12 +08:00
|
|
|
|
item.commit && item.commit.message ? <span className="task-hide" style={{display:'block',maxWidth:"670px"}}>{item.commit.message}</span> :""
|
2020-05-22 15:20:36 +08:00
|
|
|
|
)
|
|
|
|
|
|
},{
|
2020-05-22 16:58:48 +08:00
|
|
|
|
dataIndex:"commit",
|
2020-05-22 15:20:36 +08:00
|
|
|
|
width:"10%",
|
2020-05-28 15:18:57 +08:00
|
|
|
|
className:"edu-txt-right",
|
2020-05-22 16:58:48 +08:00
|
|
|
|
render:(text,item)=>(
|
2020-05-28 15:18:57 +08:00
|
|
|
|
item.commit && item.commit.time_from_now ? <a title={item.commit.created_at} className="mr12" style={{cursor:"default",color:"#888"}}>{item.commit.time_from_now}</a> :""
|
2020-05-22 13:54:12 +08:00
|
|
|
|
)
|
2020-03-16 14:12:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
const title = () =>{
|
2020-06-03 14:42:13 +08:00
|
|
|
|
if(branchLastCommit){
|
2020-03-16 14:12:11 +08:00
|
|
|
|
return(
|
|
|
|
|
|
<div className="f-wrap-alignCenter">
|
|
|
|
|
|
{
|
2020-06-03 14:42:13 +08:00
|
|
|
|
lastCommitAuthor ?
|
2020-03-16 14:12:11 +08:00
|
|
|
|
<React.Fragment>
|
2020-06-03 14:42:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
lastCommitAuthor.login ?
|
|
|
|
|
|
<Link to={`/users/${lastCommitAuthor.login}/projects`} className="show-user-link">
|
|
|
|
|
|
<img src={getImageUrl(`images/${lastCommitAuthor.image_url}`)} className="radius mr10" width="32" height="32" alt=""/>
|
|
|
|
|
|
<span className="mr15">{lastCommitAuthor.name}</span>
|
|
|
|
|
|
</Link>:
|
|
|
|
|
|
<span className="mr15">{lastCommitAuthor.name}</span>
|
|
|
|
|
|
}
|
2020-03-16 14:12:11 +08:00
|
|
|
|
</React.Fragment>
|
|
|
|
|
|
:""
|
|
|
|
|
|
}
|
2020-06-03 14:42:13 +08:00
|
|
|
|
<span className="color-blue flex-1 hide-1">{branchLastCommit.message}</span>
|
|
|
|
|
|
<span>{branchLastCommit.time_from_now}</span>
|
|
|
|
|
|
<span className="commitKey">{truncateCommitId(branchLastCommit.sha)}</span>
|
2020-03-16 14:12:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return undefined;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-03 14:42:13 +08:00
|
|
|
|
const downloadUrl = ()=>(
|
|
|
|
|
|
<Menu>
|
|
|
|
|
|
{zip_url && <Menu.Item><a href={zip_url}>ZIP</a></Menu.Item> }
|
|
|
|
|
|
{tar_url && <Menu.Item><a href={tar_url}>TAR.GZ</a></Menu.Item> }
|
|
|
|
|
|
</Menu>
|
|
|
|
|
|
)
|
2020-03-16 14:12:11 +08:00
|
|
|
|
|
2020-04-22 18:45:03 +08:00
|
|
|
|
const urlRoot = filePath === undefined ? '':`/${filePath}`;
|
2020-04-17 17:35:47 +08:00
|
|
|
|
let array = filePath && filePath.split("/");
|
2020-03-16 14:12:11 +08:00
|
|
|
|
return(
|
2020-04-17 17:35:47 +08:00
|
|
|
|
<Spin spinning={isSpin}>
|
2020-05-20 18:11:32 +08:00
|
|
|
|
<div className="main">
|
2020-05-26 18:50:17 +08:00
|
|
|
|
<div className="f-wrap-between mb20">
|
2020-04-21 16:30:51 +08:00
|
|
|
|
<div className="f-wrap-alignCenter">
|
2020-06-03 09:56:07 +08:00
|
|
|
|
<SelectBranch repo_id={projectDetail && projectDetail.repo_id} branch={branch} changeBranch={this.changeBranch} {...this.props} {...this.state}></SelectBranch>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
filePath &&
|
|
|
|
|
|
<span className="ml20 font-16">
|
2020-04-17 17:35:47 +08:00
|
|
|
|
<a onClick={()=>this.returnMain(branch)} className="color-blue">{ projectDetail && projectDetail.identifier }</a>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
{
|
|
|
|
|
|
array && array.map((item,key)=>{
|
|
|
|
|
|
return(
|
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
|
{
|
|
|
|
|
|
key === array.length-1 ?
|
2020-04-17 17:35:47 +08:00
|
|
|
|
<span className="color-grey-6 subFileName" key={key}>{item}</span>
|
|
|
|
|
|
:
|
|
|
|
|
|
key === 0?
|
2020-04-24 09:15:52 +08:00
|
|
|
|
<Link to={`/projects/${projectsId}/coders?url=${item}`} className="color-blue subFileName" key={key}>{item}</Link>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
:
|
2020-04-24 09:15:52 +08:00
|
|
|
|
<Link to={`/projects/${projectsId}/coders?url=${array[key-1]}/${item}`} className="color-blue subFileName" key={key}>{item}</Link>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2020-04-17 17:35:47 +08:00
|
|
|
|
</span>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
}
|
2020-03-16 14:12:11 +08:00
|
|
|
|
</div>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
<div className="f-wrap-alignCenter">
|
2020-04-22 19:05:03 +08:00
|
|
|
|
{
|
2020-04-24 09:15:52 +08:00
|
|
|
|
subFileType && (isManager || isDeveloper) &&
|
2020-05-20 18:11:32 +08:00
|
|
|
|
<p className="mr30">
|
|
|
|
|
|
<Link className="color-blue" to={`/projects/${projectsId}/coders/${branch}/newfile${urlRoot}`} >新建文件</Link>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
</p>
|
2020-04-22 19:05:03 +08:00
|
|
|
|
}
|
2020-04-17 17:35:47 +08:00
|
|
|
|
{
|
2020-06-03 09:56:07 +08:00
|
|
|
|
projectDetail && projectDetail.clone_url && <CloneAddress http_url={projectDetail.clone_url} downloadUrl={downloadUrl} showNotification={this.props.showNotification}></CloneAddress>
|
2020-04-17 17:35:47 +08:00
|
|
|
|
}
|
2020-04-21 16:30:51 +08:00
|
|
|
|
</div>
|
2020-04-17 17:35:47 +08:00
|
|
|
|
</div>
|
2020-04-21 16:30:51 +08:00
|
|
|
|
{/* 主目录列表 */}
|
|
|
|
|
|
{
|
|
|
|
|
|
rootList &&
|
|
|
|
|
|
<RootTable columns = {columns} data={rootList} title={() => title()}></RootTable>
|
|
|
|
|
|
}
|
|
|
|
|
|
{/* 子目录列表、文件 */}
|
|
|
|
|
|
{
|
|
|
|
|
|
fileDetail && fileDetail.length>0 &&
|
|
|
|
|
|
<CoderRootFileDetail detail = {fileDetail[0]} {...this.props} {...this.state} readOnly={this.state.readOnly}></CoderRootFileDetail>
|
|
|
|
|
|
}
|
|
|
|
|
|
{/* readme.txt (isManager || isDeveloper)*/}
|
|
|
|
|
|
{ this.renderReadMeContent(readMeContent,(isManager || isDeveloper)) }
|
|
|
|
|
|
</div>
|
2020-04-17 17:35:47 +08:00
|
|
|
|
</Spin>
|
2020-03-16 14:12:11 +08:00
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
export default CoderRootDirectory;
|