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/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}){ : diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index cfe3c6a8..227aac79 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 ?
{ lastCommit && @@ -441,7 +442,7 @@ function CoderDepot(props){ : "" } { - (dirInfo && dirInfo.length === 0) && (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/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.user_admin_or_member && + data && data.user_admin_or_developer && this.checkOperation()}> + 新建合并请求 @@ -387,7 +387,7 @@ class merge extends Component { {data && data.search_count && data.search_count > 0 ? (
- + user_admin_or_developer={data && data.user_admin_or_developer} + >
):""} {search_count > select_params.limit ? ( 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..4836d3e6 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) => {}); } // 删除团队 @@ -77,7 +77,11 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) { title: "团队名", dataIndex: "name", render: (value, item) => { - return {value}; + if(item.is_admin || item.is_member){ + return {value}; + }else{ + return {value}; + } }, }, { diff --git a/src/forge/Team/Group/GroupForm.jsx b/src/forge/Team/Group/GroupForm.jsx index e27161e0..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":"" )} -
+ {/*

允许访问项目单元:

@@ -239,7 +250,7 @@ export default Form.create()( 合并请求(启用合并请求和代码评审) - + 版本发布(跟踪项目版本和下载) @@ -247,9 +258,9 @@ export default Form.create()( wiki(编辑此仓库的相关文档说明) -
+
*/} - cancelEdit()}>取消 + 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/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/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( 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 && } 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() && + 新建组织 + } 排序