forked from Gitlink/forgeplus-react
团队项目批量操作+webhook总数限制调整+跨平台代码同步新建同步分支样式优化
This commit is contained in:
parent
8f78fcf399
commit
373700edf2
|
@ -25,7 +25,7 @@ if (isDev) {
|
|||
}
|
||||
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
|
||||
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
|
||||
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
|
||||
}
|
||||
window._debugType = debugType;
|
||||
export function initAxiosInterceptors(props) {
|
||||
|
|
|
@ -130,7 +130,7 @@ export const Redback = styled.a`{
|
|||
line-height:30px;
|
||||
border-radius:2px;
|
||||
background-color:#F73030;
|
||||
color:#fff;
|
||||
color:#fff!important;
|
||||
padding:0px 12px;
|
||||
display:inline-block;
|
||||
min-width:80px;
|
||||
|
|
|
@ -59,6 +59,7 @@ function DeleteBox({owner, projectsId, visible, setVisible, createJobBy, branchO
|
|||
dropdownMatchSelectWidth={false}
|
||||
dropdownClassName="overlihide"
|
||||
placeholder="请选择仓库分支"
|
||||
getPopupContainer={trigger => trigger.parentNode}
|
||||
>
|
||||
{branchOptions && branchOptions.map((item, key) => {
|
||||
return (
|
||||
|
|
|
@ -16,6 +16,7 @@ function Index(props) {
|
|||
const [ editId , setEditId ] = useState(undefined);
|
||||
const [ deleteWebHookModTitle, setDeleteWebHookModTitle] = useState(undefined);
|
||||
const [ deleteWebHookModSubTitle, setDeleteWebHookModSubTitle] = useState(undefined);
|
||||
const [ totalByUserCreate, setTotalByUserCreate] = useState(undefined);
|
||||
|
||||
const { owner , projectsId } = props.match.params;
|
||||
|
||||
|
@ -33,9 +34,12 @@ function Index(props) {
|
|||
if(result && result.data){
|
||||
const reg1 = new RegExp("https://(.*?)jianmuhub.com(.*?)");
|
||||
const reg2 = new RegExp("https://jianmu.gitlink.org.cn(.*?)");
|
||||
let totalByUserCreate = 0;
|
||||
result.data.webhooks.map(item=>{
|
||||
item.isJianMu = reg1.test(item.url) || reg2.test(item.url);
|
||||
!(reg1.test(item.url) || reg2.test(item.url)) && totalByUserCreate++;
|
||||
})
|
||||
setTotalByUserCreate(totalByUserCreate);
|
||||
setData(result.data.webhooks);
|
||||
setTotal(result.data.total_count);
|
||||
}
|
||||
|
@ -67,8 +71,8 @@ function Index(props) {
|
|||
}
|
||||
|
||||
function addFunc() {
|
||||
if(total >= 20){
|
||||
return props.showNotification("webhooks数量已到上限!请删除暂不使用的webhooks以进行添加操作");
|
||||
if(totalByUserCreate >= 20){
|
||||
return props.showNotification("您创建的Webhook数量已达到上线!请删除部分Webhook以进行添加操作");
|
||||
}
|
||||
props.history.push(`/${owner}/${projectsId}/settings/webhooks/new`)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import axios from 'axios';
|
||||
import { AutoComplete, Pagination, List, Popconfirm, Dropdown, Spin } from 'antd';
|
||||
import { WhiteBack, Blueline, FlexAJ, GroupProjectBackgroup, Greenline, Redline } from '../../../Component/layout';
|
||||
import { AutoComplete, Pagination, Popconfirm, Spin, Table, message, Tooltip } from 'antd';
|
||||
import { WhiteBack, Blueline, FlexAJ, Redback, Blueback } from '../../../Component/layout';
|
||||
import Title from '../../../Component/Title';
|
||||
const { Option } = AutoComplete;
|
||||
const limit = 15;
|
||||
|
@ -17,6 +17,7 @@ function GroupProjectSetting(props) {
|
|||
const [ optionsSource , setOptionsSource ] = useState(undefined);
|
||||
|
||||
const { OIdentifier, groupId } = props.match.params;
|
||||
const { includesAllProject} = props;
|
||||
|
||||
useEffect(() => {
|
||||
get_project()
|
||||
|
@ -55,12 +56,29 @@ function GroupProjectSetting(props) {
|
|||
setIsSpin(false)
|
||||
}
|
||||
|
||||
// 移除所有项目
|
||||
function removeALLProject() {
|
||||
// 移除所有项目
|
||||
setIsSpin(true);
|
||||
axios.delete(`/organizations/${OIdentifier}/teams/${groupId}/team_projects/destroy_all.json`).then((result) => {
|
||||
if (result && !result.data.status) {
|
||||
message.success('移除成功');
|
||||
get_project();
|
||||
}
|
||||
setIsSpin(false);
|
||||
}).catch((error) => {setIsSpin(false)});
|
||||
}
|
||||
|
||||
// 添加所有项目
|
||||
function addALLProject() {
|
||||
// 添加所有项目
|
||||
setIsSpin(true);
|
||||
axios.post(`/organizations/${OIdentifier}/teams/${groupId}/team_projects/create_all.json`).then((result) => {
|
||||
console.log('result', result);
|
||||
if (result && !result.data.status) {
|
||||
message.success('添加成功');
|
||||
get_project();
|
||||
}
|
||||
setIsSpin(false);
|
||||
}).catch((error) => {setIsSpin(false)});
|
||||
}
|
||||
|
||||
// 添加单个项目
|
||||
|
@ -117,74 +135,79 @@ function GroupProjectSetting(props) {
|
|||
setSearch(value);
|
||||
}
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '项目名称',
|
||||
dataIndex: 'project',
|
||||
width: "85%",
|
||||
render: (value, item) => {
|
||||
return (
|
||||
<a href={`/${value.owner_login}/${value.identifier}`}>{value.owner_name}/{value.name}</a>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operation',
|
||||
render: (value, item) => {
|
||||
return includesAllProject ? <Tooltip title={"该团队拥有所有项目权限,不支持移除,可在基本设置中进行调整。"}><span style={{color: 'gray'}}>移除</span></Tooltip> : <Popconfirm
|
||||
title="确认移除项目吗?"
|
||||
onConfirm={() => removeProject(item.project.identifier)}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a className="color-red">移除</a>
|
||||
</Popconfirm>
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
return (
|
||||
<Spin spinning={isSpin}>
|
||||
<WhiteBack className="mb30">
|
||||
<Title>
|
||||
<FlexAJ style={{width:"100%"}}>
|
||||
<span>团队项目管理</span>
|
||||
<div>
|
||||
<AutoComplete
|
||||
style={{ width: 300 }}
|
||||
placeholder="搜索项目..."
|
||||
onChange={changeInput}
|
||||
onSelect={selectInput}
|
||||
allowClear
|
||||
>
|
||||
{optionsSource}
|
||||
</AutoComplete>
|
||||
<Blueline className="ml30" onClick={()=>addSingleProject()}>+ 添加项目</Blueline>
|
||||
</div>
|
||||
</FlexAJ>
|
||||
<span>团队项目管理</span>
|
||||
</Title>
|
||||
{/* <FlexAJ className="padding20-30">
|
||||
<GroupProjectBackgroup>
|
||||
<FlexAJ>
|
||||
<div>
|
||||
<Popconfirm
|
||||
title="确认添加所有成员的项目吗?"
|
||||
onConfirm={() => addALLProject()}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Greenline bold>添加所有</Greenline>
|
||||
</Popconfirm>
|
||||
|
||||
<Popconfirm
|
||||
title="确认移除所有项目吗?"
|
||||
onConfirm={() => removeALLProject()}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Redline bold className="ml30">移除所有</Redline>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
</FlexAJ>
|
||||
</GroupProjectBackgroup>
|
||||
</FlexAJ>*/}
|
||||
<FlexAJ style={{width:"100%"}}>
|
||||
<div className="padding20-30">
|
||||
<AutoComplete
|
||||
style={{ width: 300 }}
|
||||
placeholder="搜索项目..."
|
||||
onChange={changeInput}
|
||||
onSelect={selectInput}
|
||||
allowClear
|
||||
>
|
||||
{optionsSource}
|
||||
</AutoComplete>
|
||||
<Blueline className="ml30" onClick={()=>addSingleProject()}>+ 添加项目</Blueline>
|
||||
</div>
|
||||
{!includesAllProject && <div className='pr30'>
|
||||
<Popconfirm
|
||||
title="确认添加组织内所有项目至该团队?"
|
||||
onConfirm={() => addALLProject()}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Blueback className="mr30">添加所有</Blueback>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
title="确认移除该团队内所有项目?"
|
||||
onConfirm={() => removeALLProject()}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Redback>移除所有</Redback>
|
||||
</Popconfirm>
|
||||
</div>}
|
||||
</FlexAJ>
|
||||
<div className="padding20-30"style={{paddingTop:"0px",minHeight:"400px"}}>
|
||||
<List
|
||||
itemLayout="horizontal"
|
||||
<Table
|
||||
size="small"
|
||||
columns={columns}
|
||||
dataSource={projects}
|
||||
renderItem={item => (
|
||||
<List.Item
|
||||
extra={
|
||||
<Popconfirm
|
||||
title="确认移除项目吗?"
|
||||
onConfirm={() => removeProject(item.project.identifier)}
|
||||
okText="确认"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a className="color-red">移除</a>
|
||||
</Popconfirm>
|
||||
}
|
||||
>
|
||||
<List.Item.Meta
|
||||
title={<a href={`/${item.project.owner_login}/${item.project.identifier}`}>{item.project.owner_name}/{item.project.name}</a>}
|
||||
/>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
pagination={false}
|
||||
className="teamMemberTable"
|
||||
></Table>
|
||||
</div>
|
||||
{
|
||||
total > limit ?
|
||||
|
|
|
@ -71,7 +71,7 @@ export default ((props)=>{
|
|||
<Route
|
||||
path="/:OIdentifier/teams/:groupId/setting"
|
||||
render={(p) => {
|
||||
return <GroupSetting {...props} {...p}/>
|
||||
return <GroupSetting {...props} {...p} includesAllProject={detail && detail.includes_all_project}/>
|
||||
}}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
Loading…
Reference in New Issue