|
|
|
@ -40,8 +40,11 @@ class Repository extends Component {
|
|
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
|
if(prevProps!=this.props){
|
|
|
|
|
this.setState({
|
|
|
|
|
trees:this.props.trees
|
|
|
|
|
trees:this.props.trees,
|
|
|
|
|
ischecke:false,
|
|
|
|
|
ischeckevalue:""
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onRepoFileClick = (item) => {
|
|
|
|
@ -61,7 +64,10 @@ class Repository extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSelectDirectoryTree=(selectedKeys, info)=>{
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
ischecke:false,
|
|
|
|
|
ischeckevalue:""
|
|
|
|
|
})
|
|
|
|
|
this.onRepoFileClick(info.node.props.item)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -73,7 +79,7 @@ class Repository extends Component {
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
confirm({
|
|
|
|
|
title: '确认需要要删除该文件?',
|
|
|
|
|
title: '确认需要删除该文件?',
|
|
|
|
|
okText: '确定',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
onOk() {
|
|
|
|
@ -109,12 +115,18 @@ class Repository extends Component {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let pathtype=path;
|
|
|
|
|
if(path===undefined||path===""){
|
|
|
|
|
path=newfilspath
|
|
|
|
|
}else{
|
|
|
|
|
path=path+"/"+newfilspath
|
|
|
|
|
}
|
|
|
|
|
let gototype;
|
|
|
|
|
if(pathtype){
|
|
|
|
|
gototype=1
|
|
|
|
|
}else{
|
|
|
|
|
gototype=2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const url = `/shixuns//${shixunId}/delete_git_file.json`;
|
|
|
|
|
|
|
|
|
@ -126,11 +138,23 @@ class Repository extends Component {
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if(response.data.status == 0) {
|
|
|
|
|
this.props.showNotification("删除成功")
|
|
|
|
|
this.state.trees.map((item,key)=>{
|
|
|
|
|
if(item.name===newfilspath){
|
|
|
|
|
this.state.trees.splice(key,1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if(gototype===1){
|
|
|
|
|
if(this.state.trees.length>1){
|
|
|
|
|
this.state.trees.map((item,key)=>{
|
|
|
|
|
if(item.name===newfilspath){
|
|
|
|
|
this.state.trees.splice(key,1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.props.fetchRepo(this.props.pathArray.length-1)
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.state.trees.map((item,key)=>{
|
|
|
|
|
if(item.name===newfilspath){
|
|
|
|
|
this.state.trees.splice(key,1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
ischecke:false,
|
|
|
|
|
ischeckevalue:""
|
|
|
|
@ -138,10 +162,7 @@ class Repository extends Component {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(function (error) {
|
|
|
|
|
this.setState({
|
|
|
|
|
ischecke:false,
|
|
|
|
|
ischeckevalue:""
|
|
|
|
|
})
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onCheck = (checkedKeys, info) => {
|
|
|
|
@ -191,7 +212,6 @@ class Repository extends Component {
|
|
|
|
|
{...this.props}
|
|
|
|
|
Repositoryflag={Repositoryflag}
|
|
|
|
|
hideNewFolder={()=>this.hideNewFolder()}
|
|
|
|
|
setfilepath={(path)=>this.setfilepath(path)}
|
|
|
|
|
/>:""}
|
|
|
|
|
{ repositoryLoading ? <div style={{ minHeight: '500px'}}></div> :
|
|
|
|
|
<div className="mb10" id="collaborators_list_info">
|
|
|
|
@ -393,7 +413,7 @@ class Repository extends Component {
|
|
|
|
|
>
|
|
|
|
|
{ trees === undefined ?"": trees === null || trees.length===0?"":trees.map((item, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<TreeNode disableCheckbox={this.state.ischeckevalue===item.name?false:this.state.ischecke?true:item.type==='tree'?true:false} item={item} title={`${item.name}`} key={item.type==='tree'?"0-0":`0-0-${index}`} icon={item.type==='tree'?<i className="iconfont icon-xingzhuangjiehebeifen color-blue font-12" />:<i className="iconfont icon-xingzhuangjiehe color-blue font-12"/>} id={`file${index}`} key={index}>
|
|
|
|
|
<TreeNode disableCheckbox={this.state.ischeckevalue===item.name?false:this.state.ischecke?true:false} item={item} title={`${item.name}`} key={item.type==='tree'?"0-0":`0-0-${index}`} icon={item.type==='tree'?<i className="iconfont icon-xingzhuangjiehebeifen color-blue font-12" />:<i className="iconfont icon-xingzhuangjiehe color-blue font-12"/>} id={`file${index}`} key={index}>
|
|
|
|
|
<div className={"fr"}>x</div>
|
|
|
|
|
</TreeNode>
|
|
|
|
|
)})}
|
|
|
|
|