Merge pull request '组织团队权限-测试通过版' (#28) from caishi/forgeplus-react:pre_develop into pre_develop_dev
This commit is contained in:
commit
95ae2bbd46
|
@ -55,6 +55,7 @@ function AddGroup({organizeId,getGroupID}){
|
|||
|
||||
function addCollaborator(){
|
||||
getGroupID && getGroupID(id);
|
||||
setID(undefined);
|
||||
}
|
||||
|
||||
return(
|
||||
|
|
|
@ -104,7 +104,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
|
|||
</ul>
|
||||
:
|
||||
<ul className="descUl">
|
||||
<li>仓库仅可以转移到您已经加入的组织中,不可以转移到未加入的组织中</li>
|
||||
<li>仓库仅可以转移到您具有管理权限的组织中</li>
|
||||
<li>涉及到仓库改名操作,请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li>
|
||||
<li>转移仓库到组织后,你和组织创建者/管理员同时拥有对该仓库的管理操作</li>
|
||||
</ul>
|
||||
|
|
|
@ -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){
|
|||
</AlignCenter>
|
||||
</FlexAJ>
|
||||
{
|
||||
dirInfo || fileInfo ?
|
||||
(dirInfo && dirInfo.length>0) || fileInfo ?
|
||||
<div className="listtable">
|
||||
{
|
||||
lastCommit &&
|
||||
|
@ -441,7 +442,7 @@ function CoderDepot(props){
|
|||
: ""
|
||||
}
|
||||
{
|
||||
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
|
||||
(dirInfo && dirInfo.length === 0) && !fileInfo ? <Nodata _html="暂未发现文件"/> :""
|
||||
}
|
||||
{/* readme文件显示(显示文件详情时不显示readme文件) */}
|
||||
{ dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
|
||||
|
@ -511,11 +512,11 @@ function CoderDepot(props){
|
|||
}
|
||||
{/* 贡献者 */}
|
||||
{
|
||||
projectDetail && projectDetail.contributors &&
|
||||
projectDetail && projectDetail.contributors && projectDetail.contributors.length >0 &&
|
||||
<Contributors contributors={projectDetail && projectDetail.contributors} owner={owner} projectsId={projectsId} />
|
||||
}
|
||||
{/* 语言 */}
|
||||
{ projectDetail && projectDetail.languages &&
|
||||
{ projectDetail && projectDetail.languages && projectDetail.languages.length >0 &&
|
||||
<React.Fragment>
|
||||
<Divider />
|
||||
<LanguagePower languages={projectDetail.languages}/>
|
||||
|
|
|
@ -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 ? (
|
||||
<div
|
||||
className="milepostleft"
|
||||
style={{
|
||||
|
|
|
@ -4,7 +4,7 @@ import "./merge.css";
|
|||
import "../Order/order.css";
|
||||
import "../Order/index.scss";
|
||||
import NoneData from "./no_data";
|
||||
import OrderItem from "./MergeItem";
|
||||
import MergeItem from "./MergeItem";
|
||||
import './Index.scss';
|
||||
|
||||
import axios from "axios";
|
||||
|
@ -255,7 +255,7 @@ class merge extends Component {
|
|||
/>
|
||||
</div>
|
||||
{
|
||||
data && data.user_admin_or_member &&
|
||||
data && data.user_admin_or_developer &&
|
||||
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
|
||||
+ 新建合并请求
|
||||
</a>
|
||||
|
@ -387,7 +387,7 @@ class merge extends Component {
|
|||
<Spin spinning={isSpin}>
|
||||
{data && data.search_count && data.search_count > 0 ? (
|
||||
<div>
|
||||
<OrderItem
|
||||
<MergeItem
|
||||
issues={issues}
|
||||
search_count={search_count}
|
||||
page={select_params.page}
|
||||
|
@ -396,8 +396,8 @@ class merge extends Component {
|
|||
project_author_name={data.project_author_name}
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
user_admin_or_member={data && data.user_admin_or_member}
|
||||
></OrderItem>
|
||||
user_admin_or_developer={data && data.user_admin_or_developer}
|
||||
></MergeItem>
|
||||
</div>
|
||||
):""}
|
||||
{search_count > select_params.limit ? (
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 (
|
||||
<WhiteBack>
|
||||
|
@ -27,15 +30,17 @@ function Collaborator(props){
|
|||
author && author.type === "Organization" ?
|
||||
<span>
|
||||
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>{setNav("1");setNewId(undefined)}}>协作者管理</span>
|
||||
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined)}}>团队管理</span>
|
||||
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>{setNav("2");setNewId(undefined);setNewGroupId(undefined)}}>团队管理</span>
|
||||
</span>
|
||||
:
|
||||
<span className="font-18 text-black">协作者管理</span>
|
||||
}
|
||||
{
|
||||
nav === "1" ?
|
||||
nav === "1" &&
|
||||
<AddMember getID={getID} login showNotification={props.showNotification}/>
|
||||
:
|
||||
}
|
||||
{
|
||||
(nav !== "1" && addOperation) &&
|
||||
<AddGroup getGroupID={getGroupID} organizeId={owner}/>
|
||||
}
|
||||
</div>
|
||||
|
@ -44,7 +49,7 @@ function Collaborator(props){
|
|||
nav === "1" ?
|
||||
<Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/>
|
||||
:
|
||||
<Group owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
|
||||
<Group setAddOperation={setAddOperation} owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
|
||||
}
|
||||
</div>
|
||||
</WhiteBack>
|
||||
|
|
|
@ -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 <Link to={`/organize/${owner}/group/${item.id}`}>{value}</Link>;
|
||||
if(item.is_admin || item.is_member){
|
||||
return <Link to={`/organize/${owner}/group/${item.id}`}>{value}</Link>;
|
||||
}else{
|
||||
return <span>{value}</span>;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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",
|
||||
[],
|
||||
<Radio.Group>
|
||||
<Radio value={false} style={addStyle}>指定项目<span className="color-grey-8 ml10">(团队成员将只能访问添加到团队的项目。 选择此项 <span className="color-grey-3">将不会</span> 自动删除已经添加的项目)</span></Radio>
|
||||
<Radio value={true} style={OptionStyle}>所有项目<span className="color-grey-8 ml10">(团队可以访问所有项目。选择此选项将 <span className="color-grey-3">添加所有现有的</span> 项目到指定团队)</span></Radio>
|
||||
<Radio value={0} style={addStyle}>指定项目<span className="color-grey-8 ml10">(团队成员将只能访问添加到团队的项目。 选择此项 <span className="color-grey-3">将不会</span> 自动删除已经添加的项目)</span></Radio>
|
||||
<Radio value={1} style={OptionStyle}>所有项目<span className="color-grey-8 ml10">(团队可以访问所有项目。选择此选项将 <span className="color-grey-3">添加所有现有的</span> 项目到指定团队)</span></Radio>
|
||||
</Radio.Group>, false, 0,onwers ? "hide":""
|
||||
)}
|
||||
{helper(
|
||||
|
@ -225,7 +236,7 @@ export default Form.create()(
|
|||
</Radio.Group>, false, 20,onwers ? "hide":""
|
||||
)}
|
||||
</Form>
|
||||
<div className={(auth!=="owner" && auth !=="admin") ? "" :"hide"}>
|
||||
{/* <div className={(auth!=="owner" && auth !=="admin") ? "" :"hide"}>
|
||||
<p className="required">允许访问项目单元:</p>
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_code} onClick={switch_code_types} />
|
||||
|
@ -239,7 +250,7 @@ export default Form.create()(
|
|||
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
|
||||
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
|
||||
</AlignCenter>
|
||||
<AlignCenter className="mb20">
|
||||
<AlignCenter className="mb10">
|
||||
<Switch checked={switch_box_release} onClick={switch_releas_types} />
|
||||
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
|
||||
</AlignCenter>
|
||||
|
@ -247,9 +258,9 @@ export default Form.create()(
|
|||
<Switch checked={switch_box_wiki} onClick={switch_wiki_types} />
|
||||
<span className="ml30 color-grey-3">wiki<span className="color-grey-8 ml15">(编辑此仓库的相关文档说明)</span></span>
|
||||
</AlignCenter>
|
||||
</div>
|
||||
</div> */}
|
||||
<Button type={"primary"} onClick={saveGroupFrom}>{groupId ? "更新团队设置" : "新建团队"}</Button>
|
||||
<Cancel className="ml30" onClick={() => cancelEdit()}><span className="pl30 pr30">取消</span></Cancel>
|
||||
<Cancel className="ml30" onClick={() => cancelEdit()}><span>取消</span></Cancel>
|
||||
</Div>
|
||||
</WhiteBack>
|
||||
</Spin>
|
||||
|
|
|
@ -75,7 +75,7 @@ function List(props){
|
|||
<Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/>
|
||||
</div>
|
||||
<p>
|
||||
{ organizeDetail && organizeDetail.is_admin ?
|
||||
{ organizeDetail && organizeDetail.can_create_project ?
|
||||
<Sort menu={menu_new}>
|
||||
<a className="addBtn mr30">+ 新建项目</a>
|
||||
</Sort>
|
||||
|
|
|
@ -97,7 +97,12 @@ function RightBox({ OIdentifier , history , admin }) {
|
|||
return(
|
||||
<div className="teammembers" key={key}>
|
||||
<div>
|
||||
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
|
||||
{
|
||||
(item.is_admin || item.is_member) ?
|
||||
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
|
||||
:
|
||||
<ColorListName>{item.name}</ColorListName>
|
||||
}
|
||||
<Align>
|
||||
<Span>{item.num_users}名成员</Span>
|
||||
<Span>{item.num_projects}个仓库</Span>
|
||||
|
|
|
@ -168,7 +168,7 @@ export default Form.create()(
|
|||
'权限:',
|
||||
"repo_admin_change_team_access",
|
||||
[],
|
||||
<Checkbox style={radioStyle}>仓库管理员可以添加或移除团队的访问权限</Checkbox>,false,true
|
||||
<Checkbox style={radioStyle}>项目管理员可以添加或移除团队的访问权限</Checkbox>,false,true
|
||||
)}
|
||||
<Divider/>
|
||||
{helper(
|
||||
|
|
|
@ -75,7 +75,12 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
|||
return(
|
||||
<div key={key}>
|
||||
<p className="g-head">
|
||||
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
|
||||
{
|
||||
(item.is_admin || item.is_member) ?
|
||||
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
|
||||
:
|
||||
<span className="color-grey-3 font-16">{item.nickname}</span>
|
||||
}
|
||||
<span>
|
||||
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
|
||||
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
|
||||
|
|
|
@ -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){
|
|||
</Menu>
|
||||
)
|
||||
|
||||
function newFunc() {
|
||||
const { checkIfLogin , showLoginDialog } = props;
|
||||
if(checkIfLogin()){
|
||||
props.history.push(`/organize/new`);
|
||||
}else{
|
||||
showLoginDialog && showLoginDialog();
|
||||
}
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
<div className="headerbox">
|
||||
|
@ -62,7 +55,10 @@ function Team(props){
|
|||
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
|
||||
</div>
|
||||
<p>
|
||||
<a onClick={newFunc}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</a>
|
||||
{
|
||||
checkIfLogin() &&
|
||||
<Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>
|
||||
}
|
||||
<Dropdown overlay={menu}>
|
||||
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
||||
</Dropdown>
|
||||
|
|
Loading…
Reference in New Issue