From 3071c785bcb738a91ba2514d2c30f6ad6139ccfe Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Mon, 1 Mar 2021 16:02:02 +0800
Subject: [PATCH 1/2] sync mirror
---
src/forge/Main/Detail.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js
index 032574894..768525254 100644
--- a/src/forge/Main/Detail.js
+++ b/src/forge/Main/Detail.js
@@ -347,6 +347,7 @@ class Detail extends Component {
const url = `/${owner}/${projectsId}/sync_mirror.json`;
axios.post(url).then(result => {
if (result && result.data && result.data.status === 0) {
+ this.props.showNotification("镜像同步成功!");
this.getProject(2);
} else {
this.props.showNotification("镜像同步失败!");
From 80f1e4d44898da4658811c7d40327c296648b1be Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Tue, 2 Mar 2021 10:51:50 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=96=87=E4=BB=B6-url?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/DevOps/Dispose/List.jsx | 2 +-
src/forge/Main/CoderRootDirectory.js | 73 +++++++---------------------
src/forge/Merge/Files.jsx | 2 +-
3 files changed, 19 insertions(+), 58 deletions(-)
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}