diff --git a/src/forge/DevOps/Dispose/List.jsx b/src/forge/DevOps/Dispose/List.jsx index b218281d5..32bf5d8d6 100644 --- a/src/forge/DevOps/Dispose/List.jsx +++ b/src/forge/DevOps/Dispose/List.jsx @@ -32,7 +32,7 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){ ellipsis:true, render:(value,item)=>{ return( - {value} + {value} ) } }, diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index b4a31c0e5..a6dc26582 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -52,7 +52,8 @@ class CoderRootDirectory extends Component { tar_url:undefined, chooseType:undefined, - md:false + md:false, + treeValue:undefined } } changeAddress = (address) => { @@ -87,15 +88,13 @@ class CoderRootDirectory extends Component { }; Init = () => { - let { search } = this.props.history.location; - const { branchName } = this.props.match.params; + let { pathname } = this.props.history.location; + const { branchName , owner , projectsId } = this.props.match.params; const { defaultBranch } = this.props; let branch = branchName || defaultBranch; - if (search && (search.indexOf("?url=") > -1 || search.indexOf("&url=") > -1)) { - let url = search.split("url=")[1]; - if(url && decodeURI(url).indexOf("&")){ - url=decodeURI(url).split("&")[0]; - } + if (pathname && (pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf("/tree/") > -1)) { + let url = pathname.split("/tree/")[1]; + this.setState({treeValue:url}) this.getFileDetail(decodeURI(url),branch); } else { this.getProjectRoot(branch); @@ -106,7 +105,8 @@ class CoderRootDirectory extends Component { returnMain = (branch) => { const { projectsId , owner , branchName } = this.props.match.params; this.setState({ - readOnly:true + readOnly:true, + treeValue:undefined }) this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}`); this.getProjectRoot(branch); @@ -145,45 +145,13 @@ class CoderRootDirectory extends Component { ChangeFile = (arr, readOnly) => { const { projectsId , owner } = this.props.match.params; //点击直接跳转页面 加载一次路由 - this.props.history.push(`/projects/${owner}/${projectsId}?url=${arr.path}`); + this.props.history.push(`/projects/${owner}/${projectsId}/tree/${arr.path}`); this.setState({ readOnly: readOnly, chooseType:"file" }); }; - 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({ - key: k, - index: k, - name: i, - path: str.substr(1), - type: filePath && filePath.length > 0 ? filePath[k] ? filePath[k].type : type : type, - }); - }); - const { projectsId , owner } = this.props.match.params; - //点击直接跳转页面 加载一次路由 - this.props.history.push(`/projects/${owner}/${projectsId}?url=${str.substr(1)}`); - } else { - list.push({ - index: 0, - name, - path, - type, - }); - } - this.setState({ - filePath: list, - }); - }; - // 获取子目录 getFileDetail = (path, ref) => { this.setState({ @@ -267,7 +235,7 @@ class CoderRootDirectory extends Component { chooseType:type }) const { projectsId, owner , branchName } = this.props.match.params; - this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}?url=${path}`); + this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}${path?`/tree/${path}`:""}`); if(filename.substring(filename.length - 3) === ".md"){ this.setState({ md:true @@ -320,17 +288,9 @@ class CoderRootDirectory extends Component { // 选择分支 changeBranch = (value) => { - let { search } = this.props.history.location; const { projectsId , owner } = this.props.match.params; - - let url = `/projects/${owner}/${projectsId}${value && `/branch/${value}`}`; - if (search && (search.indexOf("?url=") > -1 || search.indexOf("&url=") > -1)) { - let u = search.split("url=")[1]; - if(u && decodeURI(u).indexOf("&")){ - u=decodeURI(u).split("&")[0]; - } - url += `?url=${u}`; - } + const { treeValue } = this.state; + let url = `/projects/${owner}/${projectsId}${value && `/branch/${value}`}${treeValue ? `/tree/${treeValue}`:""}`; this.props.history.push(url); } @@ -338,10 +298,11 @@ class CoderRootDirectory extends Component { returnUlr=(url)=>{ this.setState({ chooseType:"dir", - readOnly:true + readOnly:true, + treeValue:url }) - const { projectsId , owner } = this.props.match.params; - this.props.history.push(`/projects/${owner}/${projectsId}?url=${url}`); + const { projectsId , owner , branchName } = this.props.match.params; + this.props.history.push(`/projects/${owner}/${projectsId}${branchName?`/branch/${branchName}`:""}/tree/${url}`); } onEdit=(readOnly)=>{ diff --git a/src/forge/Merge/Files.jsx b/src/forge/Merge/Files.jsx index 089832662..aa7003e51 100644 --- a/src/forge/Merge/Files.jsx +++ b/src/forge/Merge/Files.jsx @@ -47,7 +47,7 @@ function Files({data,history,owner,projectsId}){ {item.name} - + +{item.addition} -{item.deletion}