From da7ff8c7492bd74331c547f8d054fe0b1acbfef5 Mon Sep 17 00:00:00 2001 From: yuzhantian <2205129388@qq.com> Date: Sat, 9 Oct 2021 16:39:47 +0800 Subject: [PATCH 01/25] =?UTF-8?q?refactor:=20=E5=90=88=E5=B9=B6=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=B7=AF=E7=94=B1=E6=94=B9=E9=80=A0=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=95=B0=E9=87=8Fbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Activity/ActivityItem.js | 2 +- src/forge/Main/Detail.js | 12 +- src/forge/Merge/MergeItem.js | 4 +- src/forge/Merge/MergeLinkFooter.jsx | 192 ++++++++++++++++++++++++ src/forge/Merge/MessageCount.js | 20 +-- src/forge/Merge/merge_form.js | 4 +- src/forge/comments/children_comments.js | 18 ++- src/forge/comments/comments.js | 9 +- 8 files changed, 236 insertions(+), 25 deletions(-) create mode 100644 src/forge/Merge/MergeLinkFooter.jsx diff --git a/src/forge/Activity/ActivityItem.js b/src/forge/Activity/ActivityItem.js index 2b1ad3c8c..48a72e797 100644 --- a/src/forge/Activity/ActivityItem.js +++ b/src/forge/Activity/ActivityItem.js @@ -27,7 +27,7 @@ class ActivityItem extends Component { : // 如果是合并请求

- {item.name} + {item.name} {item.trend_type}

} diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index a1a741496..868ad06fb 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -727,7 +727,17 @@ class Detail extends Component { (props) => () } > - () + } + > + () + } + > + () } diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index 884c50feb..eaa6ba0e0 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -62,7 +62,7 @@ class MergeItem extends Component {

@@ -175,7 +175,7 @@ class MergeItem extends Component { {item.journals_count ? ( {item.journals_count} diff --git a/src/forge/Merge/MergeLinkFooter.jsx b/src/forge/Merge/MergeLinkFooter.jsx new file mode 100644 index 000000000..104d2168b --- /dev/null +++ b/src/forge/Merge/MergeLinkFooter.jsx @@ -0,0 +1,192 @@ +import React, { Component } from 'react'; +import { Tabs, Spin } from 'antd'; +import { Link } from 'react-router-dom'; +import axios from 'axios'; + +import Commits from './Commits'; +import Comments from '../comments/comments'; +import Files from './Files'; + +import '../Order/order.css'; +import './merge.css'; + +const { TabPane } = Tabs; + +class MergeFooter extends Component { + constructor(props) { + super(props); + this.state = { + commitsData: undefined, + filesData: undefined, + isSpin: false, + activeKey: '1', + commitCount: 0, + filesCount: 0, + // 总评论数量,包含回复 + commentsTotalCount: 0, + }; + } + componentDidMount() { + this.Init(); + } + + componentDidUpdate(prevProps) { + // 解决切换tab后浏览器回退不刷新的问题、点击tab后url变化但tab未切换的问题 + const newPathname = this.props.location.pathname; + const prevPathname = prevProps.location.pathname; + if (newPathname !== prevPathname) { + this.Init(); + } + } + + Init = () => { + const { data, location, match } = this.props; + const { pathname } = location; + const { projectsId, owner, mergeId } = match.params; + + let activeKey = '1'; + if (pathname.indexOf('commits') > -1) { + activeKey = '2'; + this.getCommit(owner, projectsId, mergeId); + } else if (pathname.indexOf('files') > -1) { + activeKey = '3'; + this.getFile(owner, projectsId, mergeId); + } + this.setState({ + activeKey: activeKey, + commitCount: data && data.commits_count, + filesCount: data && data.files_count, + }); + }; + + getCommit = (owner, projectsId, mergeId) => { + this.setState({ isSpin: true }); + const url = `/${owner}/${projectsId}/pulls/${mergeId}/commits.json`; + axios + .get(url) + .then((result) => { + if (result) { + this.setState({ + commitsData: result.data.commits, + commitCount: result.data.commits_count, + }); + } + this.setState({ isSpin: false }); + }) + .catch((error) => { + this.setState({ isSpin: false }); + }); + }; + + getFile = (owner, projectsId, mergeId) => { + this.setState({ isSpin: true }); + const url = `/${owner}/${projectsId}/pulls/${mergeId}/files.json`; + axios + .get(url) + .then((result) => { + if (result) { + this.setState({ + filesData: result.data, + filesCount: result.data.files_count, + }); + } + this.setState({ isSpin: false }); + }) + .catch((error) => { + this.setState({ isSpin: false }); + }); + }; + + render() { + const { projectsId, owner, mergeId } = this.props.match.params; + + const { order_id, data = {} } = this.props; + const { + isSpin, + activeKey, + filesCount, + commitCount, + filesData, + commitsData, + } = this.state; + + // 评论数量优先取Comment组件中列表接口返回的,其次取合并请求详情接口中的,都没有取默认值0 + const commentsTotalCount = + this.state.commentsTotalCount || + (data.comments_total_count && parseInt(data.comments_total_count, 10)) || + 0; + + return ( +

+ + + + 评论 + {commentsTotalCount && ( + {commentsTotalCount} + )} + + } + key="1" + > + { + this.setState({ commentsTotalCount: commentsCount || 0 }); + }} + {...this.props} + /> + + + 提交 + {commitCount > 0 && ( + {commitCount} + )} + + } + key="2" + > + {commitsData && ( + + )} + + + 文件 + {filesCount > 0 && ( + {filesCount} + )} + + } + key="3" + > + + + + +
+ ); + } +} +export default MergeFooter; diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index b064e3c2f..fc021f813 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import { Tabs } from 'antd'; import { Link } from "react-router-dom"; -import { AlignCenter } from '../Component/layout'; import axios from "axios"; import { getImageUrl } from "educoder"; import { @@ -11,7 +10,6 @@ import { Dropdown, Icon, Menu, - Select, Tag, Button, Alert, @@ -19,9 +17,8 @@ import { import "./merge.css"; import RenderHtml from "../../components/render-html"; import "../Order/order.css"; -import MergeFooter from "./merge_footer"; +import MergeLinkFooter from "./MergeLinkFooter"; -const Option = Select.Option; const TextArea = Input.TextArea; function turnbar(str){ @@ -283,13 +280,13 @@ class MessageCount extends Component { conflict_files && conflict_files.length>0 &&

如下文件有代码冲突:

-

+

{ conflict_files.map((i,k)=>{ - return

{i}

+ return

{i}

}) } -

+
} @@ -543,7 +540,7 @@ class MessageCount extends Component { onChange={this.changbodypr} /> -

@@ -558,19 +555,18 @@ class MessageCount extends Component { 取消 -

+ )} - + > ) : ( "" diff --git a/src/forge/Merge/merge_form.js b/src/forge/Merge/merge_form.js index 5df9794bb..1f03a433e 100644 --- a/src/forge/Merge/merge_form.js +++ b/src/forge/Merge/merge_form.js @@ -195,7 +195,7 @@ class MergeForm extends Component { isSpin: false, }); this.props.history.push( - `/${owner}/${projectsId}/pulls/${mergeId}/Messagecount` + `/${owner}/${projectsId}/pulls/${mergeId}` ); } else { this.setState({ @@ -287,7 +287,7 @@ class MergeForm extends Component { type="default" className="ml30" onClick={()=>{ - this.props.history.push(merge_type === "new" ? `/${owner}/${projectsId}/pulls` : `/${owner}/${projectsId}/pulls/${mergeId}/detail`) + this.props.history.push(merge_type === "new" ? `/${owner}/${projectsId}/pulls` : `/${owner}/${projectsId}/pulls/${mergeId}`) }} > 取消 diff --git a/src/forge/comments/children_comments.js b/src/forge/comments/children_comments.js index 450a30f13..75330161a 100644 --- a/src/forge/comments/children_comments.js +++ b/src/forge/comments/children_comments.js @@ -17,6 +17,7 @@ class children_comments extends Component { page: 1, journal_spin: false, search_count: 0, + isSpin: false, }; } @@ -71,6 +72,9 @@ class children_comments extends Component { .then((result) => { if (result) { this.getChildrenJournals(); + // 删除回复后,如果需手动调用父组件查询评论列表的接口,以保持角标(评论数量)的一致(合并请求页面), + // 否则直接查顶级评论列表,否则只查询当前子评论列表(易修页面) + this.props.refreshCommentList && this.props.refreshCommentList(); } }) .catch((error) => { @@ -80,9 +84,15 @@ class children_comments extends Component { // 翻页 ChangePage = (page) => { - this.state.page = page; - this.state.isSpin = true; - this.getChildrenJournals(); + // this.state.page = page; + // this.state.isSpin = true; + // 使用回调的写法,这样在getChildrenJournals中使用的就是最新的state + this.setState({ + page, + isSpin: true + }, () => { + this.getChildrenJournals(); + }); }; commentCtx = (v) => { @@ -183,7 +193,7 @@ class children_comments extends Component { size="large" loading={isSpin} dataSource={journalsdata.issue_journals} - renderItem={(item) => {this.renderList(item)}} + renderItem={(item) => {this.renderList(item)}} /> {this.Paginations()} diff --git a/src/forge/comments/comments.js b/src/forge/comments/comments.js index c27bb12af..ceebb653c 100644 --- a/src/forge/comments/comments.js +++ b/src/forge/comments/comments.js @@ -151,6 +151,8 @@ class comments extends Component { isSpin: false, fileList: undefined, }); + const { updateCommentsNum } = this.props; + updateCommentsNum && updateCommentsNum(result.data.journals_total_count); } }) .catch((error) => { @@ -372,7 +374,7 @@ class comments extends Component { const renderList = (item) => { return ( -
+
@@ -500,7 +503,7 @@ class comments extends Component { loading={isSpin} header="" dataSource={journalsdata.issue_journals} - renderItem={(item) => {renderList(item)}} + renderItem={(item) => {renderList(item)}} /> )} {this.Paginations()} @@ -558,7 +561,7 @@ class comments extends Component { header="" dataSource={journalsdata.issue_journals} renderItem={(item) => ( - {renderList(item)} + {renderList(item)} )} /> )} From 112aacb6a107c01cc5543fdb5bbe2fdcd9e723d4 Mon Sep 17 00:00:00 2001 From: hucong <1422588487@qq.com> Date: Tue, 12 Oct 2021 11:49:04 +0800 Subject: [PATCH 02/25] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BA=93=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E9=A1=B5=E9=9D=A2=E6=A0=87=E7=AD=BE=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/tag/Index.jsx | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/forge/Main/tag/Index.jsx b/src/forge/Main/tag/Index.jsx index 458de69a0..4a0ce00a3 100644 --- a/src/forge/Main/tag/Index.jsx +++ b/src/forge/Main/tag/Index.jsx @@ -11,7 +11,7 @@ import moment from 'moment'; function Tags(props) { - const [ source , setSource ] = useState(undefined); + const [ source , setSource ] = useState([]); const [ isSpin , setIsSpin ] = useState(true); const { projectsId , owner } = props.match.params; @@ -104,19 +104,18 @@ function Tags(props) { return(
-
- - { - source && source.length > 0 && -
- } - { - source && source.length === 0 && - } -
-
+ { + source && source.length > 0 ? +
+ +
+
+
+ : + + }
) } From a09d330a7ed9f71bc58a8f1d8a52a96f4609269a Mon Sep 17 00:00:00 2001 From: yuzhantian <2205129388@qq.com> Date: Tue, 12 Oct 2021 16:12:16 +0800 Subject: [PATCH 03/25] =?UTF-8?q?refactor:=20=E6=96=B0=E5=BB=BA=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=AF=B7=E6=B1=82=E8=B7=AF=E7=94=B1=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 10 +- src/forge/Main/CoderDepot.jsx | 2 +- src/forge/Main/Detail.js | 20 +- src/forge/Main/tree/Index.jsx | 2 +- src/forge/Merge/CreateMerge.js | 413 ++++++++++++++++++++++++++++ src/forge/Merge/MergeLinkFooter.jsx | 10 +- src/forge/Merge/MessageCount.js | 2 +- src/forge/Merge/NewMerge.js | 4 +- src/forge/Merge/merge.js | 2 +- src/forge/Merge/merge_footer.js | 227 +++++---------- src/forge/Merge/merge_form.js | 3 +- src/forge/Merge/no_data.js | 2 +- 12 files changed, 514 insertions(+), 183 deletions(-) create mode 100644 src/forge/Merge/CreateMerge.js diff --git a/src/App.js b/src/App.js index 442d4f323..3072aca5b 100644 --- a/src/App.js +++ b/src/App.js @@ -97,10 +97,10 @@ const ProjectIndex = Loadable({ loading: Loading, }); -const CreateMerge = Loadable({ - loader: () => import('./forge/Merge/NewMerge'), - loading: Loading, -}) +// const CreateMerge = Loadable({ +// loader: () => import('./forge/Merge/NewMerge'), +// loading: Loading, +// }) // 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。 const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize"]; @@ -279,7 +279,7 @@ class App extends Component { } /> {/* 项目PR */} - () } diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 70d1901eb..df5e2449b 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -425,7 +425,7 @@ function CoderDepot(props){
{ baseOperate && - urlLink(`/${owner}/${projectsId}/pulls/new/${branchName || defaultBranch}`)} >+ 合并请求 + urlLink(`/${owner}/${projectsId}/compare/${branchName || defaultBranch}`)} >+ 合并请求 } { baseOper && diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index bc35344f4..70283d310 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -70,7 +70,7 @@ const MergeIndexDetail = Loadable({ }) const CreateMerge = Loadable({ - loader: () => import('../Merge/NewMerge'), + loader: () => import('../Merge/CreateMerge'), loading: Loading, }) @@ -150,7 +150,9 @@ function checkPathname(projectsId, owner, pathname) { name = "about" } else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) { name = "issues"; - } else if (url.indexOf("/pulls") > -1) { + } else if (url.indexOf("/pulls") > -1 || url.indexOf("/compare") > -1) { + // /pulls,合并请求除新建合并请求外, + // /compare,新建合并请求 name = "pulls" } else if (url.indexOf("/milestones") > -1) { name = "milestones" @@ -713,17 +715,17 @@ class Detail extends Component { } > {/* 新建合并请求 */} - () + } + > */} + () } > - () - } - > - () } diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index 84220a0bb..00953b052 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -91,7 +91,7 @@ function Index(props) {
{ (isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) && - + 合并请求 + + 合并请求 } 下载 diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js new file mode 100644 index 000000000..2ee29c39f --- /dev/null +++ b/src/forge/Merge/CreateMerge.js @@ -0,0 +1,413 @@ +import React, { Component } from 'react'; +import { Input, Select, Spin, Alert } from 'antd'; +import axios from 'axios'; +import MergeForm from './merge_form'; +import MergeFooter from './merge_footer'; + +import '../Order/order.css'; +import './merge.css'; + +/** + * 根据url获取目标仓库、目标分支、源仓库、源分支 + * 路由规则:owner/projectId/compare/merge...pullowner:pullBranch + * 可能存在的情况 + * 1、代码库首页跳转,仓库相同,目标分支为默认分支,owner/projectId/compare/pullBranch + * 2、代码库分支列表,仓库相同,目标分支为默认分支,owner/projectId/compare/pullBranch + * 3、合并请求列表页(新建、无数据时的提示),仓库相同,源、目标都为默认分支,owner/projectId/compare + * 4、新建页面,切换分支、切换目标仓库、刷新页面等,存在所有可能情况 + */ +function getBranchParams(pathname) { + const result = { + // 目标仓库所有者 + mergeOwner: undefined, + // 目标分支 + mergeBranch: 'master', + // 源仓库所有者 + pullOwner: undefined, + // 源分支 + pullBranch: 'master', + // 仓库名称 + projectId: undefined, + }; + // 去掉第一个字符/ + const _pathname = pathname.slice(1); + const [ownerProject, branchUrl] = _pathname.split('/compare'); + const [mergeOwner, projectId] = ownerProject.split('/'); + // 同仓库时 + result.mergeOwner = mergeOwner; + result.pullOwner = mergeOwner; + result.projectId = projectId; + if (branchUrl) { + // 如果存在具体的分支 + const _branchUrl = branchUrl.slice(1); + if (_branchUrl.indexOf('...') > -1) { + // 存在源分支与目标分支 + const [mergeBranch, pullObj] = _branchUrl.split('...'); + result.mergeBranch = mergeBranch; + if (pullObj.indexOf(':') > -1) { + // 存在源仓库 + const [pullOwner, pullBranch] = pullObj.split(':'); + result.pullOwner = pullOwner; + result.pullBranch = pullBranch; + } else { + result.pullBranch = pullObj; + } + } else { + result.pullBranch = _branchUrl; + } + } + return result; +} + +const Option = Select.Option; + +class CreateMerge extends Component { + constructor(props) { + super(props); + const { pullBranch, mergeBranch } = getBranchParams( + this.props.location.pathname + ); + this.state = { + data: undefined, + pullBranches: undefined, + mergeBranches: undefined, + mergeProjects: undefined, + merge: mergeBranch || 'master', + pull: pullBranch || 'master', + id: undefined, + // isFork: false, + projects_names: undefined, + isSpin: true, + showMessage: false, + merge_head: false, // 是否向fork后的源项目发起合并请求 + defaultMessage: '必须选择不同的分支', + project_id: undefined, // 当前项目的id,也即开始发送合并请求的源项目id + merge_project_user: undefined, + comparesData: undefined, //提交和文件的内容,保存compare接口返回的数据 + // 比较分支时的加载效果 + isCompareSpin: true, + // 是否是初次加载,用这个字段来控制提示组件和文件组件的显示、隐藏比直接用isCompareSpin交互友好些 + isFirstLoading: true, + }; + } + + componentDidMount = () => { + // 初始化时根据url获取目标仓库、分支,源仓库、分支; + // 再获取对应的仓库列表、分支列表 + // 再调用比较接口 + const branchParams = getBranchParams(this.props.location.pathname); + console.log('componentDidMount branchParams', branchParams); + this.getMergeInfo(branchParams); + }; + + componentDidUpdate = (preProps) => { + // url变化触发时(切换源分支、切换目标仓库、切换目标分支;回退) + const oldPathname = preProps.location.pathname; + const newPathname = this.props.location.pathname; + if (oldPathname !== newPathname) { + const branchParams = getBranchParams(newPathname); + console.log('componentDidUpdate branchParams', branchParams); + this.getMergeInfo(branchParams); + } + }; + + //获取新建合并请求数据 + getMergeInfo = (branchParams) => { + this.setState({ isSpin: true }); + const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = + branchParams; + const url = `/${pullOwner}/${projectId}/pulls/new.json`; + axios + .get(url) + .then((result) => { + if (result) { + this.setState({ + // isFork: result.data.is_fork, + projects_names: result.data.projects_names, + mergeProjects: result.data.merge_projects, + pullBranches: result.data.branches, + mergeBranches: result.data.branches, + project_id: result.data.project_id, + id: result.data.id, + merge: mergeBranch, + pull: pullBranch, + }); + } + if (pullOwner !== mergeOwner) { + this.getBranchList(mergeOwner, projectId); + } + this.compareProject(result.data.id, branchParams); + this.setState({ isSpin: false }); + }) + .catch((error) => { + this.setState({ isSpin: false }); + console.log(error); + }); + }; + + // compare接口,获取分支对比信息 + compareProject = (baseid, branchParams) => { + // const { project } = this.props; + // const { owner, projectsId } = this.props.match.params; + const projectObj = this.props.project; + const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = + branchParams; + + let url = `/${mergeOwner}/${projectId}/compare`; + if (projectObj) { + if (baseid === projectObj.id) { + url += `/${pullBranch}...${mergeBranch}.json`; + } else { + url += `/${mergeBranch}...${pullOwner}/${projectId}:${pullBranch}.json`; + } + this.setState({ isSpin: false, isCompareSpin: true }); + axios + .get(url) + .then((result) => { + if (result) { + if (result.data.status === 0) { + this.setState({ + showMessage: false, + }); + } else { + this.setState({ + showMessage: true, + defaultMessage: result.data.message, + }); + } + this.setState({ + comparesData: result.data, + }); + } + this.setState({ + isFirstLoading: false, + isSpin: false, + isCompareSpin: false, + }); + }) + .catch((error) => { + this.setState({ isSpin: false, isCompareSpin: false }); + }); + } + }; + + // 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询 + getBranchList = (login, projectId) => { + this.setState({ isSpin: true }); + const url = `/${login}/${projectId}/pulls/get_branches.json`; + axios + .get(url) + .then((result) => { + if (result) { + this.setState({ + mergeBranches: result.data, + }); + } + this.setState({ isSpin: false }); + }) + .catch((error) => { + this.setState({ isSpin: false }); + console.log(error); + }); + }; + + // 切换分支事件 + selectBrach = (type, value) => { + const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = + getBranchParams(this.props.location.pathname); + let _url = `/${mergeOwner}/${projectId}/compare/`; + // type为pull时,pullBranch取value,否则取原有值 + // type为pull时,mergeBranch取原有值,否则取value + let _pullBranch = type === 'pull' ? value : pullBranch; + let _mergeBranch = type === 'pull' ? mergeBranch : value; + if (pullOwner === mergeOwner) { + // 如果仓库相同, compare/目标分支...源分支 + _url += `${_mergeBranch}...${_pullBranch}`; + } else { + // 如果仓库不同, compare/目标分支...源分支 + _url += `${_mergeBranch}...${pullOwner}:${_pullBranch}`; + } + this.props.history.push(_url); + }; + + // 切换仓库响应事件,目前仅目标分支可切换仓库 + selectProjectName = (value) => { + const { projects_names, id } = this.state; + const { pullOwner, pullBranch } = getBranchParams( + this.props.location.pathname + ); + let arr = + projects_names && projects_names.filter((item) => item.id === value); + let identifier = arr && arr[0].project_id; + let login = arr && arr[0].project_user_login; + // 目标仓库与源仓库不是一个仓库 + let is_fork = parseInt(value, 10) !== parseInt(id, 10); + this.setState({ + isSpin: true, + // merge_head: is_fork, + data: { + is_original: is_fork, + fork_project_id: is_fork ? id : '', + merge_user_login: is_fork + ? projects_names[0].project_user_login + : undefined, + }, + }); + if (login === pullOwner) { + // 如果切换后, 仓库与源仓库一致了 + this.props.history.push( + `/${login}/${identifier}/compare/master...${pullBranch}` + ); + } else { + this.props.history.push( + `/${login}/${identifier}/compare/master...${pullOwner}:${pullBranch}` + ); + } + // this.newMergelist(login, identifier); + }; + + // 渲染分支列表 + renderBrances = (list) => { + if (list && list.length > 0) { + return list.map((item, key) => { + return ( + + ); + }); + } + }; + + // 渲染项目列表 + renderProjectNames = (list) => { + if (list && list.length > 0) { + return list.map((item, key) => { + return ( + + ); + }); + } + }; + + // 渲染html内容 + withHtml = (html) => { + return
; + }; + + render() { + const { + data, + pullBranches, + mergeBranches, + mergeProjects, + pull, + merge, + isSpin, + isCompareSpin, + isFirstLoading, + showMessage, + defaultMessage, + projects_names, + id, + comparesData, + } = this.state; + + let { project } = this.props; + + return ( +
+ +
+
+
+
源分支:
+ + + + +
+
+ +
+
+
+
目标分支:
+ + + + +
+
+
+ {/* 非加载状态且有提示 */} + {!isCompareSpin && showMessage && ( +
+ +
+ )} + {/* 非加载状态且可以提交 */} + {!isCompareSpin && !showMessage && ( + + )} +
+ {!isFirstLoading && ( + + )} +
+
+ ); + } +} + +export default CreateMerge; diff --git a/src/forge/Merge/MergeLinkFooter.jsx b/src/forge/Merge/MergeLinkFooter.jsx index 104d2168b..9f43086a9 100644 --- a/src/forge/Merge/MergeLinkFooter.jsx +++ b/src/forge/Merge/MergeLinkFooter.jsx @@ -111,10 +111,10 @@ class MergeFooter extends Component { } = this.state; // 评论数量优先取Comment组件中列表接口返回的,其次取合并请求详情接口中的,都没有取默认值0 - const commentsTotalCount = - this.state.commentsTotalCount || - (data.comments_total_count && parseInt(data.comments_total_count, 10)) || - 0; + const commentsTotalCount = parseInt( + this.state.commentsTotalCount || data.comments_total_count || 0, + 10 + ); return (
@@ -128,7 +128,7 @@ class MergeFooter extends Component { tab={ 评论 - {commentsTotalCount && ( + {commentsTotalCount > 0 && ( {commentsTotalCount} )} diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 6409bd7f1..abdea3dd4 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -445,7 +445,7 @@ class MessageCount extends Component { type="green" ghost className="ml20" - onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/UpdateMerge`);}} + onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/updatemerge`);}} > 编辑 diff --git a/src/forge/Merge/NewMerge.js b/src/forge/Merge/NewMerge.js index 8913b0d1c..c5c5e2df6 100644 --- a/src/forge/Merge/NewMerge.js +++ b/src/forge/Merge/NewMerge.js @@ -194,7 +194,7 @@ class NewMerge extends Component { // this.ischeckmerge(); let { id ,merge , pull } = this.state; if(type==="pull"){ - this.props.history.push(`/${owner}/${projectsId}/pulls/new/${pull}`) + this.props.history.push(`/${owner}/${projectsId}/compare/${pull}`) this.compareProject(id,value,merge); }else{ this.compareProject(id,pull,value); @@ -216,7 +216,7 @@ class NewMerge extends Component { merge_user_login: is_fork_id ? projects_names[0].project_user_login : undefined } }) - this.props.history.push(`/${login}/${identifier}/pulls/new`); + this.props.history.push(`/${login}/${identifier}/compare`); this.newMergelist(login,identifier); }; diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js index 399c9bd91..2e742d720 100644 --- a/src/forge/Merge/merge.js +++ b/src/forge/Merge/merge.js @@ -213,7 +213,7 @@ class merge extends Component { checkOperation() { const { projectsId,owner } = this.props.match.params; - this.props.history.push(`/${owner}/${projectsId}/pulls/new`); + this.props.history.push(`/${owner}/${projectsId}/compare`); } render() { const { projectsId , owner } = this.props.match.params; diff --git a/src/forge/Merge/merge_footer.js b/src/forge/Merge/merge_footer.js index 5e3a75560..868e736fe 100644 --- a/src/forge/Merge/merge_footer.js +++ b/src/forge/Merge/merge_footer.js @@ -1,169 +1,84 @@ -import React, { Component } from "react"; -import { Tabs, Spin } from "antd"; -import "../Order/order.css"; -import "./merge.css"; -import Commits from "./Commits"; -import Comments from "../comments/comments"; -import Files from "./Files"; -import axios from 'axios'; +import React, { Component } from 'react'; +import { Tabs } from 'antd'; +import Commits from './Commits'; +import Files from './Files'; + +import '../Order/order.css'; +import './merge.css'; + const { TabPane } = Tabs; class MergeFooter extends Component { - constructor(props){ + constructor(props) { super(props); - this.state={ - pageData:undefined, - commitsData:undefined, - filesData:undefined, - isSpin:false, - activeKey:"1", - commitCount:0, - filesCount:0 - } - } - componentDidMount=()=>{ - const { footer_type ,data } = this.props; - if(footer_type){ - const { projectsId , owner , mergeId } = this.props.match.params; - this.getCommit(owner,projectsId,mergeId); - this.getFile(owner,projectsId,mergeId); - } - this.setState({ - activeKey:footer_type ? "1" : "2", - commitCount:data && data.commits_count, - filesCount:data && data.files_count - }) - } - componentDidUpdate=(prevProps)=>{ - const { comparesData } = this.props; - const { footer_type } = this.props; - if(footer_type){ - const { data } = this.props; - if(data !== prevProps.data){ - this.setState({ - commitCount:data && data.commits_count, - filesCount:data && data.files_count - }) - } - } - if(comparesData !== prevProps.comparesData){ - this.setState({ - activeKey:footer_type ? "1" : "2" - }) - this.changeTab(footer_type ? "1" : "2"); - } + this.state = { + activeKey: '1', + }; } - changeTab=(index)=>{ + changeTab = (index) => { this.setState({ - isSpin:true - }) - this.setState({ - activeKey:index - }) - const { footer_type , comparesData } = this.props; - const { projectsId , owner , mergeId } = this.props.match.params; - - if(footer_type){ - if(index === "2"){ - this.getCommit(owner,projectsId,mergeId); - }else if(index === "3"){ - this.getFile(owner,projectsId,mergeId); - }else{ - this.setState({ - isSpin:false - }) - } - }else{ - this.setState({ - commitsData:comparesData.commits, - filesData:comparesData.diff, - commitCount:comparesData.commits_count, - filesCount:comparesData.diff && comparesData.diff.files_count, - isSpin:false - }) - } - } - - getCommit =(owner,projectsId,mergeId)=>{ - const url = `/${owner}/${projectsId}/pulls/${mergeId}/commits.json`; - axios.get(url).then(result=>{ - if(result){ - this.setState({ - commitsData:result.data.commits, - isSpin:false, - commitCount:result.data.commits_count - }) - } - }).catch(error=>{}) - } - - getFile =(owner,projectsId,mergeId)=>{ - const url = `/${owner}/${projectsId}/pulls/${mergeId}/files.json`; - axios.get(url).then(result=>{ - if(result){ - this.setState({ - filesData:result.data, - isSpin:false, - filesCount:result.data.files_count, - }) - } - }).catch(error=>{}) - } + activeKey: index, + }); + }; render() { - const { projectsId , owner } = this.props.match.params; + const { projectsId, owner } = this.props.match.params; + const { comparesData = {} } = this.props; + const { commits, diff, commits_count } = comparesData; + const { activeKey } = this.state; - const { footer_type, order_id, data , comparesData } = this.props; - let { isSpin , activeKey , filesCount, commitCount , filesData , commitsData } = this.state; - - return ( - !footer_type && !comparesData || (comparesData && ((comparesData.commits && comparesData.commits.length===0)||(comparesData && !comparesData.diff)) )?"": -
- - - { - footer_type && - 评论 - {data && parseInt(data.comments_count) > 0 && {data.comments_count}} - - } key="1"> - - - } - { - commitsData && commitsData.length > 0 && - 提交 - {commitCount > 0 && {commitCount}} - } key="2"> - - - } - { - filesData && filesData.files && filesData.files.length>0 && - 文件 - {filesCount > 0 && {filesCount}} - - } key="3"> - - - } - - - + return (commits && commits.length === 0) || !diff ? ( + '' + ) : ( +
+ + {commits && commits.length > 0 && ( + + 提交 + {commits_count > 0 && ( + {commits_count} + )} + + } + key="1" + > + + + )} + {diff && diff.files && diff.files.length > 0 && ( + + 文件 + {diff.files_count > 0 && ( + {diff.files_count} + )} + + } + key="3" + > + + + )} +
); } diff --git a/src/forge/Merge/merge_form.js b/src/forge/Merge/merge_form.js index 1f03a433e..4716bdfca 100644 --- a/src/forge/Merge/merge_form.js +++ b/src/forge/Merge/merge_form.js @@ -165,7 +165,8 @@ class MergeForm extends Component { this.setState({ isSpin: false, }); - this.props.history.push(`/${owner}/${projectsId}/pulls`); + const { pull_request_id } = result.data; + this.props.history.push(`/${owner}/${projectsId}/pulls/${pull_request_id}`); const { getDetail } = this.props; getDetail && getDetail(); } else { diff --git a/src/forge/Merge/no_data.js b/src/forge/Merge/no_data.js index d5584797f..f403bb4ea 100644 --- a/src/forge/Merge/no_data.js +++ b/src/forge/Merge/no_data.js @@ -12,7 +12,7 @@ class Nodata extends Component{

欢迎使用合并请求!

- 合并请求可以帮助您与他人协作编写代码。在使用之前,请先创建一个 合并请求 + 合并请求可以帮助您与他人协作编写代码。在使用之前,请先创建一个 合并请求
From fe4c5a79d2631e62334d4e32fafacf43a1ed3905 Mon Sep 17 00:00:00 2001 From: caishi Date: Wed, 13 Oct 2021 09:57:04 +0800 Subject: [PATCH 04/25] =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E5=8F=AF=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/edu-purge.css | 2 +- src/forge/Settings/Setting.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/public/css/edu-purge.css b/public/css/edu-purge.css index 1ec104461..0d146204c 100644 --- a/public/css/edu-purge.css +++ b/public/css/edu-purge.css @@ -2456,7 +2456,7 @@ a.hoverLine:hover{ .color-grey-9 { - color: #333333 !important; + color: #999 !important; } a:hover{ diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index ec9f80c83..460ec1620 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -161,12 +161,12 @@ class Setting extends Component { loading:false }) this.props.showNotification(`仓库信息修改成功!`); - // if(values.project_identifier !== projectsId){ - // this.props.history.push(`/${owner}/${values.project_identifier}/settings`); - // }else{ - // } + if(values.project_identifier !== projectsId){ + this.props.history.push(`/${owner}/${values.project_identifier}/settings`); + }else{ const { getDetail } = this.props; getDetail && getDetail(); + } } }).catch((error) => { console.log(error); @@ -288,7 +288,9 @@ class Setting extends Component { )}
- {/* + 项目标识 (项目url标识部分,更改项目标识将导致原仓库地址失效)} + > {getFieldDecorator("project_identifier", { rules: [ { @@ -299,7 +301,7 @@ class Setting extends Component { })( )} - */} + {getFieldDecorator("project_description", { rules: [], From a7c2120cf3c9f10390b68d161df2c678be8e30ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Wed, 13 Oct 2021 13:37:51 +0800 Subject: [PATCH 05/25] =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Head/Header.js | 7 +++---- src/forge/SecuritySetting/Index.jsx | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 59513153b..9e10a0ff7 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -367,7 +367,6 @@ class NewHeader extends Component { } let search_url = settings && settings.common && settings.common.search; - let notice_url = settings && settings.common && settings.common.notice; return (
@@ -438,7 +437,7 @@ class NewHeader extends Component { :"" } - {current_user && current_user.login ? + { settings && settings.common && settings.common.notice ? - + {current_user && - + } : "" diff --git a/src/forge/SecuritySetting/Index.jsx b/src/forge/SecuritySetting/Index.jsx index 8419fd31c..f897dea19 100644 --- a/src/forge/SecuritySetting/Index.jsx +++ b/src/forge/SecuritySetting/Index.jsx @@ -43,8 +43,9 @@ const PrivateLetter = Loadable({ }); function Index(props){ - const { current_user } = props; + const { current_user,mygetHelmetapi } = props; const { pathname } = props.location; + const notice_url = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice; return(
@@ -59,11 +60,11 @@ function Index(props){
  • 个人信息
  • -1 ?"active":""}>基本资料
  • -
      + {notice_url &&
      • 消息通知
      • -1 && pathname.indexOf("/settings/notice/config") == -1) || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}>我的通知
      • {/*
      • -1 ?"active":""}>通知管理
      • */} -
      +
    }
    • 安全设置
    • -1 ?"active":""}>SSH密钥
    • From 38c553d87c87048042a27560c781b057db1df4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Wed, 13 Oct 2021 15:14:47 +0800 Subject: [PATCH 06/25] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E9=9A=90=E8=97=8F=E6=B6=88=E6=81=AF=E9=93=83=E9=93=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Head/Header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 9e10a0ff7..ac139351e 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -437,7 +437,7 @@ class NewHeader extends Component { :"" } - { settings && settings.common && settings.common.notice ? + { (settings && settings.common && settings.common.notice) && (current_user && current_user.login)? Date: Wed, 13 Oct 2021 16:38:43 +0800 Subject: [PATCH 07/25] =?UTF-8?q?fix:=20pr=E8=B7=AF=E7=94=B1bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/CoderDepot.jsx | 2 +- src/forge/Main/Detail.js | 5 +- src/forge/Main/tree/Index.jsx | 2 +- src/forge/Merge/CreateMerge.js | 35 +++++++++-- src/forge/Merge/MergeDetail.js | 2 +- src/forge/Merge/MergeItem.js | 2 +- src/forge/Merge/MergeLinkFooter.jsx | 98 +++++++++++++++++------------ src/forge/Merge/MessageCount.js | 10 ++- src/forge/Merge/NewMerge.js | 5 ++ src/forge/Merge/UpdateMerge.js | 4 +- src/forge/Merge/merge.css | 3 +- src/forge/Merge/merge.js | 2 +- src/forge/Merge/no_data.js | 2 +- src/forge/comments/comments.js | 2 + 14 files changed, 118 insertions(+), 56 deletions(-) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 8784761fd..8dd5e4681 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -426,7 +426,7 @@ function CoderDepot(props){
      { baseOperate && - urlLink(`/${owner}/${projectsId}/compare/${branchName || defaultBranch}`)} >+ 合并请求 + urlLink(`/${owner}/${projectsId}/compare/master...${branchName || defaultBranch}`)} >+ 合并请求 } { baseOper && diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 70283d310..da6d93382 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -320,6 +320,9 @@ class Detail extends Component { const url = `/${owner}/${projectsId}/detail.json`; axios.get(url).then((result) => { if (result && result.data) { + if (result.data.status === 404) { + this.props.history.push('/nopage'); + } this.setState({ projectDetail: result.data, project_id: result.data.project_id, @@ -725,7 +728,7 @@ class Detail extends Component { (props) => () } > - () } diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index 00953b052..2fc574349 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -91,7 +91,7 @@ function Index(props) {
      { (isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) && - + 合并请求 + + 合并请求 } 下载 diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 2ee29c39f..0f6859071 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -121,6 +121,15 @@ class CreateMerge extends Component { .get(url) .then((result) => { if (result) { + // 如果url上的分支不存在,取默认值master + const noMergeBranch = + (result.data.branches || []).filter( + (branch) => branch.name === mergeBranch + ).length === 0; + const noPullBranch = + (result.data.branches || []).filter( + (branch) => branch.name === pullBranch + ).length === 0; this.setState({ // isFork: result.data.is_fork, projects_names: result.data.projects_names, @@ -132,11 +141,23 @@ class CreateMerge extends Component { merge: mergeBranch, pull: pullBranch, }); + + if (!noMergeBranch && !noPullBranch) { + this.compareProject(result.data.id, branchParams); + } else { + const _message = []; + noMergeBranch && _message.push('目标分支不存在'); + noPullBranch && _message.push('源分支不存在'); + this.setState({ + showMessage: true, + defaultMessage: _message.join(' , '), + isCompareSpin: false, + }); + } } if (pullOwner !== mergeOwner) { - this.getBranchList(mergeOwner, projectId); + this.getBranchList(branchParams); } - this.compareProject(result.data.id, branchParams); this.setState({ isSpin: false }); }) .catch((error) => { @@ -192,15 +213,19 @@ class CreateMerge extends Component { }; // 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询 - getBranchList = (login, projectId) => { + getBranchList = ({ mergeOwner, projectId, mergeBranch }) => { this.setState({ isSpin: true }); - const url = `/${login}/${projectId}/pulls/get_branches.json`; + const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`; axios .get(url) .then((result) => { if (result) { + const noMergeBranch = + (result.data || []).filter((branch) => branch.name === mergeBranch) + .length === 0; this.setState({ mergeBranches: result.data, + merge: noMergeBranch ? 'master' : mergeBranch, }); } this.setState({ isSpin: false }); @@ -319,7 +344,7 @@ class CreateMerge extends Component { return (
      - +
      diff --git a/src/forge/Merge/MergeDetail.js b/src/forge/Merge/MergeDetail.js index 76c31ba0a..11bd3858b 100644 --- a/src/forge/Merge/MergeDetail.js +++ b/src/forge/Merge/MergeDetail.js @@ -228,7 +228,7 @@ class MergeDetail extends Component {
      { data && data.issue.user_permission ? - 编辑 + 编辑 : '' }
      diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index eaa6ba0e0..dadd6d8a5 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -196,7 +196,7 @@ class MergeItem extends Component { >
      diff --git a/src/forge/Merge/MergeLinkFooter.jsx b/src/forge/Merge/MergeLinkFooter.jsx index 9f43086a9..2c9aa4814 100644 --- a/src/forge/Merge/MergeLinkFooter.jsx +++ b/src/forge/Merge/MergeLinkFooter.jsx @@ -16,7 +16,7 @@ class MergeFooter extends Component { constructor(props) { super(props); this.state = { - commitsData: undefined, + commitsData: [], filesData: undefined, isSpin: false, activeKey: '1', @@ -28,6 +28,8 @@ class MergeFooter extends Component { } componentDidMount() { this.Init(); + // 为父组件绑定当前,以方便调用方法 + this.props.bindFootRef && this.props.bindFootRef(this); } componentDidUpdate(prevProps) { @@ -35,11 +37,11 @@ class MergeFooter extends Component { const newPathname = this.props.location.pathname; const prevPathname = prevProps.location.pathname; if (newPathname !== prevPathname) { - this.Init(); + this.Init(true); } } - Init = () => { + Init = (isTabChange) => { const { data, location, match } = this.props; const { pathname } = location; const { projectsId, owner, mergeId } = match.params; @@ -52,6 +54,9 @@ class MergeFooter extends Component { activeKey = '3'; this.getFile(owner, projectsId, mergeId); } + if (isTabChange && activeKey === '1') { + this.refreshComment(); + } this.setState({ activeKey: activeKey, commitCount: data && data.commits_count, @@ -59,6 +64,14 @@ class MergeFooter extends Component { }); }; + bindCommentRef = (commentRef) => { + this.childComment = commentRef; + } + + refreshComment = () => { + this.childComment && this.childComment.getjournalslist(); + } + getCommit = (owner, projectsId, mergeId) => { this.setState({ isSpin: true }); const url = `/${owner}/${projectsId}/pulls/${mergeId}/commits.json`; @@ -107,7 +120,7 @@ class MergeFooter extends Component { filesCount, commitCount, filesData, - commitsData, + commitsData = [], } = this.state; // 评论数量优先取Comment组件中列表接口返回的,其次取合并请求详情接口中的,都没有取默认值0 @@ -117,7 +130,7 @@ class MergeFooter extends Component { ); return ( -
      +
      - - 提交 - {commitCount > 0 && ( - {commitCount} - )} - - } - key="2" - > - {commitsData && ( - 0 && ( + + 提交 + {commitCount > 0 && ( + {commitCount} + )} + + } + key="2" + > + {commitsData.length > 0 && ( + + )} + + )} + {filesCount > 0 && ( + + 文件 + {filesCount > 0 && ( + {filesCount} + )} + + } + key="3" + > + - )} - - - 文件 - {filesCount > 0 && ( - {filesCount} - )} - - } - key="3" - > - - + /> + + )}
      diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index abdea3dd4..685f42355 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -58,6 +58,11 @@ class MessageCount extends Component { // this.clickBody(); }; + + bindFootRef = (footRef) => { + this.footRef = footRef; + } + clickBody=()=>{ document.body.addEventListener('click', e => { let name = e.target.className; @@ -147,6 +152,8 @@ class MessageCount extends Component { }); const { getDetail } = this.props; getDetail && getDetail(); + // 调用子组件的方法刷新评论列表 + this.footRef && this.footRef.refreshComment(); } else { this.setState({ SpinMerge: false }); } @@ -445,7 +452,7 @@ class MessageCount extends Component { type="green" ghost className="ml20" - onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/updatemerge`);}} + onClick={()=>{this.props.history.push(`/${owner}/${projectsId}/pulls/${mergeId}/edit`);}} > 编辑 @@ -566,6 +573,7 @@ class MessageCount extends Component { order_id={data && data.issue.id} {...this.props} {...this.state} + bindFootRef={this.bindFootRef} >
      ) : ( diff --git a/src/forge/Merge/NewMerge.js b/src/forge/Merge/NewMerge.js index c5c5e2df6..900dea824 100644 --- a/src/forge/Merge/NewMerge.js +++ b/src/forge/Merge/NewMerge.js @@ -6,6 +6,11 @@ import "./merge.css"; import MergeForm from "./merge_form"; import MergeFooter from "./merge_footer"; const Option = Select.Option; +/** + * 此文件已废弃,新文件为CreateMerge.js + * 2021.10.12 + */ + class NewMerge extends Component { constructor(props) { super(props); diff --git a/src/forge/Merge/UpdateMerge.js b/src/forge/Merge/UpdateMerge.js index 8ed8034af..001bedd57 100644 --- a/src/forge/Merge/UpdateMerge.js +++ b/src/forge/Merge/UpdateMerge.js @@ -69,7 +69,7 @@ class UpdateMerge extends Component { {" "} {" "} @@ -88,7 +88,7 @@ class UpdateMerge extends Component { {" "} {" "} diff --git a/src/forge/Merge/merge.css b/src/forge/Merge/merge.css index d5ce68d19..3ea2620cb 100644 --- a/src/forge/Merge/merge.css +++ b/src/forge/Merge/merge.css @@ -211,5 +211,6 @@ form .ant-cascader-picker, form .ant-select { } .mergeRequest .folders{ - width: 72rem; + /* width: 72rem; */ + width: 100%; } \ No newline at end of file diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js index 2e742d720..8a0eaedea 100644 --- a/src/forge/Merge/merge.js +++ b/src/forge/Merge/merge.js @@ -213,7 +213,7 @@ class merge extends Component { checkOperation() { const { projectsId,owner } = this.props.match.params; - this.props.history.push(`/${owner}/${projectsId}/compare`); + this.props.history.push(`/${owner}/${projectsId}/compare/master...master`); } render() { const { projectsId , owner } = this.props.match.params; diff --git a/src/forge/Merge/no_data.js b/src/forge/Merge/no_data.js index f403bb4ea..d5e4ca89b 100644 --- a/src/forge/Merge/no_data.js +++ b/src/forge/Merge/no_data.js @@ -12,7 +12,7 @@ class Nodata extends Component{

      欢迎使用合并请求!

      - 合并请求可以帮助您与他人协作编写代码。在使用之前,请先创建一个 合并请求 + 合并请求可以帮助您与他人协作编写代码。在使用之前,请先创建一个 合并请求
      diff --git a/src/forge/comments/comments.js b/src/forge/comments/comments.js index ceebb653c..dca7581f2 100644 --- a/src/forge/comments/comments.js +++ b/src/forge/comments/comments.js @@ -35,6 +35,8 @@ class comments extends Component { componentDidMount = () => { this.getjournalslist(); + // 给父组件绑定,以使父组件可以使用组件内方法,用于切换tab时重新请求评论列表、合并请求完之后重新请求评论列表 + this.props.bindCommentRef && this.props.bindCommentRef(this); }; //添加评论 From 5c819070bb34b3f00ce19b43db14e3deff0bdf57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Wed, 13 Oct 2021 16:45:21 +0800 Subject: [PATCH 08/25] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=9C=AA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=8A=B6=E6=80=81=E4=B8=8B=E5=9C=B0=E5=9D=80=E6=A0=8F?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E8=B7=B3=E8=BD=AC=E6=B6=88=E6=81=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecuritySetting/notice/myNotice/Index.jsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 2de2b8c3f..2dac567f8 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -9,10 +9,9 @@ import './Index.scss'; import '../manager/Index.scss' function MyNotice(props) { - let current_user = props.current_user; - let resetUserInfo = props.resetUserInfo; + let { current_user, resetUserInfo, location, mygetHelmetapi, history}= props; //消息悬停框选择tab - let popover = props.location.query && props.location.query.noticeType; + let popover = location && location.query && location.query.noticeType; let pageSize = 15; const [noticeType, setNoticeType] = useState(popover==="atme"?"2":"0");//消息类别tab栏选择 const [selectedNum, setSelectedNum] = useState(0);//@我批量删除选择消息条数 @@ -27,6 +26,17 @@ function MyNotice(props) { const [currentPage, setCurrentPage] = useState(1);//当前页数 const [onlyUnread, setOnlyUnread] = useState(); + //登录情况下,通过地址访问,直接跳转:/settings/profile + //未登录情况下,通过地址访问,直接跳转:/explore + useEffect(()=>{ + let notice_url = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice; + if(!current_user){ + history.push(`/explore`); + }else if(!notice_url){ + history.push(`/settings/profile`); + } + },[mygetHelmetapi]) + useEffect(()=>{ popover==="atme" ? setNoticeType("2"):setNoticeType("0"); },[popover]) @@ -46,7 +56,7 @@ function MyNotice(props) { limit: pageSize, page: currentPage, }; - axios.get(`/users/${current_user.login}/messages.json`, { + current_user && axios.get(`/users/${current_user.login}/messages.json`, { params: params, }).then((response) => { if(response && response.data){ @@ -59,7 +69,7 @@ function MyNotice(props) { } function readNotice(id){ - if(id){ + if(id && current_user){ const params = { type: noticeType === "0" ? "notification" : noticeType === "2" ? "atme" : "", ids:id, From 5d19f6c06b8fa5860458859a4c85747782936228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Wed, 13 Oct 2021 17:17:51 +0800 Subject: [PATCH 09/25] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E8=BF=9B=E5=85=A5=E6=B6=88=E6=81=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/SecuritySetting/notice/myNotice/Index.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 2dac567f8..226606919 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -29,10 +29,11 @@ function MyNotice(props) { //登录情况下,通过地址访问,直接跳转:/settings/profile //未登录情况下,通过地址访问,直接跳转:/explore useEffect(()=>{ - let notice_url = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice; - if(!current_user){ + let notice = mygetHelmetapi && mygetHelmetapi.common && mygetHelmetapi.common.notice; + let login = current_user && current_user.login; + if(!login){ history.push(`/explore`); - }else if(!notice_url){ + }else if(!notice){ history.push(`/settings/profile`); } },[mygetHelmetapi]) From 05eb0367ba4bad34274b16b85bc61123a75d5b40 Mon Sep 17 00:00:00 2001 From: hucong <1422588487@qq.com> Date: Thu, 14 Oct 2021 09:43:00 +0800 Subject: [PATCH 10/25] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A4=8D=E5=88=BB?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/Detail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 4e1c241b5..157b0e26c 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -552,7 +552,7 @@ class Detail extends Component { - 复刻 + 复刻(Fork) { From bb6fe08c54070dbc7cd682263864592b604880d8 Mon Sep 17 00:00:00 2001 From: hucong <1422588487@qq.com> Date: Thu, 14 Oct 2021 10:00:51 +0800 Subject: [PATCH 11/25] file --- src/forge/Main/CoderDepot.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index c86e31d94..f2e4e149a 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -402,7 +402,7 @@ function CoderDepot(props){ getPathUrl={getPathUrl} /> : -
      + @@ -417,7 +417,7 @@ function CoderDepot(props){ {projectDetail && projectDetail.tags && projectDetail.tags.total_count} -
      + } From f6b59e0a3a730b8232253ed092e14b85d6b8209d Mon Sep 17 00:00:00 2001 From: hucong <1422588487@qq.com> Date: Thu, 14 Oct 2021 10:20:36 +0800 Subject: [PATCH 12/25] save --- src/forge/Main/tag/Index.jsx | 21 +++++++++++---------- src/forge/Main/tag/Index.scss | 4 ---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/forge/Main/tag/Index.jsx b/src/forge/Main/tag/Index.jsx index 4eeb4efeb..a3cf69cc0 100644 --- a/src/forge/Main/tag/Index.jsx +++ b/src/forge/Main/tag/Index.jsx @@ -119,18 +119,19 @@ function Tags(props) { return(
      - { - source && source.length > 0 ? +
      - -
      -
      + { + source && source.length > 0 && +
      + } + { + source && source.length === 0 && + }
      - : - - } +
      ) } diff --git a/src/forge/Main/tag/Index.scss b/src/forge/Main/tag/Index.scss index 70e83a837..6adba91e3 100644 --- a/src/forge/Main/tag/Index.scss +++ b/src/forge/Main/tag/Index.scss @@ -39,10 +39,6 @@ } .tagSpin{ min-height: 300px; - text-align: center; - display: flex; - align-items: center; - justify-content: center; } .tagBranch{ padding-right: 15px; From 47b6c3d9481d446700036557db0e6ec3f5a39fc9 Mon Sep 17 00:00:00 2001 From: hucong <1422588487@qq.com> Date: Thu, 14 Oct 2021 10:21:47 +0800 Subject: [PATCH 13/25] save --- src/forge/Main/tag/Index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Main/tag/Index.jsx b/src/forge/Main/tag/Index.jsx index a3cf69cc0..ff7648513 100644 --- a/src/forge/Main/tag/Index.jsx +++ b/src/forge/Main/tag/Index.jsx @@ -12,7 +12,7 @@ import moment from 'moment'; function Tags(props) { - const [ source , setSource ] = useState([]); + const [ source , setSource ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); const { projectsId , owner } = props.match.params; From fbbb3c3aa612d761c60d6b8f8a67d798e181d14f Mon Sep 17 00:00:00 2001 From: caishi Date: Thu, 14 Oct 2021 10:28:41 +0800 Subject: [PATCH 14/25] =?UTF-8?q?markdown=E6=96=87=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=BD=B1=E5=93=8D=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/courses/css/Courses.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/courses/css/Courses.css b/src/modules/courses/css/Courses.css index cf5f1783e..0d550a5c0 100644 --- a/src/modules/courses/css/Courses.css +++ b/src/modules/courses/css/Courses.css @@ -298,7 +298,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket { .CodeMirror-scroll { overflow: scroll !important; margin-bottom: -30px; - margin-right: -30px; + margin-right: -30px!important; padding-bottom: 30px; height: 100%; outline: none; From 1826c1923ffc21e258952e9f64bff724100cdae5 Mon Sep 17 00:00:00 2001 From: hucong <1422588487@qq.com> Date: Thu, 14 Oct 2021 10:45:39 +0800 Subject: [PATCH 15/25] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A4=8D=E5=88=BB?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/sub/DetailBanner.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx index 5e3ab9440..22a5ce419 100644 --- a/src/forge/Main/sub/DetailBanner.jsx +++ b/src/forge/Main/sub/DetailBanner.jsx @@ -50,7 +50,7 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa - 易修 + 易修(Issue) {projectDetail && projectDetail.issues_count ? {numFormat(projectDetail.issues_count)} : ""} From c386bcf5e73b710d442f5e83ddd9a05285db5554 Mon Sep 17 00:00:00 2001 From: caishi Date: Thu, 14 Oct 2021 13:59:03 +0800 Subject: [PATCH 16/25] =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B9=9F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=98=BE=E7=A4=BA=E3=80=81=E6=A0=B7=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Activity/Activity.js | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index 0272f0652..0450e462c 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -10,6 +10,10 @@ import ActivityItem from './ActivityItem'; import axios from 'axios'; const LIMIT = 15; const ARRAY = [ + { + id:"", + name:'全部' + }, { id:1, name:'1天' @@ -32,7 +36,7 @@ class Activity extends Component{ constructor(props){ super(props); this.state={ - time:'30', + time:undefined, type:undefined, state:undefined, page:1, @@ -65,6 +69,7 @@ class Activity extends Component{ project_trends:result.data.project_trends, isSpin:false }) + window.scrollTo(0,0); } }).catch(error=>{ console.log(error); @@ -74,19 +79,19 @@ class Activity extends Component{ // 切换周期 changeTime=(e)=>{ this.setState({ - time:e.key, + time:e.key ==="item_0"?undefined:e.key, isSpin:true }) const { type,status,page } = this.state; - this.getInfo(e.key,type,status,page); + this.getInfo(e.key ==="item_0"?undefined:e.key,type,status,page); } //筛选 changeTrends=(type,status)=>{ this.setState({ - type,status + type,status,page:1 }) - const {time,page}=this.state; - this.getInfo(time,type,status,page); + const {time}=this.state; + this.getInfo(time,type,status,1); } // 分页 ChangePage=(page)=>{ @@ -109,11 +114,11 @@ class Activity extends Component{ ) render(){ const { time , data , page , project_trends , isSpin } = this.state; - - let name = time && ARRAY.filter(item=>item.id === parseInt(time)) ; - const second_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%'; - const third_per = (parseInt(data && data.close_issues_count)/parseInt(data && data.issues_count)*100)+'%'; - const fourth_per = (parseInt(data && data.open_issues_count)/parseInt(data && data.issues_count)*100)+'%'; + let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}]; + const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%'; + const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%'; + const third_per =data && (parseInt(data.close_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%'; + const fourth_per =data && (parseInt(data.open_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%'; return(
      @@ -122,7 +127,7 @@ class Activity extends Component{
      -

      +

      {data && data.pr_all_count}合并请求 @@ -132,7 +137,7 @@ class Activity extends Component{

      - {data && data.issues_count}任务 + {data && data.issues_count}易修
        @@ -146,11 +151,11 @@ class Activity extends Component{
      • {data && data.close_issues_count} - this.changeTrends("Issue","close")}>已关闭的任务 + this.changeTrends("Issue","close")}>已关闭的易修
      • {data && data.open_issues_count} - this.changeTrends("Issue","create")}>未处理的任务 + this.changeTrends("Issue","create")}>未处理的易修
      From bb1175de01d1f748a3f6606676723d27ec3b716f Mon Sep 17 00:00:00 2001 From: caishi Date: Thu, 14 Oct 2021 14:28:20 +0800 Subject: [PATCH 17/25] =?UTF-8?q?setting=E4=BF=AE=E6=94=B9=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E6=97=B6=E8=A6=81=E9=9A=90=E8=97=8F=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Settings/Setting.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index 460ec1620..deccb3daf 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -157,9 +157,6 @@ class Setting extends Component { ...values, }).then((result) => { if (result) { - this.setState({ - loading:false - }) this.props.showNotification(`仓库信息修改成功!`); if(values.project_identifier !== projectsId){ this.props.history.push(`/${owner}/${values.project_identifier}/settings`); @@ -168,8 +165,10 @@ class Setting extends Component { getDetail && getDetail(); } } + this.setState({ + loading:false + }) }).catch((error) => { - console.log(error); this.setState({ loading:false }) From 1aa6c0586917e4eb6d040409a62682b27e846a6b Mon Sep 17 00:00:00 2001 From: caishi Date: Thu, 14 Oct 2021 14:55:35 +0800 Subject: [PATCH 18/25] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=AF=94=E4=BE=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Activity/Activity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index 0450e462c..99eaa332b 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -115,8 +115,8 @@ class Activity extends Component{ render(){ const { time , data , page , project_trends , isSpin } = this.state; let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}]; - const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%'; - const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_count+data.new_pr_count)*100).toFixed(2)+'%'; + const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_all_count)*100).toFixed(2)+'%'; + const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_all_count)*100).toFixed(2)+'%'; const third_per =data && (parseInt(data.close_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%'; const fourth_per =data && (parseInt(data.open_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%'; return( From 95050bb3bd2cda20b772ba5d2e8ff9ee204072eb Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 15 Oct 2021 10:54:26 +0800 Subject: [PATCH 19/25] =?UTF-8?q?=E9=9D=9E.git=E7=BB=93=E5=B0=BE=E7=9A=84?= =?UTF-8?q?=E4=B9=9F=E9=9C=80=E8=A6=81=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/New/Index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index c6eb2c3d5..e9aa1f952 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -285,12 +285,16 @@ class Index extends Component { if(value.indexOf("/") > -1){ let arr = value.split("/"); let first = arr[arr.length-1]; - if(first.indexOf(".git") > -1){ + if(first.indexOf(".") > -1){ let second = first.split('.')[0]; if(!second)return; this.props.form.setFieldsValue({ repository_name:second }) + }else{ + this.props.form.setFieldsValue({ + repository_name:first + }) } } } @@ -351,7 +355,7 @@ class Index extends Component { required: true, message: '请填写镜像版本库地址' }], })( - + )}

      示例:https://github.com/facebook/reack.git

      From 35110b7db4b8f46e0a8b652cd567dd8abaa4d12e Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 15 Oct 2021 14:15:23 +0800 Subject: [PATCH 20/25] =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Activity/Activity.js | 4 ++-- src/forge/Main/Index.scss | 6 +++--- src/forge/Newfile/m_editor.js | 13 +++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index 99eaa332b..a05385521 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -143,11 +143,11 @@ class Activity extends Component{
      • {data && data.pr_count} - this.changeTrends("PullRequest","close")}>已处理的合并请求 + this.changeTrends("PullRequest","delay")}>已处理的合并请求
      • {data && data.new_pr_count} - this.changeTrends("PullRequest","create")}>未处理的合并请求 + this.changeTrends("PullRequest","not_delay")}>未处理的合并请求
      • {data && data.close_issues_count} diff --git a/src/forge/Main/Index.scss b/src/forge/Main/Index.scss index 4ec6a7cb6..5f3692929 100644 --- a/src/forge/Main/Index.scss +++ b/src/forge/Main/Index.scss @@ -480,7 +480,7 @@ } } .ant-anchor-wrapper{ - padding-left: 2px; + padding-left: 2px!important; .ant-anchor-ink::before{ background-color: #fff; } @@ -490,8 +490,8 @@ margin:0px auto; } .griditemAnchor{ - margin-left: 0px; - padding: 0px; + margin-left: 0px!important; + padding: 0px!important; border-bottom: 1px solid #ddd; .ant-anchor{ display: flex; diff --git a/src/forge/Newfile/m_editor.js b/src/forge/Newfile/m_editor.js index 242f7e0d3..13d2ec466 100644 --- a/src/forge/Newfile/m_editor.js +++ b/src/forge/Newfile/m_editor.js @@ -1,5 +1,7 @@ import React, { Component } from "react"; import Editor from "react-monaco-editor"; +// import {UnControlled as CodeMirror} from 'react-codemirror2' + import UserSubmitComponent from "./UserSubmitComponent"; import "./index.css"; @@ -103,6 +105,17 @@ class m_editor extends Component { editorWillMount={this.editorWillMount} editorDidMount={handleEditorMount} /> + {/* */}
      {!readOnly && (
      From 8ace7da3a74a078fb9555e6989e92cadc10c1d37 Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 15 Oct 2021 14:40:40 +0800 Subject: [PATCH 21/25] =?UTF-8?q?=E5=90=8C=E4=B8=8A-=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Activity/Activity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index a05385521..fed2992ae 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -151,11 +151,11 @@ class Activity extends Component{
    • {data && data.close_issues_count} - this.changeTrends("Issue","close")}>已关闭的易修 + this.changeTrends("Issue","delay")}>已关闭的易修
    • {data && data.open_issues_count} - this.changeTrends("Issue","create")}>未处理的易修 + this.changeTrends("Issue","not_delay")}>未处理的易修
    From b30f2169e45d7d23a2d6cdb98d3353159a760f66 Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 15 Oct 2021 15:20:21 +0800 Subject: [PATCH 22/25] =?UTF-8?q?=E6=95=B0=E6=8D=AEstate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Activity/Activity.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/forge/Activity/Activity.js b/src/forge/Activity/Activity.js index fed2992ae..4a7a1d345 100644 --- a/src/forge/Activity/Activity.js +++ b/src/forge/Activity/Activity.js @@ -40,6 +40,11 @@ class Activity extends Component{ type:undefined, state:undefined, page:1, + pr_count:undefined, + new_pr_count:undefined, + close_issues_count:undefined, + open_issues_count:undefined, + pr_all_count:undefined,issues_count:undefined, data:undefined, project_trends:undefined, @@ -67,7 +72,13 @@ class Activity extends Component{ this.setState({ data:result.data, project_trends:result.data.project_trends, - isSpin:false + isSpin:false, + pr_count:result.data.pr_count, + new_pr_count:result.data.new_pr_count, + close_issues_count:result.data.close_issues_count, + open_issues_count:result.data.open_issues_count, + pr_all_count:result.data.pr_all_count, + issues_count:result.data.issues_count, }) window.scrollTo(0,0); } @@ -113,12 +124,14 @@ class Activity extends Component{ ) render(){ - const { time , data , page , project_trends , isSpin } = this.state; + const { time , data , page , project_trends , isSpin , pr_count , new_pr_count , close_issues_count , open_issues_count , pr_all_count ,issues_count } = this.state; let name = time ? ARRAY.filter(item=>item.id === parseInt(time)) :[{name:"全部"}]; - const first_per = data && (parseInt(data.pr_count)/parseInt(data.pr_all_count)*100).toFixed(2)+'%'; - const second_per =data && (parseInt(data.new_pr_count)/parseInt(data.pr_all_count)*100).toFixed(2)+'%'; - const third_per =data && (parseInt(data.close_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%'; - const fourth_per =data && (parseInt(data.open_issues_count)/parseInt(data.issues_count)*100).toFixed(2)+'%'; + + const first_per = pr_all_count > 0 ? `${parseFloat(pr_count/pr_all_count).toFixed(2)*100}%` :"50%"; + const second_per =pr_all_count > 0 ? `${parseFloat(new_pr_count/pr_all_count).toFixed(2)*100}%` :"50%"; + const third_per =issues_count > 0 ?`${parseFloat(close_issues_count/issues_count).toFixed(2)*100}%` :"50%"; + const fourth_per =issues_count > 0 ?`${parseFloat(open_issues_count/issues_count).toFixed(2)*100}%` :"50%"; + return(
    From 66108083fd2e207e5a200d1edd754e141eadbff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 15 Oct 2021 15:22:22 +0800 Subject: [PATCH 23/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82=E9=A1=B5=E9=9D=A2=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E5=88=86=E6=94=AF=E5=AD=98=E5=9C=A8=E4=BD=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=AD=98=E5=9C=A8bug=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E6=96=87=E4=BB=B6=E6=8C=89=E9=92=AE=E4=B8=8A?= =?UTF-8?q?=E7=A7=BB=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/Diff.jsx | 4 ++-- src/forge/Merge/CreateMerge.js | 33 ++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/forge/Main/Diff.jsx b/src/forge/Main/Diff.jsx index 6556023e3..8dad59fba 100644 --- a/src/forge/Main/Diff.jsx +++ b/src/forge/Main/Diff.jsx @@ -21,8 +21,8 @@ const Infos = styled.div` & .markdown-body table{ background: #f1f8ff; } - & .f-wrap-between{ - align-items: center; + & .btnblue{ + margin-top: 12px; } & .task-hide{ width: 65rem; diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 0f6859071..c335d79fd 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -96,7 +96,6 @@ class CreateMerge extends Component { // 再获取对应的仓库列表、分支列表 // 再调用比较接口 const branchParams = getBranchParams(this.props.location.pathname); - console.log('componentDidMount branchParams', branchParams); this.getMergeInfo(branchParams); }; @@ -106,7 +105,6 @@ class CreateMerge extends Component { const newPathname = this.props.location.pathname; if (oldPathname !== newPathname) { const branchParams = getBranchParams(newPathname); - console.log('componentDidUpdate branchParams', branchParams); this.getMergeInfo(branchParams); } }; @@ -142,22 +140,29 @@ class CreateMerge extends Component { pull: pullBranch, }); - if (!noMergeBranch && !noPullBranch) { - this.compareProject(result.data.id, branchParams); - } else { - const _message = []; - noMergeBranch && _message.push('目标分支不存在'); - noPullBranch && _message.push('源分支不存在'); + //判断源分支是否存在 + if(noPullBranch){ this.setState({ showMessage: true, - defaultMessage: _message.join(' , '), + defaultMessage:'源分支不存在', isCompareSpin: false, }); + }else{ + if(pullOwner === mergeOwner){ + if (!noMergeBranch) { + this.compareProject(result.data.id, branchParams); + } else { + this.setState({ + showMessage: true, + defaultMessage:'目标分支不存在', + isCompareSpin: false, + }); + } + }else{ + this.getBranchList(branchParams); + } } } - if (pullOwner !== mergeOwner) { - this.getBranchList(branchParams); - } this.setState({ isSpin: false }); }) .catch((error) => { @@ -225,7 +230,9 @@ class CreateMerge extends Component { .length === 0; this.setState({ mergeBranches: result.data, - merge: noMergeBranch ? 'master' : mergeBranch, + showMessage: noMergeBranch, + defaultMessage: '目标分支不存在', + isCompareSpin: false, }); } this.setState({ isSpin: false }); From 9de7ac7c904e1c2558a5c2cde693708af654e869 Mon Sep 17 00:00:00 2001 From: caishi Date: Mon, 18 Oct 2021 11:15:38 +0800 Subject: [PATCH 24/25] =?UTF-8?q?=E6=98=93=E4=BF=AE=E3=80=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=AF=B7=E6=B1=82=E6=A0=87=E9=A2=98=EF=BC=9A=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E9=95=BF=E5=BA=A6=E3=80=81=E8=AF=A6=E6=83=85=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E3=80=81=E5=88=97=E8=A1=A8=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=95=BF=E5=BA=A6=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/MergeItem.js | 2 +- src/forge/Merge/MessageCount.js | 8 +++----- src/forge/Merge/merge_form.js | 2 +- src/forge/Order/Detail.js | 2 +- src/forge/Order/order_form.js | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index dadd6d8a5..f1afabf90 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -64,7 +64,7 @@ class MergeItem extends Component { {item.name} diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 685f42355..3a880165a 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -340,8 +340,8 @@ class MessageCount extends Component {
    -
    -
    +
    +
    @@ -445,8 +445,7 @@ class MessageCount extends Component {
    -
    -
    +
    {operate && (
    -
    { data.issue.description ? diff --git a/src/forge/Merge/merge_form.js b/src/forge/Merge/merge_form.js index 4716bdfca..e63781391 100644 --- a/src/forge/Merge/merge_form.js +++ b/src/forge/Merge/merge_form.js @@ -265,7 +265,7 @@ class MergeForm extends Component { }, ], initialValue: title, - })()} + })()} - {data && data.subject} + {data && data.subject} {data && data.priority && ( diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index 0858ac527..3399a7feb 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -320,7 +320,7 @@ class order_form extends Component { message: "请填写易修标题", }, ] - })()} + })()}
    Date: Mon, 18 Oct 2021 11:30:20 +0800 Subject: [PATCH 25/25] =?UTF-8?q?=E9=9D=9E=E6=B1=89=E5=AD=97=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=BC=BA=E5=88=B6=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/MessageCount.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index 3a880165a..e2dabd865 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -344,7 +344,7 @@ class MessageCount extends Component {
    - + {data.issue.subject}