From 2d312b6176dac1330e34bf8af2c8459f19d0aa74 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Fri, 25 Jun 2021 14:10:13 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=B7=AF=E7=94=B1=EF=BC=9Atree=E5=90=8E?=
=?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=8F=82=E6=95=B0branch=E5=86=85=E5=AE=B9?=
=?UTF-8?q?=E5=90=AB=E6=9C=89/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Component/DrawerPanel.jsx | 2 +-
src/forge/DevOps/Dispose/List.jsx | 2 +-
src/forge/Main/CoderDepot.jsx | 32 +++++++-----
src/forge/Main/CoderRootBranch.js | 2 +-
src/forge/Merge/MergeItem.js | 64 ++++++++++++++----------
src/forge/Merge/MessageCount.js | 4 +-
src/forge/Newfile/UserSubmitComponent.js | 13 +++--
7 files changed, 70 insertions(+), 49 deletions(-)
diff --git a/src/forge/Component/DrawerPanel.jsx b/src/forge/Component/DrawerPanel.jsx
index 8070f3fa..e9777173 100644
--- a/src/forge/Component/DrawerPanel.jsx
+++ b/src/forge/Component/DrawerPanel.jsx
@@ -71,7 +71,7 @@ function DrawerPanel({visible,onClose,branch,owner,projectsId,history, name , li
let dataref = event.node.props.dataRef;
if(dataref.type==="file"){
onClose();
- history.push(`/projects/${owner}/${projectsId}/tree/${branch}/${dataref.path}`);
+ history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}/${dataref.path}`);
}
}
diff --git a/src/forge/DevOps/Dispose/List.jsx b/src/forge/DevOps/Dispose/List.jsx
index 72a26785..e9c9a6a9 100644
--- a/src/forge/DevOps/Dispose/List.jsx
+++ b/src/forge/DevOps/Dispose/List.jsx
@@ -66,7 +66,7 @@ function List({ list, operate , projectsId , owner , showModal , deleteFunc }){
ellipsis:true,
render:(value,item)=>{
return(
- {value}
+ {value}
)
}
},
diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx
index d2b63d87..842ea563 100644
--- a/src/forge/Main/CoderDepot.jsx
+++ b/src/forge/Main/CoderDepot.jsx
@@ -50,7 +50,8 @@ function CoderDepot(props){
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
- const branchName = props.match.params.branchName;
+ let branchName = props.match.params.branchName;
+ branchName = branchName && branchName.replaceAll("%2F",'/');
const details = props.projectDetail;
let pathname = props.history.location.pathname;
@@ -75,8 +76,9 @@ function CoderDepot(props){
useEffect(()=>{
if (projectsId && owner && defaultBranch){
- if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
- let url = pathname.split(`/tree/${branchName}/`)[1];
+ let b = branchName && branchName.replaceAll("/","%2F");
+ if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) {
+ let url = pathname.split(`/tree/${b}/`)[1];
setTreeValue(url);
getFileInfo(url,branchName);
setType("file");
@@ -92,6 +94,7 @@ function CoderDepot(props){
function getDirInfo(branch){
setIsSpin(true);
const url = `/${owner}/${projectsId}/entries.json`;
+
axios.get(url, {
params: { ref: branch }
}).then((result) => {
@@ -158,17 +161,20 @@ function CoderDepot(props){
// 切换分支或者标签
function changeBranch(value){
- let url = `/projects/${owner}/${projectsId}${value && `/tree/${value}`}${treeValue ? `/${treeValue}`:""}`;
+ let url = `/projects/${owner}/${projectsId}${value && `/tree/${value.replaceAll("/","%2F")}`}${treeValue ? `/${treeValue}`:""}`;
props.history.push(url);
}
// 文件相关的下拉项
- const fileMenu =(
+ function fileMenu(){
+ let b = branchName || defaultBranch;
+ return (
- )
+ )
+ }
function getPathUrl(array,index){
if(array && array.length>0 && index){
@@ -183,16 +189,18 @@ function CoderDepot(props){
function returnMain(){
setTreeValue(undefined);
let branch = branchName || defaultBranch;
- props.history.push(`/projects/${owner}/${projectsId}/tree/${branch}`);
+ props.history.push(`/projects/${owner}/${projectsId}/tree/${branch.replaceAll("/","%2F")}`);
};
// 子目录路径返回链接
function returnUlr(url){
- props.history.push(`/projects/${owner}/${projectsId}/tree${branchName?`/${branchName}`:""}/${url}`);
+ let enBranch = branchName && branchName.replaceAll("/","%2F");
+ props.history.push(`/projects/${owner}/${projectsId}/tree${enBranch?`/${enBranch}`:""}/${url}`);
}
// 点击跳转到子目录
function goToSubRoot(path,type,filename){
+ let enBranch = branchName || defaultBranch;
setType(type);
- props.history.push(`/projects/${owner}/${projectsId}${`/tree/${branchName || defaultBranch}`}${path?`/${path}`:""}`);
+ props.history.push(`/projects/${owner}/${projectsId}${`/tree/${enBranch.replaceAll("/","%2F")}`}${path?`/${path}`:""}`);
}
function onEdit(readOnly){
@@ -317,7 +325,7 @@ function CoderDepot(props){
urlLink(`/projects/${owner}/${projectsId}/issues/new`)} >+ 任务
{ fileOperate &&
-
+
}
diff --git a/src/forge/Main/CoderRootBranch.js b/src/forge/Main/CoderRootBranch.js
index 5e9a84ca..012429e0 100644
--- a/src/forge/Main/CoderRootBranch.js
+++ b/src/forge/Main/CoderRootBranch.js
@@ -32,7 +32,7 @@ export default ((props)=>{
return(
-
{item.name}
+
{item.name}
{item.last_commit && truncateCommitId(item.last_commit.sha)}
{item.last_commit && item.last_commit.message}
diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js
index abf71322..e87fd037 100644
--- a/src/forge/Merge/MergeItem.js
+++ b/src/forge/Merge/MergeItem.js
@@ -99,33 +99,43 @@ class MergeItem extends Component {
{item.pr_time}
-
-
- {item.is_original
- ? item.fork_project_user
- : project_author_name}
- :{item.pull_request_head}
-
-
-
-
-
-
-
- {/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}
- {project_author_name}:{item.pull_request_base}
-
-
+ {
+ item.pull_request_head &&
+
+
+ {item.is_original
+ ? item.fork_project_user
+ : project_author_name}
+ :{item.pull_request_head}
+
+
+ }
+ {
+ item.pull_request_base &&
+
+
+
+ }
+ {
+ item.pull_request_base &&
+
+
+ {/* {item.is_fork ? item.pull_request_base : `${item.author_name}:${item.pull_request_base}`} */}
+ {project_author_name}:{item.pull_request_base}
+
+
+ }
+
diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js
index 064e3444..4313ed0e 100644
--- a/src/forge/Merge/MessageCount.js
+++ b/src/forge/Merge/MessageCount.js
@@ -337,10 +337,10 @@ class MessageCount extends Component {
- {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head}
+ {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head && data.pull_request.head.replaceAll("/","%2F")}
diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js
index 3a35467c..f987ead6 100644
--- a/src/forge/Newfile/UserSubmitComponent.js
+++ b/src/forge/Newfile/UserSubmitComponent.js
@@ -59,7 +59,7 @@ class UserSubmitComponent extends Component {
const url = `/${owner}/${projectsId}/create_file.json`;
axios.post(url, {
filepath: filename ? filename : path,
- branch: branch,
+ branch: branch && branch.replaceAll("%2F","/"),
new_branch: submitType === "1" ? values.branchname : undefined,
content,
message: values.desc,
@@ -72,7 +72,7 @@ class UserSubmitComponent extends Component {
const { getTopCount } = this.props;
getTopCount && getTopCount(values.branchname);
}
- let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${values.branchname}`: (branch ? `/tree/${branch}` : "")}`;
+ let url = `/projects/${owner}/${projectsId}${values.branchname ? `/tree/${values.branchname.replaceAll('/',"%2F")}`: (branch ? `/tree/${branch.replaceAll('/',"%2F")}` : "")}`;
this.props.history.push(url);
}
})
@@ -93,12 +93,13 @@ class UserSubmitComponent extends Component {
const { projectsId , owner } = this.props.match.params;
const { submitType } = this.state;
const url = `/${owner}/${projectsId}/update_file.json`;
+ let b = currentBranch || branch;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
axios
.put(url, {
filepath: detail.path,
- branch: submitType === "1" ? undefined : (currentBranch || branch),
+ branch: submitType === "1" ? undefined : b.replaceAll('%2F',"/"),
new_branch: submitType === "1" ? values.branchname : undefined,
content: content,
sha: detail.sha,
@@ -107,7 +108,8 @@ class UserSubmitComponent extends Component {
.then((result) => {
this.setState({ isSpin: false });
if (result.data && result.data.status === 1) {
- let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${values.branchname}` : ((currentBranch || branch) ? `/tree/${currentBranch || branch}`:""))}`;
+ let b = currentBranch || branch;
+ let url = `/projects/${owner}/${projectsId}${(values.branchname ? `/tree/${values.branchname.replaceAll('/',"%2F")}` : (b ? `/tree/${b.replaceAll('/',"%2F")}`:""))}`;
this.props.history.push(url);
this.props.showNotification("文件修改成功!");
}
@@ -130,6 +132,7 @@ class UserSubmitComponent extends Component {
const { current_user, filepath, projectDetail , currentBranch } = this.props;
const { editor_type } = this.props;
+ let b = currentBranch || branch;
return (
@@ -188,7 +191,7 @@ class UserSubmitComponent extends Component {
>
- 直接提交至{currentBranch || branch}分支
+ 直接提交至{b.replaceAll('%2F',"/")}分支
From 79996bd1855560dd71964e69ac023869f6a79fb3 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Fri, 25 Jun 2021 18:21:31 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=9D=83=E9=99=90=EF=BC=9A=E6=98=93?=
=?UTF-8?q?=E4=BF=AE=E5=92=8C=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82=E7=9A=84?=
=?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BF=AE=E6=94=B9=E7=AD=89=E6=93=8D=E4=BD=9C?=
=?UTF-8?q?=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Head/header.scss | 2 +-
src/forge/Main/CoderRootCommit.js | 9 ++++----
src/forge/Merge/MergeItem.js | 4 ++--
src/forge/Merge/MessageCount.js | 36 +++++++++++++++++++++++--------
src/forge/Merge/merge.js | 21 +++++++++---------
src/forge/Order/Detail.js | 2 +-
src/forge/Order/Milepost.js | 2 +-
src/forge/Order/MilepostDetail.js | 2 +-
src/forge/Order/OrderItem.js | 7 +++---
src/forge/Order/order.css | 2 +-
src/forge/Order/order.js | 12 +++++------
src/forge/css/index.scss | 8 +++++++
12 files changed, 65 insertions(+), 42 deletions(-)
diff --git a/src/forge/Head/header.scss b/src/forge/Head/header.scss
index a2c11b7a..0246658a 100644
--- a/src/forge/Head/header.scss
+++ b/src/forge/Head/header.scss
@@ -33,7 +33,7 @@
li{
height: 40px;
line-height: 40px;
- padding:0px;
+ padding:0px!important;
cursor: default;
&:hover{
background-color: #fff;
diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js
index fc64aa01..9b349938 100644
--- a/src/forge/Main/CoderRootCommit.js
+++ b/src/forge/Main/CoderRootCommit.js
@@ -2,6 +2,7 @@ import React , { Component } from 'react';
import { Spin , Pagination } from 'antd';
import { getImageUrl } from 'educoder';
import { truncateCommitId } from '../common/util';
+import { AlignTop } from '../Component/layout';
import SelectBranch from '../Branch/Select';
import Nodata from '../Nodata';
@@ -132,10 +133,10 @@ class CoderRootCommit extends Component{
commitDatas && commitDatas.length > 0 && commitDatas.map((item,k)=>{
return(
-
- {truncateCommitId(`${item.sha}`)}
- {item.message}
-
+
+ {truncateCommitId(`${item.sha}`)}
+ {item.message}
+
{
item.id ?
diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js
index e87fd037..74aa512b 100644
--- a/src/forge/Merge/MergeItem.js
+++ b/src/forge/Merge/MergeItem.js
@@ -43,7 +43,7 @@ class MergeItem extends Component {
};
render() {
- const { issues, project_name, project_author_name } = this.props;
+ const { issues, project_name, project_author_name , user_admin_or_member} = this.props;
const { projectsId , owner } = this.props.match.params;
const { current_user } = this.props;
const renderList = () => {
@@ -177,7 +177,7 @@ class MergeItem extends Component {
) : (
""
)}
- {current_user && current_user.login ? (
+ {user_admin_or_member ? (
)
}
- mergeabledDesc=(base,head)=>{
+ mergeabledDesc=(base,head,conflict_files)=>{
return(
-
- - git fetch origin
- - git checkout -b {`${base}`} origin/{`${base}`}
- - git merge {`${head}`}
-
+
+
+ - git fetch origin
+ - git checkout -b {`${base}`} origin/{`${base}`}
+ - git merge {`${head}`}
+
+ {
+ conflict_files && conflict_files.length>0 &&
+
+
如下文件有代码冲突:
+
+ {
+ conflict_files.map((i,k)=>{
+ return k>0 ? ","+i : i
+ })
+ }
+
+
+ }
+
)
}
@@ -284,7 +301,8 @@ class MessageCount extends Component {
ismesrge,
SpinFlag,
copyVisible,
- pull_request
+ pull_request,
+ conflict_files
} = this.state;
const { current_user, projectDetail } = this.props;
const menu = (
@@ -495,7 +513,7 @@ class MessageCount extends Component {
}
diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js
index bcee5d0d..c0c7e5ce 100644
--- a/src/forge/Merge/merge.js
+++ b/src/forge/Merge/merge.js
@@ -155,7 +155,7 @@ class merge extends Component {
renderMenu = (array, name, id) => {
return (
-
-
this.islogin()}>
- + 新建合并请求
-
+ {
+ data && data.user_admin_or_member &&
+
this.checkOperation()}>
+ + 新建合并请求
+
+ }
@@ -402,6 +400,7 @@ class merge extends Component {
project_author_name={data.project_author_name}
{...this.props}
{...this.state}
+ user_admin_or_member={data && data.user_admin_or_member}
>
):""}
diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js
index 277f5d4a..644a653d 100644
--- a/src/forge/Order/Detail.js
+++ b/src/forge/Order/Detail.js
@@ -249,7 +249,7 @@ class Detail extends Component {
添加于 {data && data.created_at}
{data && data.user_permission ? (
-
+
复制
diff --git a/src/forge/Order/Milepost.js b/src/forge/Order/Milepost.js
index e6e63991..d87bfe0b 100644
--- a/src/forge/Order/Milepost.js
+++ b/src/forge/Order/Milepost.js
@@ -153,7 +153,7 @@ class Milepost extends Component {
const { data, limit, page, openselect, closeselect, spinings } = this.state;
const { projectsId , owner } = this.props.match.params;
const menu = (
-
+
到期日从近到远
到期日从远到近
完成度从低到高
diff --git a/src/forge/Order/MilepostDetail.js b/src/forge/Order/MilepostDetail.js
index 38303e5d..30526750 100644
--- a/src/forge/Order/MilepostDetail.js
+++ b/src/forge/Order/MilepostDetail.js
@@ -162,7 +162,7 @@ class MilepostDetail extends Component {
renderMenu = (array, name, id) => {
return (
-
+
this.getOption(e, id, name)}>{name}
{
array && array.length > 0 && array.map((item, key) => {
diff --git a/src/forge/Order/OrderItem.js b/src/forge/Order/OrderItem.js
index f7589c9c..3c5e5cf8 100644
--- a/src/forge/Order/OrderItem.js
+++ b/src/forge/Order/OrderItem.js
@@ -42,10 +42,9 @@ class OrderItem extends Component {
})
}
render() {
- const { item , checkbox , mile } = this.props;
+ const { item , checkbox , mile , user_admin_or_member } = this.props;
const { projectsId , owner } = this.props.match.params;
- const { current_user } = this.props
-
+ const { current_user } = this.props;
return (
item &&
@@ -91,7 +90,7 @@ class OrderItem extends Component {
{item.journals_count}
{
- current_user && current_user.login ?
+ user_admin_or_member ?
diff --git a/src/forge/Order/order.css b/src/forge/Order/order.css
index 7a357d4f..6a0f029e 100644
--- a/src/forge/Order/order.css
+++ b/src/forge/Order/order.css
@@ -592,7 +592,7 @@ a.issue-type-button.active:hover {
}
/* 发布人、指派人数量过多时要出现滚动条 */
-.ant-dropdown-menu {
+.ant-dropdown-menu.orderCondition {
max-height: 350px;
overflow-y: auto;
}
diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js
index 79a95bd2..48afbe52 100644
--- a/src/forge/Order/order.js
+++ b/src/forge/Order/order.js
@@ -201,7 +201,7 @@ class order extends Component {
renderMenu = (array, name, id, toGet) => {
return (
-
+
this.getOption(e, id, name, toGet)}>
{name}
@@ -347,17 +347,14 @@ class order extends Component {
this.props.showLoginDialog();
}
renderNew =()=>{
- const { projectsId , owner } = this.props.match.params;
- if (this.props.checkIfLogin()) {
+ const { data } = this.state;
+ if(data && data.user_admin_or_member){
+ const { projectsId , owner } = this.props.match.params;
return(
+ 创建易修
)
- }else{
- return(
- + 创建易修
- )
}
}
@@ -828,6 +825,7 @@ class order extends Component {
{...this.props}
{...this.state}
deletedetail={this.deletedetail}
+ user_admin_or_member={data && data.user_admin_or_member}
>
)
})}
diff --git a/src/forge/css/index.scss b/src/forge/css/index.scss
index 7f905ef5..917ebb18 100644
--- a/src/forge/css/index.scss
+++ b/src/forge/css/index.scss
@@ -87,6 +87,14 @@ ul,ol,dl{
flex-wrap: wrap;
align-items: center;
}
+.commitDesc{
+ flex:1;
+ margin-left:20px;
+ font-size:16px;
+ color:#333;
+ line-height:26px;
+ word-break: break-all;
+}
.normalBox{
border-radius: 4px;