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/43] =?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 2b1ad3c8..48a72e79 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 a1a74149..868ad06f 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 884c50fe..eaa6ba0e 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 00000000..104d2168 --- /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 b064e3c2..fc021f81 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 5df9794b..1f03a433 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 450a30f1..75330161 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 c27bb12a..ceebb653 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/43] =?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 458de69a..4a0ce00a 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/43] =?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 442d4f32..3072aca5 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 70d1901e..df5e2449 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 bc35344f..70283d31 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 84220a0b..00953b05 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 00000000..2ee29c39 --- /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 104d2168..9f43086a 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 6409bd7f..abdea3dd 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 8913b0d1..c5c5e2df 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 399c9bd9..2e742d72 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 5e3a7556..868e736f 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 1f03a433..4716bdfc 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 d5584797..f403bb4e 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/43] =?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 1ec10446..0d146204 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 ec9f80c8..460ec162 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/43] =?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 59513153..9e10a0ff 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 8419fd31..f897dea1 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":""}>通知管理
      • */} -
      +
    }
    From b30f2169e45d7d23a2d6cdb98d3353159a760f66 Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 15 Oct 2021 15:20:21 +0800 Subject: [PATCH 26/43] =?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 fed2992a..4a7a1d34 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 27/43] =?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 6556023e..8dad59fb 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 0f685907..c335d79f 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 28/43] =?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 dadd6d8a..f1afabf9 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 685f4235..3a880165 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 4716bdfc..e6378139 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 0858ac52..3399a7fe 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 29/43] =?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 3a880165..e2dabd86 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -344,7 +344,7 @@ class MessageCount extends Component {
    - + {data.issue.subject} From dfa9b3d8352b1730b5d22616cd3c237dcc174392 Mon Sep 17 00:00:00 2001 From: caishi Date: Mon, 18 Oct 2021 15:48:31 +0800 Subject: [PATCH 30/43] issue --- src/forge/Main/tree/Index.scss | 7 ++++++- src/forge/Merge/CreateMerge.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/forge/Main/tree/Index.scss b/src/forge/Main/tree/Index.scss index b077d9de..f65a1c68 100644 --- a/src/forge/Main/tree/Index.scss +++ b/src/forge/Main/tree/Index.scss @@ -22,9 +22,14 @@ border-bottom: none; } .treeinfo{ - max-width: 399px; + width: 399px; flex:1; flex-direction: column; + &>a{ + display: block; + width: 399px; + + } a:hover{ span{ color: #466AFF!important; diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index c335d79f..9d8da7d3 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -369,6 +369,7 @@ class CreateMerge extends Component { onSelect={(e) => this.selectBrach('pull', e)} showSearch className="merge-flex1 flex1" + dropdownMatchSelectWidth={false} > {this.renderBrances(pullBranches)} @@ -395,6 +396,7 @@ class CreateMerge extends Component { onSelect={(e) => this.selectBrach('merge', e)} showSearch className="merge-flex1 flex1" + dropdownMatchSelectWidth={false} > {this.renderBrances(mergeBranches)} From a2c5c1ea6f0187d433a5f5fd55aed68b515bd1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Mon, 18 Oct 2021 16:54:16 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/SecuritySetting/Index.jsx | 26 ++-- .../SecuritySetting/notice/manager/Index.jsx | 130 +++++++----------- 2 files changed, 59 insertions(+), 97 deletions(-) diff --git a/src/forge/SecuritySetting/Index.jsx b/src/forge/SecuritySetting/Index.jsx index f897dea1..d9fa1bfa 100644 --- a/src/forge/SecuritySetting/Index.jsx +++ b/src/forge/SecuritySetting/Index.jsx @@ -63,7 +63,7 @@ function Index(props){ {notice_url &&
    • 消息通知
    • -1 && pathname.indexOf("/settings/notice/config") == -1) || pathname.indexOf("/settings/notice/privateLetter")>-1 ?"active":""}>我的通知
    • - {/*
    • -1 ?"active":""}>通知管理
    • */} +
    • -1 ?"active":""}>通知管理
    }
    • 安全设置
    • @@ -73,18 +73,24 @@ function Index(props){ - ( - - )} - > ( )} > + ( + + )} + > + ( + + )} + > ( @@ -103,12 +109,6 @@ function Index(props){ )} > - ( - - )} - > diff --git a/src/forge/SecuritySetting/notice/manager/Index.jsx b/src/forge/SecuritySetting/notice/manager/Index.jsx index ebe84bea..da1aac8d 100644 --- a/src/forge/SecuritySetting/notice/manager/Index.jsx +++ b/src/forge/SecuritySetting/notice/manager/Index.jsx @@ -1,10 +1,36 @@ -import { Button, Checkbox } from "antd"; -import React from "react"; - +import { Checkbox } from "antd"; +import React, { useEffect, useState } from "react"; +import axios from 'axios'; import './Index.scss'; function NoticeManager(props){ + const {current_user} = props; + const [settingTypes, setSettingTypes] = useState(); + const [userNotification, setUserNotification] = useState(); + const [userEmail, setUserEmail] = useState(); + + function getUserSettings(){ + axios.get(`/users/${current_user.login}/template_message_settings.json`).then((response)=>{ + if(response && response.status === 200 ){ + setUserEmail(response.data.email_body); + setUserNotification(response.data.notification_body); + } + }) + } + + useEffect(()=>{ + axios.get("/template_message_settings.json").then((response)=>{ + if(response && response.status === 200 ){ + setSettingTypes(response.data.setting_types); + } + }) + getUserSettings(); + },[]) + + console.log('settingTypes',settingTypes); + console.log('userNotification',userNotification,'userEmail',userEmail); + console.log(userNotification.ins) return(
      @@ -12,87 +38,23 @@ function NoticeManager(props){
      您可以通过通知管理来选择接受通知的方式 -
      - 我创建或负责的 -
      -
      -
      易修状态变更
      - 站内信 - 邮件 -
      -
      -
      易修截止日期到达最后一天
      - 站内信 - 邮件 -
      -
      -
      合并请求状态变更
      - 站内信 - 邮件 -
      -
      -
      易修有新的评论
      - 站内信 - 邮件 -
      -
      -
      合并请求有新的评论
      - 站内信 - 邮件 -
      - -
      - 我管理的仓库 -
      -
      -
      被关注
      - 站内信 - 邮件 -
      -
      -
      被点赞
      - 站内信 - 邮件 -
      -
      -
      被复刻
      - 站内信 - 邮件 -
      -
      -
      有新的里程碑
      - 站内信 - 邮件 -
      - -
      - 我关注的仓库 -
      -
      -
      被删除
      - 站内信 - 邮件 -
      -
      -
      被转移
      - 站内信 - 邮件 -
      -
      -
      有新的易修
      - 站内信 - 邮件 -
      -
      -
      有新的合并请求
      - 站内信 - 邮件 -
      -
      -
      有新的版本发布
      - 站内信 - 邮件 -
      + {settingTypes && settingTypes.map((item,key)=>{ + return( + item.type_name &&
      +
      {item.type_name}
      + {item.settings.map((i, k) => { + console.log(userNotification.get(item.type.substring(item.type.indexOf("::")+2)+"::"+i.key)); + return ( +
      +
      {i.name}
      + 站内信 + 邮件 +
      + ) + })} +
      + ) + })}
      ) From e7a322e0385c5c06b64e1e08fdabd89aaafe8096 Mon Sep 17 00:00:00 2001 From: caishi Date: Mon, 18 Oct 2021 17:13:52 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F-mark?= =?UTF-8?q?down=E6=B8=B2=E6=9F=93=E6=9C=89=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/NoticeModal/Index.scss | 11 ++++------- src/forge/Component/NoticeModal/SystemNotice.jsx | 6 ++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/forge/Component/NoticeModal/Index.scss b/src/forge/Component/NoticeModal/Index.scss index 259be854..18e4dcda 100644 --- a/src/forge/Component/NoticeModal/Index.scss +++ b/src/forge/Component/NoticeModal/Index.scss @@ -39,13 +39,10 @@ .nContent{ padding:20px 34px; background-color: #fff; - .nMaindesc{ - height: 90px; - font-size: 15px; - font-weight: 400; - color: #000000; - line-height: 30px; - } + line-height: 30px; + font-size: 15px; + font-weight: 400; + color: #333; .realmName{ margin-top: 20px; display: flex; diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index cb3fccf0..32c864ab 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -26,10 +26,12 @@ function SystemNotice({system_notification,history}){ // } // }).catch(error=>{}) // } + console.log("cookies before:",cookie.load('notice_stage')) ; cookie.remove('notice_stage'); - let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + // let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 cookie.save('notice_stage', true,{ expires: inFifteenMinutes }); - console.log("cookies:",cookie.load('notice_stage')) ; + console.log("cookies after:",cookie.load('notice_stage')) ; setVisible(false); } From 644e3c3f73f8928a68830f51c2ea0d02aa380409 Mon Sep 17 00:00:00 2001 From: caishi Date: Mon, 18 Oct 2021 17:19:20 +0800 Subject: [PATCH 33/43] =?UTF-8?q?cookie=E5=A4=B1=E6=95=88=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=94=B9=E4=B8=BA=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/NoticeModal/SystemNotice.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index 32c864ab..917b87c8 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -28,8 +28,8 @@ function SystemNotice({system_notification,history}){ // } console.log("cookies before:",cookie.load('notice_stage')) ; cookie.remove('notice_stage'); - // let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 - let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 + let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + // let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 cookie.save('notice_stage', true,{ expires: inFifteenMinutes }); console.log("cookies after:",cookie.load('notice_stage')) ; setVisible(false); From b6b19eabe92fba29b8632a7eaca7217105fee844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Mon, 18 Oct 2021 17:28:40 +0800 Subject: [PATCH 34/43] =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8compare=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/CreateMerge.js | 65 +++++++++++++++++----------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index c335d79f..b766c023 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -150,7 +150,7 @@ class CreateMerge extends Component { }else{ if(pullOwner === mergeOwner){ if (!noMergeBranch) { - this.compareProject(result.data.id, branchParams); + this.compareProject(true, branchParams); } else { this.setState({ showMessage: true, @@ -172,53 +172,51 @@ class CreateMerge extends Component { }; // compare接口,获取分支对比信息 - compareProject = (baseid, branchParams) => { + compareProject = (sameProject, 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, - }); - } + if (sameProject) { + 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({ - comparesData: result.data, + showMessage: false, + }); + } else { + this.setState({ + showMessage: true, + defaultMessage: result.data.message, }); } this.setState({ - isFirstLoading: false, - isSpin: false, - isCompareSpin: false, + comparesData: result.data, }); - }) - .catch((error) => { - this.setState({ isSpin: false, isCompareSpin: false }); + } + this.setState({ + isFirstLoading: false, + isSpin: false, + isCompareSpin: false, }); - } + }) + .catch((error) => { + this.setState({ isSpin: false, isCompareSpin: false }); + }); }; // 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询 - getBranchList = ({ mergeOwner, projectId, mergeBranch }) => { + getBranchList = (branchParams) => { + const { mergeOwner, projectId, mergeBranch } = branchParams; this.setState({ isSpin: true }); const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`; axios @@ -234,6 +232,7 @@ class CreateMerge extends Component { defaultMessage: '目标分支不存在', isCompareSpin: false, }); + !noMergeBranch && this.compareProject(false, branchParams); } this.setState({ isSpin: false }); }) From 11b92ac52bce6a93bd8d0a20ded2687febf0513d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Tue, 19 Oct 2021 09:00:00 +0800 Subject: [PATCH 35/43] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/SecuritySetting/notice/manager/Index.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/forge/SecuritySetting/notice/manager/Index.jsx b/src/forge/SecuritySetting/notice/manager/Index.jsx index da1aac8d..d45dc371 100644 --- a/src/forge/SecuritySetting/notice/manager/Index.jsx +++ b/src/forge/SecuritySetting/notice/manager/Index.jsx @@ -30,7 +30,6 @@ function NoticeManager(props){ console.log('settingTypes',settingTypes); console.log('userNotification',userNotification,'userEmail',userEmail); - console.log(userNotification.ins) return(
      @@ -43,12 +42,12 @@ function NoticeManager(props){ item.type_name &&
      {item.type_name}
      {item.settings.map((i, k) => { - console.log(userNotification.get(item.type.substring(item.type.indexOf("::")+2)+"::"+i.key)); + // console.log(userEmail[item.type.substring(item.type.indexOf("::")+2)+"::"+i.key]); return (
      {i.name}
      - 站内信 - 邮件 + 站内信 + 邮件
      ) })} From fe1bacb98417a88453e9b72f48e48b462133716b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Tue, 19 Oct 2021 10:26:36 +0800 Subject: [PATCH 36/43] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=AE=A1=E7=90=86+?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9F=BA=E6=9C=AC=E8=B5=84=E6=96=99=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84consolo=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecuritySetting/notice/manager/Index.jsx | 46 +++++++++++-------- src/forge/users/Material/Base.jsx | 1 - 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/forge/SecuritySetting/notice/manager/Index.jsx b/src/forge/SecuritySetting/notice/manager/Index.jsx index d45dc371..ca16f25e 100644 --- a/src/forge/SecuritySetting/notice/manager/Index.jsx +++ b/src/forge/SecuritySetting/notice/manager/Index.jsx @@ -10,26 +10,36 @@ function NoticeManager(props){ const [userNotification, setUserNotification] = useState(); const [userEmail, setUserEmail] = useState(); - function getUserSettings(){ + function onChange(type,e,setting){ + let notification_body = userNotification; + let email_body = userEmail; + if(type){//站内信 + notification_body[setting] = e.target.checked; + }else{//邮件 + email_body[setting] = e.target.checked; + } + axios.post(`/users/${current_user.login}/template_message_settings/update_setting.json`,{ + setting:{ + notification_body:notification_body, + email_body:email_body + } + }) + } + + useEffect(()=>{ + axios.get("/template_message_settings.json").then(response => { + if (response && response.status === 200) { + setSettingTypes(response.data.setting_types); + } + }) axios.get(`/users/${current_user.login}/template_message_settings.json`).then((response)=>{ if(response && response.status === 200 ){ setUserEmail(response.data.email_body); setUserNotification(response.data.notification_body); } }) - } - - useEffect(()=>{ - axios.get("/template_message_settings.json").then((response)=>{ - if(response && response.status === 200 ){ - setSettingTypes(response.data.setting_types); - } - }) - getUserSettings(); },[]) - console.log('settingTypes',settingTypes); - console.log('userNotification',userNotification,'userEmail',userEmail); return(
      @@ -37,17 +47,17 @@ function NoticeManager(props){
      您可以通过通知管理来选择接受通知的方式 - {settingTypes && settingTypes.map((item,key)=>{ + {settingTypes && userNotification && userEmail && settingTypes.map((item,key)=>{ return( - item.type_name &&
      + item.type_name &&
      {item.type_name}
      {item.settings.map((i, k) => { - // console.log(userEmail[item.type.substring(item.type.indexOf("::")+2)+"::"+i.key]); + const setting = item.type.substring(item.type.indexOf("::")+2)+"::"+i.key; return ( -
      +
      {i.name}
      - 站内信 - 邮件 + {onChange(true,e,setting)}}>站内信 + {onChange(false,e,setting)}}>邮件
      ) })} diff --git a/src/forge/users/Material/Base.jsx b/src/forge/users/Material/Base.jsx index f9707ab0..61a9d6f1 100644 --- a/src/forge/users/Material/Base.jsx +++ b/src/forge/users/Material/Base.jsx @@ -11,7 +11,6 @@ export default Form.create()( const { getFieldDecorator, validateFields , setFieldsValue } = props && props.form; // const { username } = props && props.match && props.match.params; const { resetUserInfo , current_user } = props; - console.log(props); useEffect(()=>{ if(current_user && current_user.login){ From 31af77e7040670d30877d24976186f38b960f788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Tue, 19 Oct 2021 10:45:15 +0800 Subject: [PATCH 37/43] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecuritySetting/notice/manager/Index.jsx | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/forge/SecuritySetting/notice/manager/Index.jsx b/src/forge/SecuritySetting/notice/manager/Index.jsx index ca16f25e..5ba82d60 100644 --- a/src/forge/SecuritySetting/notice/manager/Index.jsx +++ b/src/forge/SecuritySetting/notice/manager/Index.jsx @@ -23,6 +23,19 @@ function NoticeManager(props){ notification_body:notification_body, email_body:email_body } + }).then(response=>{ + if(response && response.status === 0){ + getUserSettings(); + } + }) + } + + function getUserSettings(){ + axios.get(`/users/${current_user.login}/template_message_settings.json`).then((response)=>{ + if(response && response.status === 200 ){ + setUserEmail(response.data.email_body); + setUserNotification(response.data.notification_body); + } }) } @@ -32,12 +45,7 @@ function NoticeManager(props){ setSettingTypes(response.data.setting_types); } }) - axios.get(`/users/${current_user.login}/template_message_settings.json`).then((response)=>{ - if(response && response.status === 200 ){ - setUserEmail(response.data.email_body); - setUserNotification(response.data.notification_body); - } - }) + getUserSettings(); },[]) return( From 2c867f98566a2def04183f9d400d0ff6a48faf50 Mon Sep 17 00:00:00 2001 From: caishi Date: Wed, 20 Oct 2021 11:05:38 +0800 Subject: [PATCH 38/43] =?UTF-8?q?cookie=E8=AE=BE=E7=BD=AEpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/NoticeModal/SystemNotice.jsx | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index 917b87c8..817d7b8e 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -12,26 +12,15 @@ function SystemNotice({system_notification,history}){ if(system_notification && !cookie.load('notice_stage')){ setVisible(true); } - },[system_notification]) + },[system_notification,history.location]) function sureContinue() { - // if(login && ( system_notification && system_notification.id )){ - // const url = `/users/${login}/system_notification_histories.json`; - // axios.post(url,{ - // system_notification_id:system_notification.id - // }).then(result=>{ - // if(result && result.status === 0){ - // setVisible(false); - // hideSystemNotice(); - // } - // }).catch(error=>{}) - // } - console.log("cookies before:",cookie.load('notice_stage')) ; cookie.remove('notice_stage'); - let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 - // let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 - cookie.save('notice_stage', true,{ expires: inFifteenMinutes }); - console.log("cookies after:",cookie.load('notice_stage')) ; + + // let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 + cookie.save('notice_stage', true,{ expires: inFifteenMinutes,path:"/" }); + setVisible(false); } From 76c2d205eb6799fcb9a0eb4cc7403668cc0879e6 Mon Sep 17 00:00:00 2001 From: caishi Date: Wed, 20 Oct 2021 11:06:49 +0800 Subject: [PATCH 39/43] =?UTF-8?q?cookie=E8=AE=BE=E7=BD=AE=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/NoticeModal/SystemNotice.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forge/Component/NoticeModal/SystemNotice.jsx b/src/forge/Component/NoticeModal/SystemNotice.jsx index 817d7b8e..1560c1ff 100644 --- a/src/forge/Component/NoticeModal/SystemNotice.jsx +++ b/src/forge/Component/NoticeModal/SystemNotice.jsx @@ -17,8 +17,8 @@ function SystemNotice({system_notification,history}){ function sureContinue() { cookie.remove('notice_stage'); - // let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 - let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 + let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);//一天 + // let inFifteenMinutes = new Date(new Date().getTime() + 60 * 1000);//一分钟 cookie.save('notice_stage', true,{ expires: inFifteenMinutes,path:"/" }); setVisible(false); From d47c725b96bf3bc92850957c9e2f14e45d679179 Mon Sep 17 00:00:00 2001 From: caishi Date: Wed, 20 Oct 2021 15:25:35 +0800 Subject: [PATCH 40/43] =?UTF-8?q?pr=E5=88=86=E6=94=AF=E8=BF=87=E9=95=BF?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E6=97=B6=E5=BA=94=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/CreateMerge.js | 4 ++-- src/forge/Merge/merge.css | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index 2659f2e8..b039c634 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -367,7 +367,7 @@ class CreateMerge extends Component { value={pull} onSelect={(e) => this.selectBrach('pull', e)} showSearch - className="merge-flex1 flex1" + className="merge-flex1 flex1 matchwidth" dropdownMatchSelectWidth={false} > {this.renderBrances(pullBranches)} @@ -394,7 +394,7 @@ class CreateMerge extends Component { value={merge} onSelect={(e) => this.selectBrach('merge', e)} showSearch - className="merge-flex1 flex1" + className="merge-flex1 flex1 matchwidth" dropdownMatchSelectWidth={false} > {this.renderBrances(mergeBranches)} diff --git a/src/forge/Merge/merge.css b/src/forge/Merge/merge.css index 3ea2620c..1d635028 100644 --- a/src/forge/Merge/merge.css +++ b/src/forge/Merge/merge.css @@ -213,4 +213,8 @@ form .ant-cascader-picker, form .ant-select { .mergeRequest .folders{ /* width: 72rem; */ width: 100%; - } \ No newline at end of file + } + + .matchwidth .ant-select-selection__rendered{ + max-width: 200px; + } \ No newline at end of file From 057881097d79a4607088d0a384a8bd0a6dbe3310 Mon Sep 17 00:00:00 2001 From: caishi Date: Wed, 20 Oct 2021 16:26:23 +0800 Subject: [PATCH 41/43] =?UTF-8?q?pr=20=E5=88=86=E6=94=AF=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/CreateMerge.js | 2 ++ src/forge/Merge/MergeItem.js | 4 ++-- src/forge/Merge/MessageCount.js | 4 ++-- src/forge/Merge/UpdateMerge.js | 8 ++++---- src/forge/Merge/merge.css | 7 ++++++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index b039c634..d7a32009 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -369,6 +369,7 @@ class CreateMerge extends Component { showSearch className="merge-flex1 flex1 matchwidth" dropdownMatchSelectWidth={false} + dropdownClassName="overlihide" > {this.renderBrances(pullBranches)} @@ -396,6 +397,7 @@ class CreateMerge extends Component { showSearch className="merge-flex1 flex1 matchwidth" dropdownMatchSelectWidth={false} + dropdownClassName="overlihide" > {this.renderBrances(mergeBranches)} diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index f1afabf9..61477c14 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -110,7 +110,7 @@ class MergeItem extends Component { {item.is_original ? item.fork_project_user @@ -134,7 +134,7 @@ class MergeItem extends Component { {/* {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 e2dabd86..6d01e8a3 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -366,7 +366,7 @@ class MessageCount extends Component { {data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}: {data.pull_request && data.pull_request.head} @@ -381,7 +381,7 @@ class MessageCount extends Component { {data.issue.project_author_name}:{data.pull_request.base} diff --git a/src/forge/Merge/UpdateMerge.js b/src/forge/Merge/UpdateMerge.js index 001bedd5..8918db6e 100644 --- a/src/forge/Merge/UpdateMerge.js +++ b/src/forge/Merge/UpdateMerge.js @@ -64,12 +64,12 @@ class UpdateMerge extends Component {
      源分支:
      - {" "} {" "} @@ -83,12 +83,12 @@ class UpdateMerge extends Component {
      目标分支 :
      {" "} - {" "} {" "} diff --git a/src/forge/Merge/merge.css b/src/forge/Merge/merge.css index 1d635028..d61543b4 100644 --- a/src/forge/Merge/merge.css +++ b/src/forge/Merge/merge.css @@ -40,6 +40,7 @@ form .ant-cascader-picker, form .ant-select { } .merge-header-button{ background:rgba(241,248,255,1); + text-align: left; } .width70{ width:70%; @@ -216,5 +217,9 @@ form .ant-cascader-picker, form .ant-select { } .matchwidth .ant-select-selection__rendered{ - max-width: 200px; + width: 200px; + } + .overlihide li{ + max-width: 450px; + } \ No newline at end of file From 13c58faad85f4d2619704bc78ed569337bb26218 Mon Sep 17 00:00:00 2001 From: caishi Date: Thu, 21 Oct 2021 10:37:10 +0800 Subject: [PATCH 42/43] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3-=E6=A0=B9=E6=8D=AE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=AF=B9=E5=BA=94=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Branch/SelectOverlay.jsx | 20 ++++++-------------- src/forge/Main/CoderDepot.jsx | 4 ++-- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/forge/Branch/SelectOverlay.jsx b/src/forge/Branch/SelectOverlay.jsx index e9c4aae4..0be56732 100644 --- a/src/forge/Branch/SelectOverlay.jsx +++ b/src/forge/Branch/SelectOverlay.jsx @@ -2,7 +2,7 @@ import React , { useState , useEffect } from 'react'; import { Input , Spin , Menu } from 'antd'; import { getBranch , getTag } from '../GetData/getData'; -function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owner , visible }) { +function SelectOverlay({ changeBranch , tagflag , projectsId , owner , visible }) { const [ inputValue , setInputValue] = useState(undefined); const [ nav , setNav ] = useState(0); const [ isSpin , setIsSpin ] = useState(true); @@ -11,21 +11,13 @@ function SelectOverlay({ changeBranch , tagflag , branchList , projectsId , owne const [ datas , setDatas ] = useState(undefined); const [ keys ,setKeys] = useState("branch"); - // useEffect(()=>{ - // if(visible){ - // setKeys("branch"); - // getBranchs(projectsId,owner); - // setIsSpin(true); - // } - // },[visible]) - useEffect(()=>{ - if(branchList){ - setData(branchList); - setDatas(branchList); - setIsSpin(false); + if(visible){ + setKeys("branch"); + getBranchs(projectsId,owner); + setIsSpin(true); } - },[branchList]) + },[visible]) async function getBranchs(id,owner){ let result = await getBranch(id,owner); diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 8dd5e468..f50c134a 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -407,14 +407,14 @@ function CoderDepot(props){ 分支 - {projectDetail && projectDetail.branches && projectDetail.branches.total_count} + {projectDetail && projectDetail.branches_count} 标签 - {projectDetail && projectDetail.tags && projectDetail.tags.total_count} + {projectDetail && projectDetail.tags_count} From cc62bde5b48dd34e5dc330c301e1acc24fb7cdd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Thu, 21 Oct 2021 11:02:15 +0800 Subject: [PATCH 43/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=20=E6=8F=90=E4=BA=A4=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=A4=9A=E8=A1=8C=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/list.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/forge/Main/list.scss b/src/forge/Main/list.scss index 83b4d5ee..59589fb6 100644 --- a/src/forge/Main/list.scss +++ b/src/forge/Main/list.scss @@ -734,7 +734,9 @@ a.color-grey-ccc:hover{ border: 1px solid rgba(42, 97, 255, 0.23); border-radius: 4px; margin-left: 16px; - align-items: center; + & .treecopy{ + margin-top: 20px; + } & .markdown-body table{ background: #FAFCFF; }