|
|
|
@ -30,10 +30,12 @@ class Repositoryfile extends Component{
|
|
|
|
|
let {main} =this.state;
|
|
|
|
|
let matchpath =this.props.match.path;
|
|
|
|
|
let id = this.props.match.params.shixunId;
|
|
|
|
|
|
|
|
|
|
let url ="";
|
|
|
|
|
if(matchpath==="/shixuns/:shixunId/repository"){
|
|
|
|
|
if( matchpath.indexOf("repository")>-1){
|
|
|
|
|
url ="/shixuns/"+id+"/repository.json";
|
|
|
|
|
}else if(matchpath==="/shixuns/:shixunId/secret_repository"){
|
|
|
|
|
}
|
|
|
|
|
if(matchpath.indexOf("secret_repository")>-1){
|
|
|
|
|
url ="/shixuns/"+id+"/secret_repository.json";
|
|
|
|
|
}
|
|
|
|
|
let newmain=[]
|
|
|
|
@ -68,12 +70,13 @@ class Repositoryfile extends Component{
|
|
|
|
|
|
|
|
|
|
let matchpath =this.props.match.path;
|
|
|
|
|
let url ="";
|
|
|
|
|
if(matchpath==="/shixuns/:shixunId/repository"){
|
|
|
|
|
|
|
|
|
|
if( matchpath.indexOf("repository")>-1){
|
|
|
|
|
url ="/shixuns/"+id+"/repository.json";
|
|
|
|
|
}else if(matchpath==="/shixuns/:shixunId/secret_repository"){
|
|
|
|
|
}
|
|
|
|
|
if(matchpath.indexOf("secret_repository")>-1){
|
|
|
|
|
url ="/shixuns/"+id+"/secret_repository.json";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let ary=main;
|
|
|
|
|
let paths=path;
|
|
|
|
|
|
|
|
|
@ -115,34 +118,44 @@ class Repositoryfile extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleSubmit = (e) => {
|
|
|
|
|
let {path}=this.state;
|
|
|
|
|
let matchpath =this.props.match.path;
|
|
|
|
|
let flag =false;
|
|
|
|
|
if(matchpath==="/shixuns/:shixunId/repository"){
|
|
|
|
|
flag =false;
|
|
|
|
|
}else if(matchpath==="/shixuns/:shixunId/secret_repository"){
|
|
|
|
|
flag =true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let url=`/shixuns/${this.props.match.params.shixunId}/upload_git_folder.json`;
|
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
console.log('Received values of form: ', values);
|
|
|
|
|
let paths=path+values.name;
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
path: paths,
|
|
|
|
|
secret_repository:flag,
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
if(result.data.status===0){
|
|
|
|
|
this.props.showNotification("新建成功")
|
|
|
|
|
let {path}=this.state;
|
|
|
|
|
let matchpath =this.props.match.path;
|
|
|
|
|
let flag =false;
|
|
|
|
|
|
|
|
|
|
if( matchpath.indexOf("repository")>-1){
|
|
|
|
|
flag =false;
|
|
|
|
|
}
|
|
|
|
|
if(matchpath.indexOf("secret_repository")>-1){
|
|
|
|
|
flag =true;
|
|
|
|
|
}
|
|
|
|
|
if(this.props.selectupfils===true){
|
|
|
|
|
console.log(path)
|
|
|
|
|
this.props.selectupfilspath(path);
|
|
|
|
|
this.props.showNotification("选择文件目录成功")
|
|
|
|
|
this.props.hideNewFolder();
|
|
|
|
|
}else{
|
|
|
|
|
let url=`/shixuns/${this.props.match.params.shixunId}/upload_git_folder.json`;
|
|
|
|
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
console.log('Received values of form: ', values);
|
|
|
|
|
let paths=path+values.name;
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
path: paths,
|
|
|
|
|
secret_repository:flag,
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
if(result.data.status===0){
|
|
|
|
|
this.props.showNotification("新建成功")
|
|
|
|
|
this.props.hideNewFolder();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
@ -154,7 +167,7 @@ class Repositoryfile extends Component{
|
|
|
|
|
return(
|
|
|
|
|
evaluationvisible===true?<Modal
|
|
|
|
|
keyboard={false}
|
|
|
|
|
title="新建文件夹"
|
|
|
|
|
title={this.props.titles?this.props.titles:"新建文件夹"}
|
|
|
|
|
visible={evaluationvisible}
|
|
|
|
|
closable={false}
|
|
|
|
|
footer={false}
|
|
|
|
@ -199,10 +212,10 @@ class Repositoryfile extends Component{
|
|
|
|
|
<span onClick={()=>this.savegetfilepath(path+item.name,item.type)}>{item.name}</span>
|
|
|
|
|
</a>
|
|
|
|
|
*/}
|
|
|
|
|
<div className="clearfix mt5">
|
|
|
|
|
<div className="clearfix mt5">
|
|
|
|
|
<label className=" mt5">选中的新建文件夹目录:</label>
|
|
|
|
|
<div className={"mt5 mb5"} >{path}</div>
|
|
|
|
|
<Form>
|
|
|
|
|
{this.props.selectupfils===true?"": <Form>
|
|
|
|
|
<Form.Item
|
|
|
|
|
className="mt15"
|
|
|
|
|
>
|
|
|
|
@ -218,15 +231,18 @@ class Repositoryfile extends Component{
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</Form>
|
|
|
|
|
</Form>}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<a className="task-btn task-btn-orange fr"
|
|
|
|
|
style={{marginTop: '20px',marginLeft:'20px'}} id="add_path"
|
|
|
|
|
// onClick={()=>this.evaluationenter()}
|
|
|
|
|
onClick={() => this.handleSubmit()}>确定</a>
|
|
|
|
|
<a className="pop_close task-btn mb10 fr"
|
|
|
|
|
style={{marginTop: '20px'}} id="back_page" onClick={()=>this.evaluationhideModal()}>取消</a>
|
|
|
|
|
<div className={"clearfix edu-txt-center mt20"}>
|
|
|
|
|
<a className="task-btn task-btn-orange fr"
|
|
|
|
|
style={{marginTop: '20px',marginLeft:'20px'}} id="add_path"
|
|
|
|
|
// onClick={()=>this.evaluationenter()}
|
|
|
|
|
onClick={() => this.handleSubmit()}>确定</a>
|
|
|
|
|
<a className="pop_close task-btn mb10 fr"
|
|
|
|
|
style={{marginTop: '20px'}} id="back_page" onClick={()=>this.evaluationhideModal()}>取消</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>:""
|
|
|
|
|