From ba263a28f1ba2a543f6857de143365d892261bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Fri, 20 Aug 2021 14:43:52 +0800 Subject: [PATCH 01/66] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=A4=8D=E5=88=B6toolTip=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/CopyTool.jsx | 44 +++++++++++++++ src/forge/Wiki/Index.jsx | 33 +++-------- src/forge/Wiki/Index.scss | 2 +- src/forge/Wiki/Preview.jsx | 17 +----- src/forge/Wiki/components/Login/index.jsx | 8 +-- src/forge/Wiki/components/Login/index.scss | 56 ------------------- src/forge/Wiki/components/ModalFun/index.jsx | 24 ++++---- src/forge/Wiki/components/ModalFun/index.scss | 11 +++- 8 files changed, 80 insertions(+), 115 deletions(-) create mode 100644 src/forge/Component/CopyTool.jsx delete mode 100644 src/forge/Wiki/components/Login/index.scss diff --git a/src/forge/Component/CopyTool.jsx b/src/forge/Component/CopyTool.jsx new file mode 100644 index 00000000..e659c077 --- /dev/null +++ b/src/forge/Component/CopyTool.jsx @@ -0,0 +1,44 @@ +import React, { useState, useCallback, memo } from 'react'; +import { Tooltip } from 'antd'; + +CopyTool.defaultProps = { + beforeText: '复制', //浮动过去显示的文字 + afterText: '复制成功', //点击后显示的文字 + className: '', //传给svg的class + inputId: 'copyText', //要复制的文本的ID +}; + + +function CopyTool({ beforeText, afterText, className,inputId }) { + const [title, setTitle] = useState(() => { + return beforeText; + }); + + // 复制链接 + const copyUrl = useCallback(() => { + let inputDom = document.getElementById(inputId); + if (!inputDom) { + console.error("您的CopyTool未设置正确的inputId"); + return; + } + inputDom.select(); + if (document.execCommand('copy')) { + document.execCommand('copy'); + } + setTitle(afterText); + inputDom.blur(); + }, []); + + return ( + { setTitle(beforeText) }} + > + + + ); +} + + +export default memo(CopyTool); \ No newline at end of file diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx index ed5c4899..c27879b2 100644 --- a/src/forge/Wiki/Index.jsx +++ b/src/forge/Wiki/Index.jsx @@ -2,7 +2,7 @@ import React, { useEffect, useCallback, useState } from 'react'; import { Button, Dropdown, Icon, Input, Menu, Tooltip, Select, Upload, message, Spin } from 'antd'; import { getImageUrl, timeAgo } from 'educoder'; import cookie from 'react-cookies'; -// import Loading from "../../Loading"; +import CopyTool from '../Component/CopyTool'; import DelModal from './components/ModalFun'; import Welcome from './Welcome'; import { wikiPages, getWiki, deleteWiki } from './api'; @@ -14,15 +14,12 @@ const InputGroup = Input.Group; const { Option } = Select; export default (props) => { - const { match, current_user, history, showNotification, project, projectDetail } = props; - // const permission = projectDetail && projectDetail.permission !== "Reporter"; + const { match, history, showNotification, project, projectDetail } = props; const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter"; let projectsId = match.params.projectsId; let owner = match.params.owner; - console.log(project); - const [fileArrInit, setFileArrInit] = useState(null); const [checkItem, setCheckItem] = useState({}); const [itemDetail, setItemDetail] = useState({}); @@ -85,7 +82,7 @@ export default (props) => { DelModal({ title: '删除页面', contentTitle: `您确定要删除“${item.name}”此页面吗?`, - content: '此操作将删除该页面,请进行确认以防文件的丢失。', + content: '此操作将删除该页面,请进行确认以防文件的丢失', onOk: () => { deleteWiki({ owner: owner, @@ -109,17 +106,6 @@ export default (props) => { window.location.href = `/users/${login}`; } - // 复制链接 - const copyUrl = useCallback(() => { - let wikiUrl = document.getElementById("wikiUrl"); - wikiUrl.select(); - if (document.execCommand('copy')) { - document.execCommand('copy'); - } - message.success('复制成功'); - wikiUrl.blur(); - }, []) - function addFile() { history.push(`/projects/${owner}/${projectsId}/wiki/add`); } @@ -231,6 +217,7 @@ export default (props) => { + @@ -246,8 +233,8 @@ export default (props) => { { fileArr.map(item => { - return
-
{ setCheckItem(item) }}> + return
+
{ setCheckItem(item) }}>
{item.name} @@ -266,9 +253,7 @@ export default (props) => { - - - + }
@@ -277,9 +262,9 @@ export default (props) => {

{checkItem.name}

- { goUser(current_user.login) }}> + { checkItem.commit && goUser(checkItem.commit.author.name) }}> {itemDetail.image_url && 头像} - {checkItem.commit ? checkItem.commit.author.name : ''} + {itemDetail.userName} 上次修改于{checkItem.commit && timeAgo(checkItem.commit.author.when)}
diff --git a/src/forge/Wiki/Index.scss b/src/forge/Wiki/Index.scss index c571da25..e40de299 100644 --- a/src/forge/Wiki/Index.scss +++ b/src/forge/Wiki/Index.scss @@ -199,7 +199,7 @@ body { word-break: break-all; } - .copy-svg { + .copy-wiki { display: inline-flex; align-items: center; justify-content: center; diff --git a/src/forge/Wiki/Preview.jsx b/src/forge/Wiki/Preview.jsx index 20645246..e7c6a623 100644 --- a/src/forge/Wiki/Preview.jsx +++ b/src/forge/Wiki/Preview.jsx @@ -1,5 +1,6 @@ import React, { useEffect, useCallback, useState } from 'react'; -import { Input, Button, Tooltip, Select, Dropdown, Icon, Menu, message } from 'antd'; +import { Input, Button, Select, Dropdown, Icon, Menu, message } from 'antd'; +import CopyTool from '../Component/CopyTool'; import { wikiPages, getWiki, } from './api'; import { httpUrl } from './fetch'; import './Index.scss'; @@ -59,16 +60,6 @@ export default (props) => { }); }, [project, checkItem]); - const copyUrl = useCallback(() => { - let wikiUrl = document.getElementById("wikiUrl"); - wikiUrl.select(); - if (document.execCommand('copy')) { - document.execCommand('copy'); - } - message.success('复制成功'); - wikiUrl.blur(); - }, []); - function goEdit() { history.push(`/projects/${owner}/${projectsId}/wiki/edit/${checkItem.name}`); } @@ -113,9 +104,7 @@ export default (props) => { - - - + } diff --git a/src/forge/Wiki/components/Login/index.jsx b/src/forge/Wiki/components/Login/index.jsx index 9574a9a5..abfa5295 100644 --- a/src/forge/Wiki/components/Login/index.jsx +++ b/src/forge/Wiki/components/Login/index.jsx @@ -1,10 +1,9 @@ import React, { useState } from 'react'; import * as ReactDOM from 'react-dom'; import LoginDialog from '../../../../modules/login/LoginDialog'; -import './index.scss'; -// 使用函数调用删除组件 -export default function DelModal(props) { +// 使用函数调用登录组件 +export default function Login(props) { const div = document.createElement('div'); document.body.appendChild(div); @@ -16,9 +15,6 @@ export default function DelModal(props) { } function render() { - /** - * Sync render blocks React event. Let's make this async. - */ setTimeout(() => { ReactDOM.render( diff --git a/src/forge/Wiki/components/Login/index.scss b/src/forge/Wiki/components/Login/index.scss deleted file mode 100644 index 13d16066..00000000 --- a/src/forge/Wiki/components/Login/index.scss +++ /dev/null @@ -1,56 +0,0 @@ -.delete-modal { - .ant-modal-header { - padding: 9px 24px; - background: #f8f8f8; - border-bottom: 1px solid #eee; - } - .ant-modal-title { - text-align: left; - } - .ant-modal-close { - top: 0px !important; - } - .ant-modal-close-x { - font-size: 24px; - } - .ant-modal-body { - text-align: center; - } - .delete-title { - display: flex; - justify-content: center; - align-items: center; - margin: 2rem 0 1rem !important; - font-size: 16px; - color: #333; - letter-spacing: 0; - line-height: 29px; - font-weight: 400; - } - .red-circle { - align-self: flex-start; - color: #ca0002; - font-size: 1.5rem !important; - } - .delete-descibe { - font-size: 14px; - color: #666; - line-height: 33px; - font-weight: 400; - } - .ant-modal-footer { - padding: 2rem 0; - text-align: center; - border: 0; - .ant-btn { - width: 6rem; - } - } - .foot-submit { - margin-left: 3rem; - color: #df0002; - &:hover { - border-color: #df0002; - } - } -} \ No newline at end of file diff --git a/src/forge/Wiki/components/ModalFun/index.jsx b/src/forge/Wiki/components/ModalFun/index.jsx index 661eca31..73fbfd37 100644 --- a/src/forge/Wiki/components/ModalFun/index.jsx +++ b/src/forge/Wiki/components/ModalFun/index.jsx @@ -8,7 +8,8 @@ export default function DelModal(props) { renderModal({ ...props, type: 'delete' }) } -export function confirmModal(props) { +// 使用函数调用选择模态框组件 +export function Confirm(props) { renderModal({ ...props, type: 'confirm' }) } @@ -35,9 +36,6 @@ function renderModal(props) { } function render() { - /** - * Sync render blocks React event. Let's make this async. - */ setTimeout(() => { ReactDOM.render( modalType(type), @@ -48,7 +46,8 @@ function renderModal(props) { render(); } -// 真正的删除组件 + +// 删除组件 function DeleteModal({ onCancel, onOk, @@ -81,7 +80,7 @@ function DeleteModal({ className="myself-modal" centered footer={[ - , , , , - ]} - > -
-

- - {contentTitle}

-

{content}

-
- - ) -} - - -// 选择模态框组件 -function ConfirmModal({ - onCancel, - onOk, - title, - contentTitle, - content, - okText, - cancelText, - afterClose, -}) { - - const [visible, setVisible] = useState(true); - - function onCancelModal() { - setVisible(false); - onCancel && onCancel() - } - - function onSuccess() { - setVisible(false); - onOk && onOk(); - } - - return ( - - {cancelText||'取消'} - , - , ]} > From 5d465ec782c6620bc339d7328e0155322bc82861 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 24 Aug 2021 15:02:04 +0800 Subject: [PATCH 03/66] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9B=A2=E9=98=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=9A=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=9D=83=E9=99=90=EF=BC=8C=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E8=AE=BE=E7=BD=AE=E8=AE=BF=E9=97=AE=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8D=95=E5=85=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Notice/Index.jsx | 4 ++-- src/forge/Notice/UndoEvent.jsx | 2 +- src/forge/Team/Group/GroupForm.jsx | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index 63d09748..02f05a87 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -70,9 +70,9 @@ function Index(props){ function deleteEvent(type,count) { let c = count; if(type==="apply"){ - setTransferCount(transferCount-count); - }else if(type==="undo"){ setApplyCount(applyCount-count); + }else if(type==="undo"){ + setTransferCount(transferCount-count); }else{ setMessagesCount(0); c = messagesCount; diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index d93a1f83..c8c579dc 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -53,7 +53,7 @@ function UndoEvent(props){ Axios.post(url).then(result=>{ if(result && result.data){ getList(); - props && props.deleteEvent("apply",1); + props && props.deleteEvent("undo",1); } }).catch(error=>{}) } diff --git a/src/forge/Team/Group/GroupForm.jsx b/src/forge/Team/Group/GroupForm.jsx index 2eb8540f..1be7bdc0 100644 --- a/src/forge/Team/Group/GroupForm.jsx +++ b/src/forge/Team/Group/GroupForm.jsx @@ -202,7 +202,7 @@ export default Form.create()( [], 新建项目(成员可以在组织中新建项目。创建者将自动获得新建的项目的管理员权限), false, 20,onwers ? "hide":"" )} - {/* {helper( + {helper( '版本库权限:', "authorize", [], @@ -211,9 +211,9 @@ export default Form.create()( 写入权限(成员可以查看和推送提交到团队项目) 管理员权限(成员可以拉取和推送到团队项目同时可以添加协作者) , false, 20,onwers ? "hide":"" - )} */} + )} - {/*

允许访问项目单元:

+

允许访问项目单元:

代码库(查看源码、文件、提交和分支) @@ -230,7 +230,7 @@ export default Form.create()( 版本发布(跟踪项目版本和下载) - */} + cancelEdit()}>取消
From 061fa0ee71d83e18ec26c64eb0359686a3ff2141 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 24 Aug 2021 16:14:49 +0800 Subject: [PATCH 04/66] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9B=A2=E9=98=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E5=8D=95=E5=85=83wiki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/Group/GroupForm.jsx | 57 +++++++++++++++++++----------- src/forge/Team/Index.scss | 2 +- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/forge/Team/Group/GroupForm.jsx b/src/forge/Team/Group/GroupForm.jsx index 1be7bdc0..e27161e0 100644 --- a/src/forge/Team/Group/GroupForm.jsx +++ b/src/forge/Team/Group/GroupForm.jsx @@ -24,21 +24,24 @@ export default Form.create()( const [check_box, setCheckBox] = useState(false); const [switch_box, setSwtichBox] = useState([]); const [onwers, setOnwers] = useState(false); + const [auth, setAuth] = useState(""); const [ descNum , setDescNum ] = useState(0); const [switch_box_code, setSwtichBoxCode] = useState(false); const [switch_box_pull, setSwtichBoxPull] = useState(false); const [switch_box_issue, setSwtichBoxIssue] = useState(false); const [switch_box_release, setSwtichBoxRelease] = useState(false); + const [switch_box_wiki, setSwtichBoxWiki] = useState(false); const { getFieldDecorator, validateFields, setFieldsValue } = form; const { OIdentifier, groupId } = match.params; useEffect(() => { if (GroupDetail) { setOnwers(GroupDetail.authorize === "owner"); + setAuth(GroupDetail.authorize); setCheckBox(GroupDetail.can_create_org_project) setSwtichBox(GroupDetail.units) setFieldsValue({ - ...GroupDetail + ...GroupDetail, }) setDescNum(GroupDetail.description ? GroupDetail.description.length : 0); } @@ -50,6 +53,7 @@ export default Form.create()( setSwtichBoxPull(switch_checked("pulls")) setSwtichBoxIssue(switch_checked("issues")) setSwtichBoxRelease(switch_checked("releases")) + setSwtichBoxWiki(switch_checked("wiki")) } }, [switch_box]) @@ -132,6 +136,11 @@ export default Form.create()( setSwtichBoxRelease(checked) } + function switch_wiki_types(checked, event) { + switch_unit_types(checked, "wiki"); + setSwtichBoxWiki(checked); + } + function cancelEdit(){ if(groupId){ history.push(`/organize/${OIdentifier}/group/${groupId}`); @@ -140,6 +149,9 @@ export default Form.create()( } } + function changeAuth(params) { + setAuth(params.target.value) + } function checkname(rule, value, callback){ if(!value){ @@ -206,31 +218,36 @@ export default Form.create()( '版本库权限:', "authorize", [], - + 读取权限(成员可以查看和克隆团队项目) 写入权限(成员可以查看和推送提交到团队项目) 管理员权限(成员可以拉取和推送到团队项目同时可以添加协作者) , false, 20,onwers ? "hide":"" )} -

允许访问项目单元:

- - - 代码库(查看源码、文件、提交和分支) - - - - 任务(组织 bug 报告、任务和里程碑) - - - - 合并请求(启用合并请求和代码评审) - - - - 版本发布(跟踪项目版本和下载) - - +
+

允许访问项目单元:

+ + + 代码库(查看源码、文件、提交和分支) + + + + 任务(组织 bug 报告、任务和里程碑) + + + + 合并请求(启用合并请求和代码评审) + + + + 版本发布(跟踪项目版本和下载) + + + + wiki(编辑此仓库的相关文档说明) + +
cancelEdit()}>取消
diff --git a/src/forge/Team/Index.scss b/src/forge/Team/Index.scss index a046f99d..11237973 100644 --- a/src/forge/Team/Index.scss +++ b/src/forge/Team/Index.scss @@ -368,5 +368,5 @@ } } .hide{ - display: hidden; + display: none; } \ No newline at end of file From 52e08e77e576754ab3b64bd60d759e5e96f14189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Wed, 25 Aug 2021 11:34:46 +0800 Subject: [PATCH 05/66] =?UTF-8?q?=E4=BF=AE=E6=94=B9websocket=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/Detail.js | 723 ++++++++++++++++++++------------------- src/forge/New/Index.js | 37 +- 2 files changed, 407 insertions(+), 353 deletions(-) diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index f01ef2d3..8128ff48 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; -import { Spin, Tooltip , Button } from 'antd'; +import { Spin, Tooltip, Button } from 'antd'; import { Link, Route, Switch } from 'react-router-dom'; -import { Content , AlignTop } from '../Component/layout'; +import { Content, AlignTop } from '../Component/layout'; import DetailBanner from './sub/DetailBanner'; import '../css/index.scss' import './list.css'; @@ -103,12 +103,12 @@ const Contribute = Loadable({ }) const CoderRootCommit = Loadable({ - loader: () => import('./CoderRootCommit'), - loading: Loading, + loader: () => import('./CoderRootCommit'), + loading: Loading, }) const CoderDepot = Loadable({ - loader: () => import('./CoderDepot'), - loading: Loading, + loader: () => import('./CoderDepot'), + loading: Loading, }) const TrendsIndex = Loadable({ @@ -139,28 +139,28 @@ const WikiEdit = Loadable({ /** * permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外) */ -function checkPathname(projectsId,owner,pathname){ +function checkPathname(projectsId, owner, pathname) { let name = ""; - if(pathname && pathname !== `/projects/${owner}/${projectsId}`){ + if (pathname && pathname !== `/projects/${owner}/${projectsId}`) { let url = pathname.split(`/projects/${owner}/${projectsId}`)[1]; - if(url.indexOf("/about")>-1){ - name="about" - }else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){ + if (url.indexOf("/about") > -1) { + name = "about" + } else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) { name = "issues"; - }else if(url.indexOf("/pulls")>-1){ - name="pulls" - }else if(url.indexOf("/milestones")>-1){ - name="milestones" - }else if(url.indexOf("/activity")>-1){ - name="activity" - }else if(url.indexOf("/setting")>-1){ - name="setting" - }else if(url.indexOf(`/devops`)>-1){ - name="devops" - }else if(url.indexOf(`/source`)>-1){ - name="source" - }else if(url.indexOf(`/wiki`)>-1){ - name="wiki" + } else if (url.indexOf("/pulls") > -1) { + name = "pulls" + } else if (url.indexOf("/milestones") > -1) { + name = "milestones" + } else if (url.indexOf("/activity") > -1) { + name = "activity" + } else if (url.indexOf("/setting") > -1) { + name = "setting" + } else if (url.indexOf(`/devops`) > -1) { + name = "devops" + } else if (url.indexOf(`/source`) > -1) { + name = "source" + } else if (url.indexOf(`/wiki`) > -1) { + name = "wiki" } } return name; @@ -183,15 +183,15 @@ class Detail extends Component { branchs: undefined, branchList: undefined, project: null, - firstSync:false, - secondSync:false, - open_devops:false, - forkSpin:false, + firstSync: false, + secondSync: false, + open_devops: false, + forkSpin: false, // 默认分支 - defaultBranch:undefined, + defaultBranch: undefined, // 非本平台项目 - platform:false + platform: false } } @@ -208,36 +208,38 @@ class Detail extends Component { } getProject = (num) => { - const { projectsId , owner } = this.props.match.params; + const { projectsId, owner } = this.props.match.params; const url = `/${owner}/${projectsId}/simple.json`; axios.get(url).then((result) => { if (result && result.data) { this.setState({ project: result.data, - open_devops:result.data.open_devops, - platform:result.data.platform && result.data.platform !== 'educoder' + open_devops: result.data.open_devops, + platform: result.data.platform && result.data.platform !== 'educoder' }) if (result.data.type !== 0 && result.data.mirror_status === 1) { console.log("--------start channel --------"); // 是镜像项目,且未完成迁移 this.canvasChannel(); - if(num){ + if (num) { this.setState({ - secondSync:true, - firstSync:false + secondSync: true, + firstSync: false }) - }else{ + } else { this.setState({ - firstSync:true, - secondSync:false + firstSync: true, + secondSync: false }) } - }else{ + } else if (result.data.mirror_status === 2) { + this.deleteProjectBack(); + } else { this.getDetail(); this.setState({ - firstSync:false, - secondSync:false + firstSync: false, + secondSync: false }) } } @@ -245,9 +247,9 @@ class Detail extends Component { } // 工作流激活后修改状态 - changeOpenDevops=(flag)=>{ + changeOpenDevops = (flag) => { this.setState({ - open_devops:flag + open_devops: flag }) } canvasChannel = () => { @@ -265,11 +267,15 @@ class Detail extends Component { disconnected: () => { }, received: data => { console.log(`###### ---received data--- ######`); + console.log(data); if (data) { + if ( data.project && data.project.mirror_status === 2) { + this.deleteProjectBack(); + } this.getDetail(); this.setState({ - firstSync:false, - secondSync:false + firstSync: false, + secondSync: false }); cable.subscriptions.consumer.disconnect(); } @@ -277,8 +283,25 @@ class Detail extends Component { }) } + deleteProjectBack = () => { + const { history } = this.props; + const { projectsId, owner } = this.props.match.params; + axios.delete(`/${owner}/${projectsId}.json`).then(res => { + let hash = '/projects/mirror/new'; + if (res && res.data) { + history.push({ + pathname: hash, + mirror_status: 2 + }); + } + else { + window.location.hash = hash; + } + }); + } + getDetail = () => { - const { projectsId , owner } = this.props.match.params; + const { projectsId, owner } = this.props.match.params; this.getBanner(); const url = `/${owner}/${projectsId}/detail.json`; axios.get(url).then((result) => { @@ -295,29 +318,29 @@ class Detail extends Component { watchers_count: result.data.watchers_count, praises_count: result.data.praises_count, forked_count: result.data.forked_count, - defaultBranch:result.data.default_branch + defaultBranch: result.data.default_branch }) } }).catch((error) => { }) } // 获取动态导航栏菜单 - getBanner(){ - const { projectsId , owner } = this.props.match.params; + getBanner() { + const { projectsId, owner } = this.props.match.params; const url = `/${owner}/${projectsId}/menu_list.json`; - axios.get(url).then(result=>{ - if(result){ + axios.get(url).then(result => { + if (result) { this.setState({ - bannerList:result.data + bannerList: result.data }) } - }).catch(error=>{}) + }).catch(error => { }) } // 关注和取消关注 focusFunc = (flag) => { const { platform } = this.state; - if(!platform)return; + if (!platform) return; const { project_id } = this.state; axios({ @@ -332,15 +355,15 @@ class Detail extends Component { this.setWatchersCount(result.data.watchers_count, result.data.watched); } }) - .catch(error => { - console.log(error); - }); + .catch(error => { + console.log(error); + }); } // 点赞和取消点赞 pariseFunc = (flag) => { const { platform } = this.state; - if(!platform)return; + if (!platform) return; const { project_id } = this.state; axios({ method: flag ? 'delete' : 'post', @@ -350,9 +373,9 @@ class Detail extends Component { this.setPraisesCount(result.data.praises_count, result.data.praised) } }) - .catch(error => { - console.log(error); - }); + .catch(error => { + console.log(error); + }); } setWatchersCount = (count, is_watched) => { @@ -372,12 +395,12 @@ class Detail extends Component { // fork项目 forkFunc = () => { const { platform } = this.state; - if(!platform)return; + if (!platform) return; this.setState({ - forkSpin:true + forkSpin: true }) const { current_user } = this.props - const { projectsId , owner } = this.props.match.params; + const { projectsId, owner } = this.props.match.params; const url = `/${owner}/${projectsId}/forks.json`; axios.post(url).then(result => { if (result && result.data.status === 0) { @@ -385,11 +408,11 @@ class Detail extends Component { this.props.showNotification(result.data.message); } this.setState({ - forkSpin:false + forkSpin: false }) }).catch(error => { this.setState({ - forkSpin:false + forkSpin: false }) }) } @@ -397,8 +420,8 @@ class Detail extends Component { // 同步镜像 synchronismMirror = () => { const { platform } = this.state; - if(!platform)return; - const { projectsId , owner } = this.props.match.params; + if (!platform) return; + const { projectsId, owner } = this.props.match.params; const url = `/${owner}/${projectsId}/sync_mirror.json`; axios.post(url).then(result => { if (result && result.data && result.data.status === 0) { @@ -412,344 +435,344 @@ class Detail extends Component { }) } - textFunc = (forked_from_project_id,fork_info)=>{ + textFunc = (forked_from_project_id, fork_info) => { let type = fork_info && fork_info.fork_project_user_type; return forked_from_project_id && fork_info ?
复刻自 - {fork_info.fork_project_user_name} + {fork_info.fork_project_user_name} / - {fork_info.fork_form_name} + {fork_info.fork_form_name}
: "" } - + render() { - const { projectDetail, watchers_count, praises_count, - forked_count, firstSync , secondSync , - isManager, watched, praised, - project , open_devops , platform , defaultBranch , bannerList , forkSpin } = this.state; + const { projectDetail, watchers_count, praises_count, + forked_count, firstSync, secondSync, + isManager, watched, praised, + project, open_devops, platform, defaultBranch, bannerList, forkSpin } = this.state; const url = this.props.history.location.pathname; const urlArr = url.split("/"); const urlFlag = (urlArr.length === 3); - const { projectsId , owner } = this.props.match.params; + const { projectsId, owner } = this.props.match.params; const { current_user } = this.props; - let pathname = checkPathname(projectsId,owner,url); + let pathname = checkPathname(projectsId, owner, url); const { state } = this.props.history.location; - + const common = { getDetail: this.getDetail, - changeOpenDevops:this.changeOpenDevops, + changeOpenDevops: this.changeOpenDevops, defaultBranch } return (
- +
{project && project.author && - {project.author.name} + {project.author.name} } / {projectDetail && projectDetail.name}
- { projectDetail && projectDetail.private && 私有} + {projectDetail && projectDetail.private && 私有}
{ projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ? - this.textFunc(projectDetail.forked_from_project_id,projectDetail.fork_info) - :"" + this.textFunc(projectDetail.forked_from_project_id, projectDetail.fork_info) + : "" } { - projectDetail && projectDetail.type && projectDetail.type !== 0 ? - 镜像自 {projectDetail.mirror_url} - :"" + projectDetail && projectDetail.type && projectDetail.type !== 0 ? + 镜像自 {projectDetail.mirror_url} + : "" }
{ - firstSync ? "": - - { - ((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ? - 同步镜像 : "" - } - - - - + { + watchers_count > 0 ? + platform ? + + {watchers_count} + + : + {watchers_count} + : "" + } + + + + }
{ firstSync ? "" : - + }
{ firstSync ? - - - - : - - - {/* 资源 */} - () - } - > - {/* 主页 */} - () - } - > - {/* wiki新增文件 */} - () - } - > - {/* wiki编辑文件 */} - () - } - > - {/* wiki */} - () - } - > - {/* 工作流 */} - () - } - > - {/* 标签列表 */} - () - } - > - {/* 仓库设置 */} - () - } - > - {/* 任务详情 */} - () - } - > - {/*修改里程碑*/} - () - } - > - {/* 新建里程碑 */} - () - } - > - {/*里程碑详情*/} - () - } - > - {/* 里程碑 */} - () - } - > - {/* 里程碑页面新建任务 */} - () - } - > - {/* 新建任务 */} - () - } - > - {/* 修改详情 */} - () - } - > - {/* 复制详情 */} - () - } - > - {/* 动态 */} - () - } - > - {/* 代码Index */} - () - } - > - {/* 新建合并请求 */} - () - } - > - () - } - > - () - } - > - () - } - > - () - } - > + + + + : + + + {/* 资源 */} + () + } + > + {/* 主页 */} + () + } + > + {/* wiki新增文件 */} + () + } + > + {/* wiki编辑文件 */} + () + } + > + {/* wiki */} + () + } + > + {/* 工作流 */} + () + } + > + {/* 标签列表 */} + () + } + > + {/* 仓库设置 */} + () + } + > + {/* 任务详情 */} + () + } + > + {/*修改里程碑*/} + () + } + > + {/* 新建里程碑 */} + () + } + > + {/*里程碑详情*/} + () + } + > + {/* 里程碑 */} + () + } + > + {/* 里程碑页面新建任务 */} + () + } + > + {/* 新建任务 */} + () + } + > + {/* 修改详情 */} + () + } + > + {/* 复制详情 */} + () + } + > + {/* 动态 */} + () + } + > + {/* 代码Index */} + () + } + > + {/* 新建合并请求 */} + () + } + > + () + } + > + () + } + > + () + } + > + () + } + > - () - } - > - () - } - > - () - } - > - () - } - > - {/* 贡献者列表 */} - () - } - > + () + } + > + () + } + > + () + } + > + () + } + > + {/* 贡献者列表 */} + () + } + > - {/* 代码库----详情页面 */} - () - } - > - () - } - > - () - } - > - () - } - > - - + {/* 代码库----详情页面 */} + () + } + > + () + } + > + () + } + > + () + } + > + + }
) diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index b0f07326..130699b2 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; -import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete } from 'antd'; +import { Input , Form , Select , Checkbox , Button , Spin , AutoComplete, Modal } from 'antd'; import { Base64 } from 'js-base64'; import '../css/index.scss'; @@ -58,6 +58,8 @@ class Index extends Component { this.getGitignore(); // 获取开源许可证 this.getLicenses(); + //判断是否为删除新建项目失败后返回,并执行对应逻辑 + this.isDeleteProjectBack(); } componentDidUpdate=(prevPros)=>{ if(prevPros && this.props && !this.props.checkIfLogin()){ @@ -144,6 +146,31 @@ class Index extends Component { }).catch((error) => { }) } + isDeleteProjectBack = () => { + let mirror_status = this.props.history.location.mirror_status; + if (mirror_status === 2 && sessionStorage.newProjectValue) { + Modal.warning({ + title: '警告', + content: '镜像项目创建失败!请按操作规范重新创建项目!', + }); + let newProjectValue = JSON.parse(sessionStorage.newProjectValue); + if (newProjectValue) { + this.setState({ + project_language_id: newProjectValue.project_language_id, + project_category_id: newProjectValue.project_category_id, + license_id: newProjectValue.license_id, + ignore_id: newProjectValue.ignore_id + }); + delete newProjectValue.project_language_id; + delete newProjectValue.project_category_id; + delete newProjectValue.license_id; + delete newProjectValue.ignore_id; + this.props.form.setFieldsValue(newProjectValue); + } + + } + } + // 设置option setOptionsList = (data, _head, name) => { if (data && data.length > 0) { @@ -172,6 +199,8 @@ class Index extends Component { const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state; const decoderPass = Base64.encode(values.password); const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json"; + // 新建项目的时候,暂存数据,如果失败,返回的时候可以重新赋值 + sessionStorage.newProjectValue=JSON.stringify({...values,project_language_id,project_category_id,license_id,ignore_id}); axios.post(url, { ...values, auth_password:decoderPass, @@ -185,7 +214,7 @@ class Index extends Component { this.setState({ isSpin: false }) - this.props.showNotification(`${projectsType && projectsType === "mirror" ? "镜像" : "托管"}项目创建成功!`); + projectsType && projectsType !== "mirror" && this.props.showNotification(`托管项目创建成功!`); this.props.history.push(`/projects/${result.data.login}/${result.data.identifier}`); } }).catch((error) => { @@ -337,7 +366,9 @@ class Index extends Component { { projectsType && projectsType === "mirror" && -

需要授权验证

+

+ 需要授权验证 + 如果源项目为公有仓库,禁止填写用户名密码。如果源项目为私有仓库,则必须填写正确的用户名和密码!

{ mirrorCheck &&
From 78517853357b85be20483faef0bf923d788fcf32 Mon Sep 17 00:00:00 2001 From: caishi Date: Wed, 25 Aug 2021 14:25:35 +0800 Subject: [PATCH 06/66] =?UTF-8?q?=E5=9B=A2=E9=98=9F=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/Group/GroupForm.jsx | 4 ++-- src/forge/users/Team.jsx | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/forge/Team/Group/GroupForm.jsx b/src/forge/Team/Group/GroupForm.jsx index e27161e0..9d54b034 100644 --- a/src/forge/Team/Group/GroupForm.jsx +++ b/src/forge/Team/Group/GroupForm.jsx @@ -239,7 +239,7 @@ export default Form.create()( 合并请求(启用合并请求和代码评审) - + 版本发布(跟踪项目版本和下载) @@ -249,7 +249,7 @@ export default Form.create()(
- cancelEdit()}>取消 + cancelEdit()}>取消
diff --git a/src/forge/users/Team.jsx b/src/forge/users/Team.jsx index 9378106e..bf401d2c 100644 --- a/src/forge/users/Team.jsx +++ b/src/forge/users/Team.jsx @@ -5,6 +5,7 @@ import Search from '../Component/Search'; import Item from './Team-item'; import Nodata from '../Nodata'; import axios from 'axios'; +import { Link } from 'react-router-dom'; const limit = 15; function Team(props){ @@ -14,7 +15,7 @@ function Team(props){ const [ sort_direction , setSort_direction ] = useState("asc"); const [ sort_by ,setSort_by ] = useState("created_at"); const [ search ,setSearch ] = useState(undefined); - + const { checkIfLogin , showLoginDialog } = props; const { username } = props.match.params; useEffect(()=>{ if(username){ @@ -47,14 +48,6 @@ function Team(props){ ) - function newFunc() { - const { checkIfLogin , showLoginDialog } = props; - if(checkIfLogin()){ - props.history.push(`/organize/new`); - }else{ - showLoginDialog && showLoginDialog(); - } - } return(
@@ -62,7 +55,10 @@ function Team(props){ setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>

- 新建组织 + { + checkIfLogin() && + 新建组织 + } 排序 From e606147d03468be0945b75fd0163be1c8ea89897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Thu, 26 Aug 2021 14:18:14 +0800 Subject: [PATCH 07/66] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=92=8C=E9=A6=96=E9=A1=B5=E7=9A=84=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 75 +++++++++++++++++--- src/forge/Main/Detail.js | 4 +- src/forge/Main/IndexItem.js | 2 +- src/forge/Settings/CollaboratorGroup.jsx | 2 +- src/forge/Team/Group/GroupDetailSetting.jsx | 16 ++--- src/forge/Team/Group/GroupDetails.jsx | 4 +- src/forge/Team/Group/GroupForm.jsx | 8 +-- src/forge/Team/Index.jsx | 10 +-- src/forge/Team/New.jsx | 2 +- src/forge/Team/RightBox.jsx | 8 +-- src/forge/Team/Setting/TeamSettingCommon.jsx | 2 +- src/forge/Team/Setting/TeamSettingIndex.jsx | 22 +++--- src/forge/Team/Sub/Detail.jsx | 20 +++--- src/forge/Team/Sub/SubDetail.jsx | 12 ++-- src/forge/Team/TeamGroupItems.jsx | 6 +- src/forge/users/Index.jsx | 3 +- src/forge/users/Infos.js | 3 +- src/forge/users/Team-item.jsx | 2 +- 18 files changed, 129 insertions(+), 72 deletions(-) diff --git a/src/App.js b/src/App.js index e6f1fc3e..17be118b 100644 --- a/src/App.js +++ b/src/App.js @@ -100,6 +100,27 @@ class App extends Component { mydisplay: false, occupation: 0, mygetHelmetapi: null, + pathType: null, + } + } + + UNSAFE_componentWillMount() { + initAxiosInterceptors(this.props); + let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : ''; + pathname && this.getPathnameType(pathname); + } + + getPathnameType = (pathname) => { + let keyWord = ["Gitlink", "Trustie", "explore", "settings", "setting", "CCF", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email",]; + if (!keyWord.includes('pathname')) { + let url = `/owners/${pathname}.json`; + axios.get(url).then((response) => { + if (response && response.status === 200) { + this.setState({ + pathType: response.data.type || '404' + }) + } + }); } } @@ -119,7 +140,7 @@ class App extends Component { componentDidMount() { document.title = "loading..."; - initAxiosInterceptors(this.props); + this.getAppdata(); window.addEventListener('error', (event) => { @@ -196,7 +217,7 @@ class App extends Component { }; render() { - const { mygetHelmetapi } = this.state; + const { mygetHelmetapi, pathType } = this.state; let personal = mygetHelmetapi && mygetHelmetapi.personal; return ( @@ -251,27 +272,61 @@ class App extends Component { - { - return () - } - }> - + {/*404*/} {/* 查询 */} + ( + personal && personal.length > 0 ? + + : + + ) + } + /> + + {/* 判断为用户/组织,并进入对应页面 */} + { + pathType === 'User' ? + { + return () + } + } + /> : pathType === 'Organization' ? { + return () + } + }> + : pathType === '404' ? : + } + + + {/* 组织 */} + {/* { + return () + } + }> + */} {/* 个人主页 */} - { return () } }> + ( diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index f01ef2d3..583b4db3 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -417,7 +417,7 @@ class Detail extends Component { return forked_from_project_id && fork_info ?

复刻自 - {fork_info.fork_project_user_name} + {fork_info.fork_project_user_name} / {fork_info.fork_form_name}
: "" @@ -453,7 +453,7 @@ class Detail extends Component {
{project && project.author && - {project.author.name} + {project.author.name} } / {projectDetail && projectDetail.name} diff --git a/src/forge/Main/IndexItem.js b/src/forge/Main/IndexItem.js index fcfa2d2a..4e83e439 100644 --- a/src/forge/Main/IndexItem.js +++ b/src/forge/Main/IndexItem.js @@ -28,7 +28,7 @@ class IndexItem extends Component { : - + } diff --git a/src/forge/Settings/CollaboratorGroup.jsx b/src/forge/Settings/CollaboratorGroup.jsx index c6ab6ffb..3afd9e03 100644 --- a/src/forge/Settings/CollaboratorGroup.jsx +++ b/src/forge/Settings/CollaboratorGroup.jsx @@ -77,7 +77,7 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) { title: "团队名", dataIndex: "name", render: (value, item) => { - return {value}; + return {value}; }, }, { diff --git a/src/forge/Team/Group/GroupDetailSetting.jsx b/src/forge/Team/Group/GroupDetailSetting.jsx index fa060ee3..e8be3722 100644 --- a/src/forge/Team/Group/GroupDetailSetting.jsx +++ b/src/forge/Team/Group/GroupDetailSetting.jsx @@ -26,18 +26,18 @@ export default (props)=>{ function returnActive (pathname){ let a = 0; - if(pathname === `/organize/${OIdentifier}/group/${groupId}/setting/member`){ + if(pathname === `/${OIdentifier}/group/${groupId}/setting/member`){ a = 1; - }else if(pathname === `/organize/${OIdentifier}/group/${groupId}/setting/project`){ + }else if(pathname === `/${OIdentifier}/group/${groupId}/setting/project`){ a = 2; } return a; } const active = returnActive(pathname); const array = {list:[ - {name:'基本设置',icon:"icon-base",href:`/organize/${OIdentifier}/group/${groupId}/setting`}, - {name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${OIdentifier}/group/${groupId}/setting/member`}, - {name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/organize/${OIdentifier}/group/${groupId}/setting/project`}, + {name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/group/${groupId}/setting`}, + {name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/group/${groupId}/setting/member`}, + {name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/group/${groupId}/setting/project`}, ], active } @@ -51,19 +51,19 @@ export default (props)=>{ ( )} > ( )} > ( )} diff --git a/src/forge/Team/Group/GroupDetails.jsx b/src/forge/Team/Group/GroupDetails.jsx index 75183f35..64b52964 100644 --- a/src/forge/Team/Group/GroupDetails.jsx +++ b/src/forge/Team/Group/GroupDetails.jsx @@ -89,7 +89,7 @@ export default ((props) => { axios.delete(url).then((result) => { if (result && result.data) { props.showNotification(`已成功退出团队!`); - props.history.push(`/organize/${OIdentifier}`); + props.history.push(`/${OIdentifier}`); } }).catch((error) => { }); } @@ -119,7 +119,7 @@ export default ((props) => {

管理员团队对 所有仓库 具有操作权限,且对组织具有 管理员权限

此外,该团队拥有了 创建仓库 的权限:成员可以在组织中创建新的仓库。

- {group.is_admin ? : ""} + {group.is_admin ? : ""}
: diff --git a/src/forge/Team/Group/GroupForm.jsx b/src/forge/Team/Group/GroupForm.jsx index 2eb8540f..108ef240 100644 --- a/src/forge/Team/Group/GroupForm.jsx +++ b/src/forge/Team/Group/GroupForm.jsx @@ -76,7 +76,7 @@ export default Form.create()( }).then(result => { if (result && result.data) { showNotification("基本设置更新成功!"); - history.push(`/organize/${OIdentifier}/group/${groupId}`); + history.push(`/${OIdentifier}/group/${groupId}`); } }).catch(error => { }) } else { @@ -86,7 +86,7 @@ export default Form.create()( }).then(result => { if (result && result.data) { showNotification("团队创建成功!"); - history.push(`/organize/${OIdentifier}/group/${result.data.id}`); + history.push(`/${OIdentifier}/group/${result.data.id}`); } }).catch(error => { }) } @@ -134,9 +134,9 @@ export default Form.create()( function cancelEdit(){ if(groupId){ - history.push(`/organize/${OIdentifier}/group/${groupId}`); + history.push(`/${OIdentifier}/group/${groupId}`); }else{ - history.push(`/organize/${OIdentifier}`); + history.push(`/${OIdentifier}`); } } diff --git a/src/forge/Team/Index.jsx b/src/forge/Team/Index.jsx index fd4afedf..2b75a35e 100644 --- a/src/forge/Team/Index.jsx +++ b/src/forge/Team/Index.jsx @@ -33,28 +33,28 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC( {/* 组织团队-设置 */} { return }} > {/* 组织团队-新建 */} { return }} > {/* 组织团队-子级(包含组织团队列表) */} { return }} > {/* 组织成员 */} { return }} @@ -68,7 +68,7 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC( > {/* 组织详情(包含组织设置) */} ( )} diff --git a/src/forge/Team/New.jsx b/src/forge/Team/New.jsx index 1f06dc22..414a8d15 100644 --- a/src/forge/Team/New.jsx +++ b/src/forge/Team/New.jsx @@ -49,7 +49,7 @@ export default Form.create()( }).then(result=>{ if(result && result.data){ showNotification("组织创建成功!"); - history.push(`/organize/${result.data.name}`); + history.push(`/${result.data.name}`); } }).catch(error=>{}) } diff --git a/src/forge/Team/RightBox.jsx b/src/forge/Team/RightBox.jsx index 0603a454..5425e622 100644 --- a/src/forge/Team/RightBox.jsx +++ b/src/forge/Team/RightBox.jsx @@ -67,7 +67,7 @@ function RightBox({ OIdentifier , history , admin }) {
{ memberData && memberData.organization_users && memberData.organization_users.length>0 ? - + { memberData.organization_users.map((item,key)=>{ return( @@ -87,8 +87,8 @@ function RightBox({ OIdentifier , history , admin }) { history.push(`/organize/${OIdentifier}/group/new`)}>新建团队} - url={`/organize/${OIdentifier}/group`} + bottom={admin && } + url={`/${OIdentifier}/group`} > { groupData && groupData.teams && groupData.teams.length>0? @@ -97,7 +97,7 @@ function RightBox({ OIdentifier , history , admin }) { return(
- {item.name} + {item.name} {item.num_users}名成员 {item.num_projects}个仓库 diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index 5be03db0..44174359 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -62,7 +62,7 @@ export default Form.create()( showNotification("组织信息更新成功!"); if(values.name !== organizeDetail.name){ console.log("false111"); - history.push(`/organize/${values.name}/setting`); + history.push(`/${values.name}/setting`); } updateFunc && updateFunc(values.name,values.description); } diff --git a/src/forge/Team/Setting/TeamSettingIndex.jsx b/src/forge/Team/Setting/TeamSettingIndex.jsx index 718f5b5f..462a92d1 100644 --- a/src/forge/Team/Setting/TeamSettingIndex.jsx +++ b/src/forge/Team/Setting/TeamSettingIndex.jsx @@ -30,21 +30,21 @@ export default (( props )=>{ function returnActive (pathname){ let a = 0; - if(pathname === `/organize/${OIdentifier}/setting/member`){ + if(pathname === `/${OIdentifier}/setting/member`){ a = 1; - }else if(pathname === `/organize/${OIdentifier}/setting/group`){ + }else if(pathname === `/${OIdentifier}/setting/group`){ a = 2; - }else if(pathname === `/organize/${OIdentifier}/setting/hooks`){ + }else if(pathname === `/${OIdentifier}/setting/hooks`){ a = 3; } return a; } const active = returnActive(pathname); const array = {list:[ - {name:'基本设置',icon:"icon-base",href:`/organize/${OIdentifier}/setting`}, - {name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${OIdentifier}/setting/member`}, - {name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/organize/${OIdentifier}/setting/group`}, - // {name:'管理web钩子',icon:"icon-zhongqingdianxinicon10",href:`/organize/${OIdentifier}/setting/hooks`} + {name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/setting`}, + {name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/setting/member`}, + {name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/setting/group`}, + // {name:'管理web钩子',icon:"icon-zhongqingdianxinicon10",href:`/${OIdentifier}/setting/hooks`} ], active } @@ -58,25 +58,25 @@ export default (( props )=>{
( )} > ( )} > ( )} > ( )} diff --git a/src/forge/Team/Sub/Detail.jsx b/src/forge/Team/Sub/Detail.jsx index 6e048a05..36d8a916 100644 --- a/src/forge/Team/Sub/Detail.jsx +++ b/src/forge/Team/Sub/Detail.jsx @@ -38,12 +38,12 @@ function Detail(props){ // 设置页面:顶部不需要设置按钮了 useEffect(()=>{ if(pathname){ - if(pathname.indexOf(`/organize/${OIdentifier}/setting`)>-1){ + if(pathname.indexOf(`/${OIdentifier}/setting`)>-1){ setFlag(false); }else{ setFlag(true); } - if(pathname.indexOf(`/organize/${OIdentifier}/group`)>-1 || pathname.indexOf(`/organize/${OIdentifier}/member`)>-1){ + if(pathname.indexOf(`/${OIdentifier}/group`)>-1 || pathname.indexOf(`/${OIdentifier}/member`)>-1){ setButtonflagFlag(true); }else{ setButtonflagFlag(false); @@ -84,12 +84,12 @@ function Detail(props){ rightBtn={ {flag && !buttonflag && detail.is_admin ? - 设置 + 设置 :""} {buttonflag && - 组织成员{detail.num_users && {detail.num_users}} - 组织团队{detail.num_teams &&{detail.num_teams}} + 组织成员{detail.num_users && {detail.num_users}} + 组织团队{detail.num_teams &&{detail.num_teams}} } @@ -112,33 +112,33 @@ function Detail(props){ {/* 组织团队-详情 */} { return }} > {/* 组织成员 */} { return }} > {/* 组织团队 */} { return }} > { return }} > { return }} diff --git a/src/forge/Team/Sub/SubDetail.jsx b/src/forge/Team/Sub/SubDetail.jsx index 7b653c55..94ac6a2a 100644 --- a/src/forge/Team/Sub/SubDetail.jsx +++ b/src/forge/Team/Sub/SubDetail.jsx @@ -22,7 +22,7 @@ export default ((props)=>{ // 设置页面:顶部不需要设置按钮了 useEffect(()=>{ if(pathname){ - if(pathname.indexOf(`/organize/${OIdentifier}/group/${groupId}/setting`)>-1){ + if(pathname.indexOf(`/${OIdentifier}/group/${groupId}/setting`)>-1){ setFlag(false); }else{ setFlag(true); @@ -48,19 +48,19 @@ export default ((props)=>{
- {OIdentifier} + {OIdentifier} {detail ? detail.name : "新建团队"}
{ detail && - 组织成员{detail.num_users && {detail.num_users}} - 组织团队{detail.num_teams &&{detail.num_teams}} + 组织成员{detail.num_users && {detail.num_users}} + 组织团队{detail.num_teams &&{detail.num_teams}} } desc={!flag && detail.description} @@ -69,7 +69,7 @@ export default ((props)=>{ {/* 组织团队-设置 */} { return }} diff --git a/src/forge/Team/TeamGroupItems.jsx b/src/forge/Team/TeamGroupItems.jsx index e96a310d..b482942c 100644 --- a/src/forge/Team/TeamGroupItems.jsx +++ b/src/forge/Team/TeamGroupItems.jsx @@ -53,7 +53,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){ } // 团队设置 function toGroupSetting(id){ - history.push(`/organize/${organizeDetail && organizeDetail.name}/group/${id}/setting`); + history.push(`/${organizeDetail && organizeDetail.name}/group/${id}/setting`); } // 解散团队 function disMissGroup(id){ @@ -75,7 +75,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){ return(

- {item.nickname} + {item.nickname} { item.is_admin && item.authorize!=="owner" && disMissGroup(item.id)}>解散团队} { item.is_member && } @@ -89,7 +89,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){ k < count ? : k === count ? - + :"" ) }) diff --git a/src/forge/users/Index.jsx b/src/forge/users/Index.jsx index ce5aeda7..c7f6fe92 100644 --- a/src/forge/users/Index.jsx +++ b/src/forge/users/Index.jsx @@ -12,11 +12,12 @@ const Infos = Loadable({ }); export default withRouter( (CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props)=>{ + console.log(props); return(

( )} diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index a588cb8b..bcd01113 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -72,6 +72,7 @@ class Infos extends Component { renderPath=(pathname)=>{ const { username } = this.props.match.params; + console.log(username); if(pathname === `/users/${username}`){ this.setState({menuKey:"0",route_type:undefined}); }else if(pathname === `/users/${username}/statistics`){ @@ -226,7 +227,7 @@ class Infos extends Component { - cancelEdit()}>取消 + cancelEdit()}>取消
diff --git a/src/forge/users/Team.jsx b/src/forge/users/Team.jsx index 9378106e..bf401d2c 100644 --- a/src/forge/users/Team.jsx +++ b/src/forge/users/Team.jsx @@ -5,6 +5,7 @@ import Search from '../Component/Search'; import Item from './Team-item'; import Nodata from '../Nodata'; import axios from 'axios'; +import { Link } from 'react-router-dom'; const limit = 15; function Team(props){ @@ -14,7 +15,7 @@ function Team(props){ const [ sort_direction , setSort_direction ] = useState("asc"); const [ sort_by ,setSort_by ] = useState("created_at"); const [ search ,setSearch ] = useState(undefined); - + const { checkIfLogin , showLoginDialog } = props; const { username } = props.match.params; useEffect(()=>{ if(username){ @@ -47,14 +48,6 @@ function Team(props){ ) - function newFunc() { - const { checkIfLogin , showLoginDialog } = props; - if(checkIfLogin()){ - props.history.push(`/organize/new`); - }else{ - showLoginDialog && showLoginDialog(); - } - } return(
@@ -62,7 +55,10 @@ function Team(props){ setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>

- 新建组织 + { + checkIfLogin() && + 新建组织 + } 排序 From d8ab7c0759dfe3be069a4184d1e588f25970aa58 Mon Sep 17 00:00:00 2001 From: caishi Date: Thu, 26 Aug 2021 17:29:28 +0800 Subject: [PATCH 09/66] =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88-=E7=AC=AC=E4=BA=8C=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Component/AddGroup.jsx | 1 + src/forge/Main/CoderDepot.jsx | 11 +++++---- src/forge/Merge/merge.js | 2 +- src/forge/New/Index.js | 12 ++++------ src/forge/Settings/Collaborator.js | 15 ++++++++---- src/forge/Settings/CollaboratorGroup.jsx | 22 ++++++++--------- src/forge/Team/Group/GroupForm.jsx | 25 ++++++++++++++------ src/forge/Team/List.jsx | 2 +- src/forge/Team/Setting/TeamSettingCommon.jsx | 2 +- 9 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/forge/Component/AddGroup.jsx b/src/forge/Component/AddGroup.jsx index 656175d5..feff6f37 100644 --- a/src/forge/Component/AddGroup.jsx +++ b/src/forge/Component/AddGroup.jsx @@ -55,6 +55,7 @@ function AddGroup({organizeId,getGroupID}){ function addCollaborator(){ getGroupID && getGroupID(id); + setID(undefined); } return( diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index cfe3c6a8..165f06ca 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -147,6 +147,7 @@ function CoderDepot(props){ setReadme(result.data.readme); setEditReadme(false); setHide(true); + console.log("dddd:",result.data.entries); } setTimeout(function(){setIsSpin(false);},500); }).catch(error=>{setIsSpin(false);}) @@ -383,7 +384,7 @@ function CoderDepot(props){ { - dirInfo || fileInfo ? + (dirInfo && dirInfo.length>0) || (fileInfo && fileInfo.length>0) ?

{ lastCommit && @@ -425,7 +426,7 @@ function CoderDepot(props){ }) } { - fileInfo && + fileInfo && fileInfo.length > 0 && :"" + (dirInfo && dirInfo.length === 0) && !fileInfo ? :"" } {/* readme文件显示(显示文件详情时不显示readme文件) */} { dirInfo && (readme && readme.content) ? :"" } @@ -511,11 +512,11 @@ function CoderDepot(props){ } {/* 贡献者 */} { - projectDetail && projectDetail.contributors && + projectDetail && projectDetail.contributors && projectDetail.contributors.length >0 && } {/* 语言 */} - { projectDetail && projectDetail.languages && + { projectDetail && projectDetail.languages && projectDetail.languages.length >0 && diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js index 90e35dcc..5bb128c1 100644 --- a/src/forge/Merge/merge.js +++ b/src/forge/Merge/merge.js @@ -255,7 +255,7 @@ class merge extends Component { />
{ - data && data.user_admin_or_member && + data && data.user_admin_or_developer && this.checkOperation()}> + 新建合并请求 diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index 130699b2..18f2aa9a 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -71,6 +71,7 @@ class Index extends Component { getOwner=()=>{ const { OIdentifier } = this.props.match.params; const { user_id } = this.props && this.props.current_user; + const url = `/owners.json`; axios.get(url).then(result=>{ if(result && result.data){ @@ -79,16 +80,13 @@ class Index extends Component { OwnerList: owner, }) if(OIdentifier){ - owner = owner.filter(item=>item.name === OIdentifier); - this.props.form.setFieldsValue({ - user_id:OIdentifier - }) + owner = owner.filter(item=>item.login === OIdentifier); }else if(user_id){ owner = owner.filter(item=>item.id === user_id); - this.props.form.setFieldsValue({ - user_id:owner && owner[0].name - }) } + this.props.form.setFieldsValue({ + user_id:owner && owner[0].name + }) owner && this.setState({ owners_id:owner[0].id, owners_name:owner[0].name diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js index 0b94eee5..0a50cae1 100644 --- a/src/forge/Settings/Collaborator.js +++ b/src/forge/Settings/Collaborator.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState , useRef } from "react"; import {WhiteBack} from '../Component/layout'; import AddMember from '../Component/AddMember'; import AddGroup from '../Component/AddGroup'; @@ -8,9 +8,11 @@ import Group from './CollaboratorGroup'; function Collaborator(props){ const [ nav , setNav] = useState("1"); const [ newId , setNewId] = useState(undefined); + const [ addOperation , setAddOperation] = useState(true); const [ newGroupId , setNewGroupId] = useState(undefined); const {projectsId ,owner} = props.match.params; + const author = props && props.projectDetail && props.projectDetail.author; function getID(id){ @@ -19,6 +21,7 @@ function Collaborator(props){ function getGroupID(id){ setNewGroupId(id); } + return ( @@ -27,15 +30,17 @@ function Collaborator(props){ author && author.type === "Organization" ? {setNav("1");setNewId(undefined)}}>协作者管理 - {setNav("2");setNewId(undefined)}}>团队管理 + {setNav("2");setNewId(undefined);setNewGroupId(undefined)}}>团队管理 : 协作者管理 } { - nav === "1" ? + nav === "1" && - : + } + { + (nav !== "1" && addOperation) && }
@@ -44,7 +49,7 @@ function Collaborator(props){ nav === "1" ? : - + }
diff --git a/src/forge/Settings/CollaboratorGroup.jsx b/src/forge/Settings/CollaboratorGroup.jsx index c6ab6ffb..eb9430f3 100644 --- a/src/forge/Settings/CollaboratorGroup.jsx +++ b/src/forge/Settings/CollaboratorGroup.jsx @@ -10,7 +10,7 @@ const roles = { read: "报告者", }; const limit = 15; -function CollaboratorGroup({ newGroupId, owner, projectsId }) { +function CollaboratorGroup({ newGroupId, owner, projectsId , setAddOperation }) { const [list, setList] = useState(undefined); const [isSpin, setIsSpin] = useState(true); const [page, setPage] = useState(1); @@ -34,6 +34,7 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) { setList(result.data.teams); setTotal(result.data.total_count); setIsSpin(false); + setAddOperation(result.data.can_add); } }) .catch((error) => {}); @@ -47,16 +48,15 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) { // 添加团队 function addGroup(id) { const url = `/${owner}/${projectsId}/teams.json`; - axios - .post(url, { - team_id: id, - }) - .then((result) => { - if (result && result.data) { - getData(); - } - }) - .catch((error) => {}); + axios.post(url, { + team_id: id, + }) + .then((result) => { + if (result && result.data) { + getData(); + } + }) + .catch((error) => {}); } // 删除团队 diff --git a/src/forge/Team/Group/GroupForm.jsx b/src/forge/Team/Group/GroupForm.jsx index 9d54b034..3e5407ad 100644 --- a/src/forge/Team/Group/GroupForm.jsx +++ b/src/forge/Team/Group/GroupForm.jsx @@ -34,6 +34,13 @@ export default Form.create()( const { getFieldDecorator, validateFields, setFieldsValue } = form; const { OIdentifier, groupId } = match.params; + useEffect(()=>{ + setFieldsValue({ + authorize:"read", + includes_all_project:0 + }) + },[]) + useEffect(() => { if (GroupDetail) { setOnwers(GroupDetail.authorize === "owner"); @@ -42,6 +49,7 @@ export default Form.create()( setSwtichBox(GroupDetail.units) setFieldsValue({ ...GroupDetail, + includes_all_project:GroupDetail.includes_all_project ? 1 :0 }) setDescNum(GroupDetail.description ? GroupDetail.description.length : 0); } @@ -72,11 +80,13 @@ export default Form.create()( setIsSpin(true) validateFields((error, values) => { if (!error) { - values.unit_types = switch_box + // values.unit_types = switch_box + values.unit_types = ['code','pulls','issues','releases','wiki']; if (groupId) { // 表示编辑,否则为新建 const url = `/organizations/${OIdentifier}/teams/${groupId}.json`; axios.put(url, { - ...values + ...values, + includes_all_project:values.includes_all_project === 1?true:false }).then(result => { if (result && result.data) { showNotification("基本设置更新成功!"); @@ -86,7 +96,8 @@ export default Form.create()( } else { const url = `/organizations/${OIdentifier}/teams.json`; axios.post(url, { - ...values + ...values, + includes_all_project:values.includes_all_project === 1?true:false }).then(result => { if (result && result.data) { showNotification("团队创建成功!"); @@ -204,8 +215,8 @@ export default Form.create()( "includes_all_project", [], - 指定项目(团队成员将只能访问添加到团队的项目。 选择此项 将不会 自动删除已经添加的项目) - 所有项目(团队可以访问所有项目。选择此选项将 添加所有现有的 项目到指定团队) + 指定项目(团队成员将只能访问添加到团队的项目。 选择此项 将不会 自动删除已经添加的项目) + 所有项目(团队可以访问所有项目。选择此选项将 添加所有现有的 项目到指定团队) , false, 0,onwers ? "hide":"" )} {helper( @@ -225,7 +236,7 @@ export default Form.create()( , false, 20,onwers ? "hide":"" )} -
+ {/*

允许访问项目单元:

@@ -247,7 +258,7 @@ export default Form.create()( wiki(编辑此仓库的相关文档说明) -
+
*/} cancelEdit()}>取消
diff --git a/src/forge/Team/List.jsx b/src/forge/Team/List.jsx index b43fb75d..8cf96587 100644 --- a/src/forge/Team/List.jsx +++ b/src/forge/Team/List.jsx @@ -75,7 +75,7 @@ function List(props){

- { organizeDetail && organizeDetail.is_admin ? + { organizeDetail && organizeDetail.can_create_project ? + 新建项目 diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index 5be03db0..e52361ad 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -168,7 +168,7 @@ export default Form.create()( '权限:', "repo_admin_change_team_access", [], - 仓库管理员可以添加或移除团队的访问权限,false,true + 项目管理员可以添加或移除团队的访问权限,false,true )} {helper( From e7fd980116f155a51500a6b6742dabb8e7cb1c35 Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 27 Aug 2021 10:53:00 +0800 Subject: [PATCH 10/66] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=9B=A2=E9=98=9F?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/CoderDepot.jsx | 4 ++-- src/forge/Settings/CollaboratorGroup.jsx | 6 +++++- src/forge/Team/RightBox.jsx | 7 ++++++- src/forge/Team/TeamGroupItems.jsx | 7 ++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 165f06ca..227aac79 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -384,7 +384,7 @@ function CoderDepot(props){ { - (dirInfo && dirInfo.length>0) || (fileInfo && fileInfo.length>0) ? + (dirInfo && dirInfo.length>0) || fileInfo ?

{ lastCommit && @@ -426,7 +426,7 @@ function CoderDepot(props){ }) } { - fileInfo && fileInfo.length > 0 && + fileInfo && { - return {value}; + if(item.is_admin || item.is_member){ + return {value}; + }else{ + return {value}; + } }, }, { diff --git a/src/forge/Team/RightBox.jsx b/src/forge/Team/RightBox.jsx index 0603a454..daa339f2 100644 --- a/src/forge/Team/RightBox.jsx +++ b/src/forge/Team/RightBox.jsx @@ -97,7 +97,12 @@ function RightBox({ OIdentifier , history , admin }) { return(
- {item.name} + { + (item.is_admin || item.is_member) ? + {item.name} + : + {item.name} + } {item.num_users}名成员 {item.num_projects}个仓库 diff --git a/src/forge/Team/TeamGroupItems.jsx b/src/forge/Team/TeamGroupItems.jsx index e96a310d..f3f5b876 100644 --- a/src/forge/Team/TeamGroupItems.jsx +++ b/src/forge/Team/TeamGroupItems.jsx @@ -75,7 +75,12 @@ function TeamGroupItems({organizeDetail,limit, count , history}){ return(

- {item.nickname} + { + (item.is_admin || item.is_member) ? + {item.nickname} + : + {item.nickname} + } { item.is_admin && item.authorize!=="owner" && disMissGroup(item.id)}>解散团队} { item.is_member && } From dee7b23f3e5cd73872d136feaaad95e4f7f6b945 Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 27 Aug 2021 11:44:41 +0800 Subject: [PATCH 11/66] =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E5=88=B0=E7=BB=84?= =?UTF-8?q?=E7=BB=87-=E6=8F=90=E7=A4=BA=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Divert/DivertModal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/forge/Divert/DivertModal.jsx b/src/forge/Divert/DivertModal.jsx index a6ecdc05..40dd6829 100644 --- a/src/forge/Divert/DivertModal.jsx +++ b/src/forge/Divert/DivertModal.jsx @@ -104,7 +104,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){ :

    -
  • 仓库仅可以转移到您已经加入的组织中,不可以转移到未加入的组织中
  • +
  • 仓库仅可以转移到您具有管理权限的组织中
  • 涉及到仓库改名操作,请提前做好仓库备份并且在转移后对本地仓库的remote进行修改
  • 转移仓库到组织后,你和组织创建者/管理员同时拥有对该仓库的管理操作
From a1b5395b8c47b8027cc4ef02f01902b920027eaa Mon Sep 17 00:00:00 2001 From: caishi Date: Fri, 27 Aug 2021 14:04:27 +0800 Subject: [PATCH 12/66] =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82-?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6=E6=94=B9=E6=88=90user=5Fad?= =?UTF-8?q?min=5For=5Fmember?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Merge/MergeItem.js | 4 ++-- src/forge/Merge/merge.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index 32f3f811..f21cc3f5 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -49,7 +49,7 @@ class MergeItem extends Component { }; render() { - const { issues, project_name, project_author_name , user_admin_or_member} = this.props; + const { issues, project_name, project_author_name , user_admin_or_developer} = this.props; const { projectsId , owner } = this.props.match.params; const { current_user } = this.props; const renderList = () => { @@ -183,7 +183,7 @@ class MergeItem extends Component { ) : ( "" )} - {user_admin_or_member && item.pull_request_status === 0 ? ( + {user_admin_or_developer && item.pull_request_status === 0 ? (
{data && data.search_count && data.search_count > 0 ? (
- + user_admin_or_developer={data && data.user_admin_or_developer} + >
):""} {search_count > select_params.limit ? ( From 492e8e067f9ae6729f92d28fdd03ff874074783c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Fri, 27 Aug 2021 16:07:21 +0800 Subject: [PATCH 13/66] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=EF=BC=8Cwiki=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/sub/DetailBanner.jsx | 16 ++++++++-------- src/forge/Settings/Setting.js | 2 +- src/forge/Wiki/Index.jsx | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx index e0ca4db1..3c37a730 100644 --- a/src/forge/Main/sub/DetailBanner.jsx +++ b/src/forge/Main/sub/DetailBanner.jsx @@ -85,14 +85,14 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa :"" } { - item.menu_name === "resources" && -
  • - - - 资源库 - {projectDetail && projectDetail.source_count ? {projectDetail.source_count} :""} - -
  • + // item.menu_name === "resources" && + //
  • + // + // + // 资源库 + // {projectDetail && projectDetail.source_count ? {projectDetail.source_count} :""} + // + //
  • } { item.menu_name === "versions" && diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index ba6e7a5a..e4ec2766 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -16,7 +16,7 @@ const menu = [ {name:"合并请求",index:"pulls"}, {name:"Wiki",index:"wiki"}, {name:"工作流(beta版)",index:"devops"}, - {name:"资源库",index:"resources"}, + // {name:"资源库",index:"resources"}, {name:"里程碑",index:"versions"}, {name:"动态",index:"activity"}, ] diff --git a/src/forge/Wiki/Index.jsx b/src/forge/Wiki/Index.jsx index c27879b2..af883a94 100644 --- a/src/forge/Wiki/Index.jsx +++ b/src/forge/Wiki/Index.jsx @@ -266,7 +266,7 @@ export default (props) => { {itemDetail.image_url && 头像} {itemDetail.userName} - 上次修改于{checkItem.commit && timeAgo(checkItem.commit.author.when)} + 上次修改于{checkItem.commit ? timeAgo(checkItem.commit.author.when):'刚刚'}
    {permission && }
    From 349c2a6f35b5c0a726279bf5f7afcd5e148f1bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Fri, 27 Aug 2021 16:31:15 +0800 Subject: [PATCH 14/66] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/DateUtil.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/DateUtil.js b/src/common/DateUtil.js index 630b2d7d..8846d274 100644 --- a/src/common/DateUtil.js +++ b/src/common/DateUtil.js @@ -107,7 +107,7 @@ export function timeAgo(backDate) { try { moment(backDate); } catch (e) { - return; + return '刚刚'; } if(typeof backDate ==='number'){ backDate=backDate*1000 @@ -134,4 +134,5 @@ export function timeAgo(backDate) { if (seconds) { return seconds + "秒前"; } + return "刚刚"; } \ No newline at end of file From eb02b814a9a6568c2b9a459dd2e7d8c612fd9b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Mon, 30 Aug 2021 10:31:51 +0800 Subject: [PATCH 15/66] =?UTF-8?q?=E4=BF=AE=E6=94=B9user=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 241 ++++++++++-------- src/college/College.js | 2 +- src/context/TPIContextProvider.js | 4 +- src/forge/Activity/ActivityItem.js | 2 +- src/forge/Component/Contributors.jsx | 6 +- src/forge/Component/MemberCards.jsx | 4 +- src/forge/Component/User.jsx | 2 +- src/forge/Head/Header.js | 8 +- src/forge/Main/CoderRootCommit.js | 2 +- src/forge/Main/Detail.js | 5 +- src/forge/Main/IndexItem.js | 2 +- src/forge/Main/sub/Contribute.jsx | 2 +- src/forge/Merge/MergeItem.js | 6 +- src/forge/Merge/MergeSubmit.js | 2 +- src/forge/Merge/MessageCount.js | 6 +- src/forge/Newfile/UserSubmitComponent.js | 2 +- src/forge/Notice/Apply.jsx | 6 +- src/forge/Notice/Index.jsx | 20 +- src/forge/Notice/Notify.jsx | 10 +- src/forge/Notice/UndoEvent.jsx | 8 +- src/forge/Order/Detail.js | 4 +- src/forge/Order/OrderItem.js | 4 +- src/forge/Settings/CollaboratorMember.jsx | 4 +- src/forge/Settings/Setting.js | 2 +- src/forge/Source/Index.jsx | 2 +- .../Team/Group/Setting/GroupMemberSetting.jsx | 2 +- src/forge/Team/New.jsx | 5 + src/forge/Team/RightBox.jsx | 4 +- src/forge/Team/Setting/TeamSettingCommon.jsx | 2 +- src/forge/Team/Setting/TeamSettingMember.jsx | 4 +- src/forge/Team/TeamGroupItems.jsx | 2 +- src/forge/UsersList/fork_users.js | 2 +- src/forge/UsersList/user_list.js | 4 +- src/forge/Wiki/Index.jsx | 2 +- src/forge/comments/children_comments.js | 4 +- src/forge/comments/children_journals.js | 4 +- src/forge/comments/comments.js | 6 +- .../users/GeneralView/ConcentrateProject.jsx | 2 +- src/forge/users/Index.jsx | 3 - src/forge/users/Infos.js | 61 +++-- src/forge/users/Material/Base.jsx | 10 +- src/forge/users/Material/Index.jsx | 8 +- src/forge/users/Material/Password.jsx | 2 +- src/forge/users/Statistics/Index.jsx | 8 +- src/forge/users/common_lists.js | 2 +- src/index.js | 7 +- src/modules/comment/Comments.js | 8 +- src/modules/comment/CommentsHOC.js | 2 +- .../courses/common/comments/CCommentItem.js | 8 +- .../courses/common/comments/CommonReply.js | 2 +- .../CompetitionContentsChart.js | 8 +- .../courses/coursesDetail/CoursesBanner.js | 6 +- .../shixunHomework/ShixunhomeWorkItem.js | 2 +- src/modules/ecs/Home/index.js | 2 +- src/modules/message/js/Leftdialogue.js | 2 +- src/modules/message/js/MessagSub.js | 6 +- src/modules/message/js/MessagePrivate.js | 2 +- src/modules/message/js/Messagerouting.js | 2 +- src/modules/message/js/Rightdialogue.js | 2 +- src/modules/page/LeftNav.js | 4 +- src/modules/tpm/NewHeader.js | 8 +- src/modules/tpm/TPMIndexHOC.js | 2 +- src/modules/tpm/component/TPMRightSection.js | 2 +- .../ShixunDiscuss/ShixunDiscuss.js | 2 +- src/modules/user/usersInfo/Infos.js | 18 +- src/modules/user/usersInfo/InfosBanner.js | 8 +- src/modules/user/usersInfo/InfosIndex.js | 8 +- src/modules/user/usersInfo/InfosTopics.js | 2 +- .../user/usersInfo/banks/BanksIndex.js | 2 +- src/modules/user/usersInfo/banks/banksMenu.js | 2 +- src/modules/user/usersInfo/banner_out.js | 10 +- .../user/usersInfo/video/EditVideoModal.js | 6 +- .../user/usersInfo/video/InfosVideo.js | 2 +- .../user/usersInfo/video/VideoInReviewItem.js | 4 +- .../usersInfo/video/VideoPublishSuccess.js | 4 +- .../user/usersInfo/video/VideoUploadList.js | 6 +- 76 files changed, 330 insertions(+), 312 deletions(-) diff --git a/src/App.js b/src/App.js index 17be118b..d0333731 100644 --- a/src/App.js +++ b/src/App.js @@ -3,7 +3,7 @@ import './App.css'; import { ConfigProvider } from 'antd' import zhCN from 'antd/lib/locale-provider/zh_CN'; import { - BrowserRouter as Router, + // BrowserRouter as Router, Route, Switch } from 'react-router-dom'; @@ -108,6 +108,12 @@ class App extends Component { initAxiosInterceptors(this.props); let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : ''; pathname && this.getPathnameType(pathname); + + this.unlisten = this.props.history.listen((location,action) => { + // 最新路由的 location 对象,可以通过比较 pathname 是否相同来判断路由的变化情况 + let newPathname = location.pathname.split('/')[1]; + newPathname&&this.getPathnameType(newPathname); + }); } getPathnameType = (pathname) => { @@ -124,6 +130,8 @@ class App extends Component { } } + + HideAddcoursestypess = (i) => { this.setState({ Addcoursestype: false, @@ -146,7 +154,14 @@ class App extends Component { window.addEventListener('error', (event) => { const msg = `${event.type}: ${event.message}`; }); + + } + + componentWillUnmount() { + this.unlisten && this.unlisten(); // 执行解绑 + } + //修改登录方法 Modifyloginvalue = () => { this.setState({ @@ -225,121 +240,121 @@ class App extends Component { this.Modifyloginvalue()}> - - - {/* wiki预览 */} - { - return () - } - } /> - - {/*项目*/} - { - return () - } - }> - - { - return () - } - }> - - {/*项目*/} - { - return () - } - }> - - { - return () - } - } - /> - {/*403*/} - - - - - {/*404*/} - - - {/* 查询 */} - - - ( - personal && personal.length > 0 ? - - : - - ) - } - /> - - {/* 判断为用户/组织,并进入对应页面 */} - { - pathType === 'User' ? - { - return () - } - } - /> : pathType === 'Organization' ? { - return () - } - }> - : pathType === '404' ? : + {/* */} + + {/* wiki预览 */} + { + return () } + } /> - - {/* 组织 */} - {/* { - return () - } - }> - */} - - {/* 个人主页 */} - - { - return () - } - }> - - ( - personal && personal.length > 0 ? - - : - - ) + {/*项目*/} + { + return () } - /> - - - + }> + + { + return () + } + }> + + {/*项目*/} + { + return () + } + }> + + { + return () + } + } + /> + {/*403*/} + + + + + {/*404*/} + + + {/* 查询 */} + + + ( + personal && personal.length > 0 ? + + : + + ) + } + /> + + {/* 判断为用户/组织,并进入对应页面 */} + { + pathType === 'User' ? + { + return () + } + } + /> : pathType === 'Organization' ? { + return () + } + }> + : pathType === '404' ? : ( + personal && personal.length > 0 ? + + : + + ) + } + /> + } + + + {/* 组织 */} + { + return () + } + }> + + + {/* 个人主页 */} + + { + return () + } + }> + + + + + {/* */} diff --git a/src/college/College.js b/src/college/College.js index 85d43fb7..f7a3ab6c 100644 --- a/src/college/College.js +++ b/src/college/College.js @@ -195,7 +195,7 @@ class College extends Component { align: 'center', className: "edu-txt-center font-14 maxnamewidth105", render: (text, record) => ( - { diff --git a/src/context/TPIContextProvider.js b/src/context/TPIContextProvider.js index 22b24727..f3ea3e0f 100644 --- a/src/context/TPIContextProvider.js +++ b/src/context/TPIContextProvider.js @@ -435,11 +435,11 @@ class TPIContextProvider extends Component { image_url: "avatars/User/1" login: "innov" name: "Coder" - user_url: "/users/innov" + user_url: "/innov" */ let user = resData.user; user.username = resData.user.name; - user.user_url = `/users/${resData.user.login}`; + user.user_url = `/${resData.user.login}`; // user.image_url = resData.image_url; user.is_teacher = resData.is_teacher; resData.user = user; diff --git a/src/forge/Activity/ActivityItem.js b/src/forge/Activity/ActivityItem.js index b726a4af..d5af3c69 100644 --- a/src/forge/Activity/ActivityItem.js +++ b/src/forge/Activity/ActivityItem.js @@ -32,7 +32,7 @@ class ActivityItem extends Component {

    }

    - + {item.user_name} diff --git a/src/forge/Component/Contributors.jsx b/src/forge/Component/Contributors.jsx index 1e26354a..dd7d40e3 100644 --- a/src/forge/Component/Contributors.jsx +++ b/src/forge/Component/Contributors.jsx @@ -52,8 +52,8 @@ function Contributors({contributors,owner,projectsId}){ - - {data.name} + + {data.name} { data.is_watch ? FocusFunc(false,data.login)}>取消关注:FocusFunc(true,data.login)}>关注 @@ -145,7 +145,7 @@ function Contributors({contributors,owner,projectsId}){ list.map((item,key)=>{ return( - + setVisibleFunc(true,item.login,key)}/> diff --git a/src/forge/Component/MemberCards.jsx b/src/forge/Component/MemberCards.jsx index 393ddbb1..f2ba3d09 100644 --- a/src/forge/Component/MemberCards.jsx +++ b/src/forge/Component/MemberCards.jsx @@ -45,9 +45,9 @@ const Div = styled.div`{ export default (({ user , img, name, time, focusStatus, is_current_user, login , successFunc }) => { return (

    - +
    - {name} + {name} { is_current_user ? diff --git a/src/forge/Component/User.jsx b/src/forge/Component/User.jsx index 4d22c77b..bc652dcf 100644 --- a/src/forge/Component/User.jsx +++ b/src/forge/Component/User.jsx @@ -20,7 +20,7 @@ export default ({ url , name , column , id , login })=>{ `; return( id? - + { url && } {name} diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 7364ebd3..628c3f3f 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -385,16 +385,16 @@ class NewHeader extends Component { if (new_link && (new_link.indexOf("courses") > -1 || new_link.indexOf("contests") > -1)) { if (user_login) { if (new_link.indexOf("courses") > -1) { - new_link = new_link.replace(/courses/g, "users/" + user_login + "/courses") + new_link = new_link.replace(/courses/g, user_login + "/courses") } else if (new_link.indexOf("contests") > -1) { - new_link = new_link.replace(/contests/g, "users/" + user_login + "/contests") + new_link = new_link.replace(/contests/g, user_login + "/contests") } } else { is_hidden = true } } if (user_login && (new_link && new_link.indexOf("homes") > -1)) { - new_link = new_link.replace(/homes/g, "users/" + user_login + "/user_activities") + new_link = new_link.replace(/homes/g, user_login + "/user_activities") } var waiLian = (new_link && str.filter(item=>new_link.indexOf(item)>-1) ); @@ -442,7 +442,7 @@ class NewHeader extends Component { : - + 头像 diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index b6ca0be6..c25035cb 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -147,7 +147,7 @@ class CoderRootCommit extends Component{

    { item.id ? - + {item.image_url?:""} : diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 583b4db3..4f930ce4 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -413,11 +413,10 @@ class Detail extends Component { } textFunc = (forked_from_project_id,fork_info)=>{ - let type = fork_info && fork_info.fork_project_user_type; return forked_from_project_id && fork_info ?

    复刻自 - {fork_info.fork_project_user_name} + {fork_info.fork_project_user_name} / {fork_info.fork_form_name}
    : "" @@ -453,7 +452,7 @@ class Detail extends Component {
    {project && project.author && - {project.author.name} + {project.author.name} } / {projectDetail && projectDetail.name} diff --git a/src/forge/Main/IndexItem.js b/src/forge/Main/IndexItem.js index 4e83e439..18fd49c6 100644 --- a/src/forge/Main/IndexItem.js +++ b/src/forge/Main/IndexItem.js @@ -28,7 +28,7 @@ class IndexItem extends Component { : - + } diff --git a/src/forge/Main/sub/Contribute.jsx b/src/forge/Main/sub/Contribute.jsx index f65b4524..76d56dc8 100644 --- a/src/forge/Main/sub/Contribute.jsx +++ b/src/forge/Main/sub/Contribute.jsx @@ -52,7 +52,7 @@ function Contribute(props){
    - {item.name} + {item.name}

    提交{item.contributions}次

    diff --git a/src/forge/Merge/MergeItem.js b/src/forge/Merge/MergeItem.js index 32f3f811..bfb8eace 100644 --- a/src/forge/Merge/MergeItem.js +++ b/src/forge/Merge/MergeItem.js @@ -78,7 +78,7 @@ class MergeItem extends Component {

    {item && item.author_name} @@ -156,7 +156,7 @@ class MergeItem extends Component {

  • {item.assign_user_name ? ( {item.assign_user_name} diff --git a/src/forge/Merge/MergeSubmit.js b/src/forge/Merge/MergeSubmit.js index 8f2275d8..8c80fddf 100644 --- a/src/forge/Merge/MergeSubmit.js +++ b/src/forge/Merge/MergeSubmit.js @@ -100,7 +100,7 @@ class MergeSubmit extends Component{ width:"10%", render: (text,item) => ( - + diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index f3e58657..427dda90 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -386,14 +386,14 @@ class MessageCount extends Component { }
    - + - + {data.issue.author_name} @@ -408,7 +408,7 @@ class MessageCount extends Component { 审查人员: {data.issue.assign_user_name ? ( {data.issue.assign_user_name} diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index 5cba3cf6..25504f64 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -150,7 +150,7 @@ class UserSubmitComponent extends Component { return (
    - + { return( -
  • - +
  • +

    - {i.user && i.user.name} + {i.user && i.user.name} {i.time_ago}

    diff --git a/src/forge/Notice/Index.jsx b/src/forge/Notice/Index.jsx index 63d09748..9c52fca1 100644 --- a/src/forge/Notice/Index.jsx +++ b/src/forge/Notice/Index.jsx @@ -33,7 +33,7 @@ function Index(props){ useEffect(()=>{ if((username && current_user && (current_user.login !== username))){ - props.history.push(`/users/${username}`); + props.history.push(`/${username}`); } },[current_user,username]) @@ -47,14 +47,14 @@ function Index(props){ useEffect(()=>{ if(pathname && username){ - if(pathname === `/users/${username}/notice`){ + if(pathname === `/${username}/notice`){ setMenu("notify"); changeNum(user.undo_messages); } - if(pathname === `/users/${username}/notice/undo`){ + if(pathname === `/${username}/notice/undo`){ setMenu("undo"); } - if(pathname === `/users/${username}/notice/apply`){ + if(pathname === `/${username}/notice/apply`){ setMenu("apply"); } } @@ -84,19 +84,19 @@ function Index(props){
    • - + 通知 {messagesCount ? {messagesCount}:""}
    • - + 接收仓库 {transferCount ? {transferCount}:""}
    • - + 成员申请 {applyCount ? {applyCount}:""} @@ -104,19 +104,19 @@ function Index(props){
    { return ; }} > { return ; }} > { return ; }} diff --git a/src/forge/Notice/Notify.jsx b/src/forge/Notice/Notify.jsx index 761366d3..18a79cfc 100644 --- a/src/forge/Notice/Notify.jsx +++ b/src/forge/Notice/Notify.jsx @@ -46,9 +46,9 @@ function Notify(props){ case 'canceled': return

    取消转移【{project && project.name}】仓库

    case 'common': - return

    正在将【{project && project.name}】仓库转移给【{owner && owner.name}】

    + return

    正在将【{project && project.name}】仓库转移给【{owner && owner.name}】

    case 'successed': - return

    {project && project.name}】仓库成功转移给【{owner && owner.name}】

    + return

    {project && project.name}】仓库成功转移给【{owner && owner.name}】

    default: return

    拒绝转移【{project && project.name}】仓库

    } @@ -81,11 +81,11 @@ function Notify(props){ { list.map((i,k)=>{ return( -
  • - +
  • +

    - {i.applied_user && i.applied_user.name} + {i.applied_user && i.applied_user.name} {i.time_ago}

    { i.applied_type === "AppliedProject" ? renderApplyStatus(i.status,i.applied):renderStatus(i.status,i.applied)} diff --git a/src/forge/Notice/UndoEvent.jsx b/src/forge/Notice/UndoEvent.jsx index d93a1f83..bf700be2 100644 --- a/src/forge/Notice/UndoEvent.jsx +++ b/src/forge/Notice/UndoEvent.jsx @@ -68,16 +68,16 @@ function UndoEvent(props){ { list.map((i,k)=>{ return( -
  • - +
  • +

    - {i.user && i.user.name} + {i.user && i.user.name} {i.time_ago}

    请求将仓库【{i.project && i.project.name}】 - 转移给【{i.owner && i.owner.name}】,是否接受?

    + 转移给【{i.owner && i.owner.name}】,是否接受?

    { i.status === "common" && diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index 644a653d..f5294b8a 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -207,7 +207,7 @@ class Detail extends Component {
    {data && data.author_name} diff --git a/src/forge/Order/OrderItem.js b/src/forge/Order/OrderItem.js index 3c5e5cf8..1369b597 100644 --- a/src/forge/Order/OrderItem.js +++ b/src/forge/Order/OrderItem.js @@ -67,7 +67,7 @@ class OrderItem extends Component {
  • { item.author_name ? - + {item.author_name} : "--" @@ -76,7 +76,7 @@ class OrderItem extends Component {
  • { item.assign_user_name ? - + {item.assign_user_name} : "--" diff --git a/src/forge/Settings/CollaboratorMember.jsx b/src/forge/Settings/CollaboratorMember.jsx index 1104a864..447e3b26 100644 --- a/src/forge/Settings/CollaboratorMember.jsx +++ b/src/forge/Settings/CollaboratorMember.jsx @@ -186,7 +186,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification render: (text, item) => ( ( - + {text} ), diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index ba6e7a5a..02295ce0 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -351,7 +351,7 @@ class Setting extends Component { { is_transfering ? 此仓库正在转移给【 - {transfer && {transfer.name}} + {transfer && {transfer.name}} 】,请联系对方接收此仓库。 : `将此仓库转移给其他用户或组织` diff --git a/src/forge/Source/Index.jsx b/src/forge/Source/Index.jsx index 8ba92587..e158d7fb 100644 --- a/src/forge/Source/Index.jsx +++ b/src/forge/Source/Index.jsx @@ -217,7 +217,7 @@ function Index(props){ data.map((item,key)=>{ return(
  • - +
    diff --git a/src/forge/Team/Group/Setting/GroupMemberSetting.jsx b/src/forge/Team/Group/Setting/GroupMemberSetting.jsx index a0d8ec78..998e7339 100644 --- a/src/forge/Team/Group/Setting/GroupMemberSetting.jsx +++ b/src/forge/Team/Group/Setting/GroupMemberSetting.jsx @@ -87,7 +87,7 @@ export default ((props) => { align: "center", render: (value, item) => { return ( - {item.user.name} + {item.user.name} ) } }, diff --git a/src/forge/Team/New.jsx b/src/forge/Team/New.jsx index 414a8d15..34cda6b7 100644 --- a/src/forge/Team/New.jsx +++ b/src/forge/Team/New.jsx @@ -56,6 +56,10 @@ export default Form.create()( }) } + function test(){ + history.push(`/test2org`); + } + useEffect(()=>{ setFieldsValue({ visibility:"common" @@ -145,6 +149,7 @@ export default Form.create()(

    +

    ) diff --git a/src/forge/Team/RightBox.jsx b/src/forge/Team/RightBox.jsx index 5425e622..c4e70fd0 100644 --- a/src/forge/Team/RightBox.jsx +++ b/src/forge/Team/RightBox.jsx @@ -72,9 +72,9 @@ function RightBox({ OIdentifier , history , admin }) { memberData.organization_users.map((item,key)=>{ return(
    - +
    - {item.user && item.user.name} + {item.user && item.user.name} 加入时间:{item.created_at}
    diff --git a/src/forge/Team/Setting/TeamSettingCommon.jsx b/src/forge/Team/Setting/TeamSettingCommon.jsx index 44174359..a9eca400 100644 --- a/src/forge/Team/Setting/TeamSettingCommon.jsx +++ b/src/forge/Team/Setting/TeamSettingCommon.jsx @@ -92,7 +92,7 @@ export default Form.create()( }).then(result=>{ if(result && result.data){ // 删除后跳转到个人中心的组织页面 - history.push(`/users/${current_user && current_user.login}/organizes`); + history.push(`/${current_user && current_user.login}/organizes`); } }) setVisible(false); diff --git a/src/forge/Team/Setting/TeamSettingMember.jsx b/src/forge/Team/Setting/TeamSettingMember.jsx index 34f0e28e..1ead66e9 100644 --- a/src/forge/Team/Setting/TeamSettingMember.jsx +++ b/src/forge/Team/Setting/TeamSettingMember.jsx @@ -64,7 +64,7 @@ export default (({organizeDetail})=>{ width:"5%", render:(value)=>{ return( - value && + value && ) } }, @@ -73,7 +73,7 @@ export default (({organizeDetail})=>{ dataIndex: 'user', width:"15%", render:(value,item)=>{ - return {value && value.name} + return {value && value.name} } }, { diff --git a/src/forge/Team/TeamGroupItems.jsx b/src/forge/Team/TeamGroupItems.jsx index b482942c..f7f12b2d 100644 --- a/src/forge/Team/TeamGroupItems.jsx +++ b/src/forge/Team/TeamGroupItems.jsx @@ -86,7 +86,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){ { item.users && item.users.map((i,k)=>{ return( - k < count ? + k < count ? : k === count ? diff --git a/src/forge/UsersList/fork_users.js b/src/forge/UsersList/fork_users.js index e38f4619..1e4c3e94 100644 --- a/src/forge/UsersList/fork_users.js +++ b/src/forge/UsersList/fork_users.js @@ -83,7 +83,7 @@ class ForkUsers extends Component {
    { function goUser(login) { - window.location.href = `/users/${login}`; + window.location.href = `/${login}`; } // 复制链接 diff --git a/src/forge/comments/children_comments.js b/src/forge/comments/children_comments.js index 8a8ccbc8..450a30f1 100644 --- a/src/forge/comments/children_comments.js +++ b/src/forge/comments/children_comments.js @@ -113,7 +113,7 @@ class children_comments extends Component {
    {item && item.user_name} diff --git a/src/forge/comments/children_journals.js b/src/forge/comments/children_journals.js index e293c9f3..2337ce87 100644 --- a/src/forge/comments/children_journals.js +++ b/src/forge/comments/children_journals.js @@ -77,7 +77,7 @@ class children_journals extends Component {
    {item && item.user_name} diff --git a/src/forge/comments/comments.js b/src/forge/comments/comments.js index 93925da6..a66ea03a 100644 --- a/src/forge/comments/comments.js +++ b/src/forge/comments/comments.js @@ -304,7 +304,7 @@ class comments extends Component { return (
    {item && item.user_name} diff --git a/src/forge/users/GeneralView/ConcentrateProject.jsx b/src/forge/users/GeneralView/ConcentrateProject.jsx index bfcf290d..05030b64 100644 --- a/src/forge/users/GeneralView/ConcentrateProject.jsx +++ b/src/forge/users/GeneralView/ConcentrateProject.jsx @@ -58,7 +58,7 @@ function ConcentrateProject({userLogin,current}) { { list.map((i,k)=>{ return( -
  • +
  • {i.name}

    {i.description}

    diff --git a/src/forge/users/Index.jsx b/src/forge/users/Index.jsx index c7f6fe92..c02820c5 100644 --- a/src/forge/users/Index.jsx +++ b/src/forge/users/Index.jsx @@ -12,9 +12,7 @@ const Infos = Loadable({ }); export default withRouter( (CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props)=>{ - console.log(props); return( -
    -
    ) })))) ) \ No newline at end of file diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index bcd01113..bfe0b6b8 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -72,22 +72,21 @@ class Infos extends Component { renderPath=(pathname)=>{ const { username } = this.props.match.params; - console.log(username); - if(pathname === `/users/${username}`){ + if(pathname === `/${username}`){ this.setState({menuKey:"0",route_type:undefined}); - }else if(pathname === `/users/${username}/statistics`){ + }else if(pathname === `/${username}/statistics`){ this.setState({menuKey:"1",route_type:undefined}); - }else if(pathname.indexOf(`/users/${username}/projects`)>-1){ + }else if(pathname.indexOf(`/${username}/projects`)>-1){ this.setState({menuKey:"2",route_type:undefined}); - }else if(pathname.indexOf(`/users/${username}/notice`)>-1){ + }else if(pathname.indexOf(`/${username}/notice`)>-1){ this.setState({menuKey:"3",route_type:undefined}); - }else if(pathname.indexOf(`/users/${username}/devops`)>-1){ + }else if(pathname.indexOf(`/${username}/devops`)>-1){ this.setState({menuKey:"4",route_type:undefined}); - }else if(pathname === `/users/${username}/organizes`){ + }else if(pathname === `/${username}/organizes`){ this.setState({menuKey:"5",route_type:undefined}); - }else if(pathname === `/users/${username}/watchers`){ + }else if(pathname === `/${username}/watchers`){ this.setState({menuKey:undefined,route_type:"watchers"}); - }else if(pathname === `/users/${username}/fan_users`){ + }else if(pathname === `/${username}/fan_users`){ this.setState({menuKey:undefined,route_type:"fan_users"}); }else{ this.setState({menuKey:undefined,route_type:undefined}); @@ -147,7 +146,7 @@ class Infos extends Component { project_type: type , route_type: undefined }) - this.props.history.push(`/users/${user && user.login}/devops/${type}`); + this.props.history.push(`/${user && user.login}/devops/${type}`); } undo_link = () => { @@ -156,7 +155,7 @@ class Infos extends Component { route_type: undefined, project_type:"notice", },()=>{ - this.props.history.push(`/users/${user && user.login}/notice`); + this.props.history.push(`/${user && user.login}/notice`); this.fetchUser(); }) } @@ -173,7 +172,7 @@ class Infos extends Component { route_type: undefined, project_type:"organizes" }) - this.props.history.push(`/users/${user && user.login}/organizes`) + this.props.history.push(`/${user && user.login}/organizes`) } resetUser=()=>{ @@ -250,7 +249,7 @@ class Infos extends Component {
  • this.route_link("watchers")} > @@ -258,7 +257,7 @@ class Infos extends Component { {user && user.watching_count} this.route_link("fan_users")} className={`with50 text-center pull-left ${route_type === "fan_users" ? "text-primary" : ""}`} > @@ -281,13 +280,13 @@ class Infos extends Component {
    { !route_type && menuKey && - 概览 - 数据统计 - 项目 + 概览 + 数据统计 + 项目 { current_user && user && user.login === current_user.login ? - + 待办事项 {undo_events && undo_events >0 ? ({undo_events}):""} @@ -295,11 +294,11 @@ class Infos extends Component { } { current_user && current_user.login && current_user.login === username ? - DevOps工作流 + DevOps工作流 :"" } - + 组织 { user && user.user_org_count && user.user_org_count > 0 ? ({user.user_org_count}):""} @@ -309,68 +308,68 @@ class Infos extends Component { {user && ( { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} > { return ; }} diff --git a/src/forge/users/Material/Base.jsx b/src/forge/users/Material/Base.jsx index 6ece348f..24e92905 100644 --- a/src/forge/users/Material/Base.jsx +++ b/src/forge/users/Material/Base.jsx @@ -45,7 +45,7 @@ export default Form.create()( if(result && result.data){ props.showNotification("资料修改成功!") resetUser && resetUser(result.data); - props.history.push(`/users/${username}`) + props.history.push(`/${username}`) } }).catch(error=>{}) } @@ -71,7 +71,7 @@ export default Form.create()( {getFieldDecorator("real_name",{ rules:[{required:true,message:"请输入姓名"}] })( - + )}
    @@ -90,7 +90,7 @@ export default Form.create()( {getFieldDecorator("custom_department",{ rules:[{required:true,message:"请输入单位名称"}] })( - + )} @@ -120,13 +120,13 @@ export default Form.create()( {getFieldDecorator("description",{ rules:[] })( -