|
|
@ -2,6 +2,7 @@ import React , { Component } from 'react';
|
|
|
|
import {Menu, Spin} from 'antd';
|
|
|
|
import {Menu, Spin} from 'antd';
|
|
|
|
import { getImageUrl , markdownToHTML } from 'educoder';
|
|
|
|
import { getImageUrl , markdownToHTML } from 'educoder';
|
|
|
|
import { Router , Route , Link } from 'react-router-dom';
|
|
|
|
import { Router , Route , Link } from 'react-router-dom';
|
|
|
|
|
|
|
|
import Top from './DetailTop';
|
|
|
|
|
|
|
|
|
|
|
|
import './list.css';
|
|
|
|
import './list.css';
|
|
|
|
|
|
|
|
|
|
|
@ -9,6 +10,7 @@ import SelectBranch from '../Branch/SelectBranch';
|
|
|
|
import CloneAddress from '../Branch/CloneAddress';
|
|
|
|
import CloneAddress from '../Branch/CloneAddress';
|
|
|
|
import RootTable from './RootTable';
|
|
|
|
import RootTable from './RootTable';
|
|
|
|
import CoderRootFileDetail from './CoderRootFileDetail';
|
|
|
|
import CoderRootFileDetail from './CoderRootFileDetail';
|
|
|
|
|
|
|
|
import NullData from './NullData';
|
|
|
|
|
|
|
|
|
|
|
|
import axios from 'axios';
|
|
|
|
import axios from 'axios';
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -29,13 +31,14 @@ class CoderRootDirectory extends Component{
|
|
|
|
subFileType:"",
|
|
|
|
subFileType:"",
|
|
|
|
readMeContent:undefined,
|
|
|
|
readMeContent:undefined,
|
|
|
|
|
|
|
|
|
|
|
|
isSpin:false,
|
|
|
|
isSpin:true,
|
|
|
|
|
|
|
|
|
|
|
|
branchList:undefined,
|
|
|
|
branchList:undefined,
|
|
|
|
fileDetail:undefined,
|
|
|
|
fileDetail:undefined,
|
|
|
|
branchLastCommit:undefined,
|
|
|
|
branchLastCommit:undefined,
|
|
|
|
current_user:undefined,
|
|
|
|
current_user:undefined,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rootData:undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
changeAddress=(address)=>{
|
|
|
|
changeAddress=(address)=>{
|
|
|
@ -44,22 +47,7 @@ class CoderRootDirectory extends Component{
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// getUserInfo=()=>{
|
|
|
|
|
|
|
|
// const url = `/users/me.json`;
|
|
|
|
|
|
|
|
// axios.get(url).then(result=>{
|
|
|
|
|
|
|
|
// if(result && result.data.login){
|
|
|
|
|
|
|
|
// this.setState({
|
|
|
|
|
|
|
|
// current_user:result.data
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// this.getProjectRoot();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }).catch(error=>{
|
|
|
|
|
|
|
|
// console.log(error)
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount=()=>{
|
|
|
|
componentDidMount=()=>{
|
|
|
|
// this.getUserInfo();
|
|
|
|
|
|
|
|
let { search } = this.props.history.location;
|
|
|
|
let { search } = this.props.history.location;
|
|
|
|
let branchName = undefined;
|
|
|
|
let branchName = undefined;
|
|
|
|
if(search && search.indexOf("branch")>-1){
|
|
|
|
if(search && search.indexOf("branch")>-1){
|
|
|
@ -74,7 +62,6 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
// 获取根目录
|
|
|
|
// 获取根目录
|
|
|
|
getProjectRoot=(branch)=>{
|
|
|
|
getProjectRoot=(branch)=>{
|
|
|
|
console.log("root",this.props);
|
|
|
|
|
|
|
|
const { current_user } = this.props;
|
|
|
|
const { current_user } = this.props;
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
const url = `/${current_user && current_user.login}/${projectsId}/entries.json`;
|
|
|
|
const url = `/${current_user && current_user.login}/${projectsId}/entries.json`;
|
|
|
@ -89,7 +76,10 @@ class CoderRootDirectory extends Component{
|
|
|
|
fileDetail:undefined,
|
|
|
|
fileDetail:undefined,
|
|
|
|
isSpin: false
|
|
|
|
isSpin: false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.renderData(result.data)
|
|
|
|
this.renderData(result.data);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
rootData:result.data
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error)=>{})
|
|
|
|
}).catch((error)=>{})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -215,7 +205,7 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
render(){
|
|
|
|
render(){
|
|
|
|
const { rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin } = this.state;
|
|
|
|
const { rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin , rootData } = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
const { branchLastCommit , http_url , isManager , isDeveloper } = this.props;
|
|
|
|
const { branchLastCommit , http_url , isManager , isDeveloper } = this.props;
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
@ -266,7 +256,14 @@ class CoderRootDirectory extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
const urlRoot = filePath && filePath.length > 0 ? `/${filePath[filePath.length - 1].path}` : "";
|
|
|
|
const urlRoot = filePath && filePath.length > 0 ? `/${filePath[filePath.length - 1].path}` : "";
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
rootData &&
|
|
|
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
rootData.length > 0 ?
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<Top { ...this.props } {...this.state} />
|
|
|
|
<div className="f-wrap-between mt20">
|
|
|
|
<div className="f-wrap-between mt20">
|
|
|
|
<div className="f-wrap-alignCenter">
|
|
|
|
<div className="f-wrap-alignCenter">
|
|
|
|
<SelectBranch branch={branch} changeBranch={this.changeBranch} {...this.props} {...this.state}></SelectBranch>
|
|
|
|
<SelectBranch branch={branch} changeBranch={this.changeBranch} {...this.props} {...this.state}></SelectBranch>
|
|
|
@ -321,6 +318,12 @@ class CoderRootDirectory extends Component{
|
|
|
|
{ this.renderReadMeContent(readMeContent) }
|
|
|
|
{ this.renderReadMeContent(readMeContent) }
|
|
|
|
</Spin>
|
|
|
|
</Spin>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
<NullData {...this.props} {...this.state} http_url={http_url} ></NullData>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</React.Fragment>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|