合并镜像、权限、wiki修改
This commit is contained in:
commit
0b64631222
|
@ -107,7 +107,7 @@ export function timeAgo(backDate) {
|
||||||
try {
|
try {
|
||||||
moment(backDate);
|
moment(backDate);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return;
|
return '刚刚';
|
||||||
}
|
}
|
||||||
if(typeof backDate ==='number'){
|
if(typeof backDate ==='number'){
|
||||||
backDate=backDate*1000
|
backDate=backDate*1000
|
||||||
|
@ -134,4 +134,5 @@ export function timeAgo(backDate) {
|
||||||
if (seconds) {
|
if (seconds) {
|
||||||
return seconds + "秒前";
|
return seconds + "秒前";
|
||||||
}
|
}
|
||||||
|
return "刚刚";
|
||||||
}
|
}
|
|
@ -55,6 +55,7 @@ function AddGroup({organizeId,getGroupID}){
|
||||||
|
|
||||||
function addCollaborator(){
|
function addCollaborator(){
|
||||||
getGroupID && getGroupID(id);
|
getGroupID && getGroupID(id);
|
||||||
|
setID(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
|
|
|
@ -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 (
|
||||||
|
<Tooltip
|
||||||
|
placement="top"
|
||||||
|
title={title}
|
||||||
|
onVisibleChange={() => { setTitle(beforeText) }}
|
||||||
|
>
|
||||||
|
<i className={`iconfont icon-fuzhiicon ${className}`} style={{ color: '#466aff' }} onClick={copyUrl}></i>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default memo(CopyTool);
|
|
@ -104,7 +104,7 @@ function DivertModal({form , visible , onSuccess , onCancel,owner,repo}){
|
||||||
</ul>
|
</ul>
|
||||||
:
|
:
|
||||||
<ul className="descUl">
|
<ul className="descUl">
|
||||||
<li>仓库仅可以转移到您已经加入的组织中,不可以转移到未加入的组织中</li>
|
<li>仓库仅可以转移到您具有管理权限的组织中</li>
|
||||||
<li>涉及到仓库改名操作,请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li>
|
<li>涉及到仓库改名操作,请提前做好仓库备份并且在转移后对本地仓库的remote进行修改</li>
|
||||||
<li>转移仓库到组织后,你和组织创建者/管理员同时拥有对该仓库的管理操作</li>
|
<li>转移仓库到组织后,你和组织创建者/管理员同时拥有对该仓库的管理操作</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -147,6 +147,7 @@ function CoderDepot(props){
|
||||||
setReadme(result.data.readme);
|
setReadme(result.data.readme);
|
||||||
setEditReadme(false);
|
setEditReadme(false);
|
||||||
setHide(true);
|
setHide(true);
|
||||||
|
console.log("dddd:",result.data.entries);
|
||||||
}
|
}
|
||||||
setTimeout(function(){setIsSpin(false);},500);
|
setTimeout(function(){setIsSpin(false);},500);
|
||||||
}).catch(error=>{setIsSpin(false);})
|
}).catch(error=>{setIsSpin(false);})
|
||||||
|
@ -383,7 +384,7 @@ function CoderDepot(props){
|
||||||
</AlignCenter>
|
</AlignCenter>
|
||||||
</FlexAJ>
|
</FlexAJ>
|
||||||
{
|
{
|
||||||
dirInfo || fileInfo ?
|
(dirInfo && dirInfo.length>0) || fileInfo ?
|
||||||
<div className="listtable">
|
<div className="listtable">
|
||||||
{
|
{
|
||||||
lastCommit &&
|
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文件) */}
|
{/* readme文件显示(显示文件详情时不显示readme文件) */}
|
||||||
{ dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
|
{ 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} />
|
<Contributors contributors={projectDetail && projectDetail.contributors} owner={owner} projectsId={projectsId} />
|
||||||
}
|
}
|
||||||
{/* 语言 */}
|
{/* 语言 */}
|
||||||
{ projectDetail && projectDetail.languages &&
|
{ projectDetail && projectDetail.languages && projectDetail.languages.length >0 &&
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Divider />
|
<Divider />
|
||||||
<LanguagePower languages={projectDetail.languages}/>
|
<LanguagePower languages={projectDetail.languages}/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { Component } from 'react';
|
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 { 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 DetailBanner from './sub/DetailBanner';
|
||||||
import '../css/index.scss'
|
import '../css/index.scss'
|
||||||
import './list.css';
|
import './list.css';
|
||||||
|
@ -103,12 +103,12 @@ const Contribute = Loadable({
|
||||||
})
|
})
|
||||||
|
|
||||||
const CoderRootCommit = Loadable({
|
const CoderRootCommit = Loadable({
|
||||||
loader: () => import('./CoderRootCommit'),
|
loader: () => import('./CoderRootCommit'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
const CoderDepot = Loadable({
|
const CoderDepot = Loadable({
|
||||||
loader: () => import('./CoderDepot'),
|
loader: () => import('./CoderDepot'),
|
||||||
loading: Loading,
|
loading: Loading,
|
||||||
})
|
})
|
||||||
|
|
||||||
const TrendsIndex = Loadable({
|
const TrendsIndex = Loadable({
|
||||||
|
@ -139,28 +139,28 @@ const WikiEdit = Loadable({
|
||||||
/**
|
/**
|
||||||
* permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外)
|
* permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外)
|
||||||
*/
|
*/
|
||||||
function checkPathname(projectsId,owner,pathname){
|
function checkPathname(projectsId, owner, pathname) {
|
||||||
let name = "";
|
let name = "";
|
||||||
if(pathname && pathname !== `/projects/${owner}/${projectsId}`){
|
if (pathname && pathname !== `/projects/${owner}/${projectsId}`) {
|
||||||
let url = pathname.split(`/projects/${owner}/${projectsId}`)[1];
|
let url = pathname.split(`/projects/${owner}/${projectsId}`)[1];
|
||||||
if(url.indexOf("/about")>-1){
|
if (url.indexOf("/about") > -1) {
|
||||||
name="about"
|
name = "about"
|
||||||
}else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){
|
} else if (url.indexOf("/issues") > -1 || url.indexOf("Milepost") > 0) {
|
||||||
name = "issues";
|
name = "issues";
|
||||||
}else if(url.indexOf("/pulls")>-1){
|
} else if (url.indexOf("/pulls") > -1) {
|
||||||
name="pulls"
|
name = "pulls"
|
||||||
}else if(url.indexOf("/milestones")>-1){
|
} else if (url.indexOf("/milestones") > -1) {
|
||||||
name="milestones"
|
name = "milestones"
|
||||||
}else if(url.indexOf("/activity")>-1){
|
} else if (url.indexOf("/activity") > -1) {
|
||||||
name="activity"
|
name = "activity"
|
||||||
}else if(url.indexOf("/setting")>-1){
|
} else if (url.indexOf("/setting") > -1) {
|
||||||
name="setting"
|
name = "setting"
|
||||||
}else if(url.indexOf(`/devops`)>-1){
|
} else if (url.indexOf(`/devops`) > -1) {
|
||||||
name="devops"
|
name = "devops"
|
||||||
}else if(url.indexOf(`/source`)>-1){
|
} else if (url.indexOf(`/source`) > -1) {
|
||||||
name="source"
|
name = "source"
|
||||||
}else if(url.indexOf(`/wiki`)>-1){
|
} else if (url.indexOf(`/wiki`) > -1) {
|
||||||
name="wiki"
|
name = "wiki"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
@ -183,15 +183,15 @@ class Detail extends Component {
|
||||||
branchs: undefined,
|
branchs: undefined,
|
||||||
branchList: undefined,
|
branchList: undefined,
|
||||||
project: null,
|
project: null,
|
||||||
firstSync:false,
|
firstSync: false,
|
||||||
secondSync:false,
|
secondSync: false,
|
||||||
open_devops:false,
|
open_devops: false,
|
||||||
forkSpin:false,
|
forkSpin: false,
|
||||||
// 默认分支
|
// 默认分支
|
||||||
defaultBranch:undefined,
|
defaultBranch: undefined,
|
||||||
|
|
||||||
// 非本平台项目
|
// 非本平台项目
|
||||||
platform:false
|
platform: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,36 +208,38 @@ class Detail extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getProject = (num) => {
|
getProject = (num) => {
|
||||||
const { projectsId , owner } = this.props.match.params;
|
const { projectsId, owner } = this.props.match.params;
|
||||||
const url = `/${owner}/${projectsId}/simple.json`;
|
const url = `/${owner}/${projectsId}/simple.json`;
|
||||||
axios.get(url).then((result) => {
|
axios.get(url).then((result) => {
|
||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
this.setState({
|
this.setState({
|
||||||
project: result.data,
|
project: result.data,
|
||||||
open_devops:result.data.open_devops,
|
open_devops: result.data.open_devops,
|
||||||
platform:result.data.platform && result.data.platform !== 'educoder'
|
platform: result.data.platform && result.data.platform !== 'educoder'
|
||||||
})
|
})
|
||||||
|
|
||||||
if (result.data.type !== 0 && result.data.mirror_status === 1) {
|
if (result.data.type !== 0 && result.data.mirror_status === 1) {
|
||||||
console.log("--------start channel --------");
|
console.log("--------start channel --------");
|
||||||
// 是镜像项目,且未完成迁移
|
// 是镜像项目,且未完成迁移
|
||||||
this.canvasChannel();
|
this.canvasChannel();
|
||||||
if(num){
|
if (num) {
|
||||||
this.setState({
|
this.setState({
|
||||||
secondSync:true,
|
secondSync: true,
|
||||||
firstSync:false
|
firstSync: false
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
firstSync:true,
|
firstSync: true,
|
||||||
secondSync:false
|
secondSync: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}else{
|
} else if (result.data.mirror_status === 2) {
|
||||||
|
this.deleteProjectBack();
|
||||||
|
} else {
|
||||||
this.getDetail();
|
this.getDetail();
|
||||||
this.setState({
|
this.setState({
|
||||||
firstSync:false,
|
firstSync: false,
|
||||||
secondSync:false
|
secondSync: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,9 +247,9 @@ class Detail extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 工作流激活后修改状态
|
// 工作流激活后修改状态
|
||||||
changeOpenDevops=(flag)=>{
|
changeOpenDevops = (flag) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
open_devops:flag
|
open_devops: flag
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
canvasChannel = () => {
|
canvasChannel = () => {
|
||||||
|
@ -265,11 +267,15 @@ class Detail extends Component {
|
||||||
disconnected: () => { },
|
disconnected: () => { },
|
||||||
received: data => {
|
received: data => {
|
||||||
console.log(`###### ---received data--- ######`);
|
console.log(`###### ---received data--- ######`);
|
||||||
|
console.log(data);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
if ( data.project && data.project.mirror_status === 2) {
|
||||||
|
this.deleteProjectBack();
|
||||||
|
}
|
||||||
this.getDetail();
|
this.getDetail();
|
||||||
this.setState({
|
this.setState({
|
||||||
firstSync:false,
|
firstSync: false,
|
||||||
secondSync:false
|
secondSync: false
|
||||||
});
|
});
|
||||||
cable.subscriptions.consumer.disconnect();
|
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 = () => {
|
getDetail = () => {
|
||||||
const { projectsId , owner } = this.props.match.params;
|
const { projectsId, owner } = this.props.match.params;
|
||||||
this.getBanner();
|
this.getBanner();
|
||||||
const url = `/${owner}/${projectsId}/detail.json`;
|
const url = `/${owner}/${projectsId}/detail.json`;
|
||||||
axios.get(url).then((result) => {
|
axios.get(url).then((result) => {
|
||||||
|
@ -295,29 +318,29 @@ class Detail extends Component {
|
||||||
watchers_count: result.data.watchers_count,
|
watchers_count: result.data.watchers_count,
|
||||||
praises_count: result.data.praises_count,
|
praises_count: result.data.praises_count,
|
||||||
forked_count: result.data.forked_count,
|
forked_count: result.data.forked_count,
|
||||||
defaultBranch:result.data.default_branch
|
defaultBranch: result.data.default_branch
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error) => { })
|
}).catch((error) => { })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取动态导航栏菜单
|
// 获取动态导航栏菜单
|
||||||
getBanner(){
|
getBanner() {
|
||||||
const { projectsId , owner } = this.props.match.params;
|
const { projectsId, owner } = this.props.match.params;
|
||||||
const url = `/${owner}/${projectsId}/menu_list.json`;
|
const url = `/${owner}/${projectsId}/menu_list.json`;
|
||||||
axios.get(url).then(result=>{
|
axios.get(url).then(result => {
|
||||||
if(result){
|
if (result) {
|
||||||
this.setState({
|
this.setState({
|
||||||
bannerList:result.data
|
bannerList: result.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch(error=>{})
|
}).catch(error => { })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关注和取消关注
|
// 关注和取消关注
|
||||||
focusFunc = (flag) => {
|
focusFunc = (flag) => {
|
||||||
const { platform } = this.state;
|
const { platform } = this.state;
|
||||||
if(!platform)return;
|
if (!platform) return;
|
||||||
|
|
||||||
const { project_id } = this.state;
|
const { project_id } = this.state;
|
||||||
axios({
|
axios({
|
||||||
|
@ -332,15 +355,15 @@ class Detail extends Component {
|
||||||
this.setWatchersCount(result.data.watchers_count, result.data.watched);
|
this.setWatchersCount(result.data.watchers_count, result.data.watched);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点赞和取消点赞
|
// 点赞和取消点赞
|
||||||
pariseFunc = (flag) => {
|
pariseFunc = (flag) => {
|
||||||
const { platform } = this.state;
|
const { platform } = this.state;
|
||||||
if(!platform)return;
|
if (!platform) return;
|
||||||
const { project_id } = this.state;
|
const { project_id } = this.state;
|
||||||
axios({
|
axios({
|
||||||
method: flag ? 'delete' : 'post',
|
method: flag ? 'delete' : 'post',
|
||||||
|
@ -350,9 +373,9 @@ class Detail extends Component {
|
||||||
this.setPraisesCount(result.data.praises_count, result.data.praised)
|
this.setPraisesCount(result.data.praises_count, result.data.praised)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setWatchersCount = (count, is_watched) => {
|
setWatchersCount = (count, is_watched) => {
|
||||||
|
@ -372,12 +395,12 @@ class Detail extends Component {
|
||||||
// fork项目
|
// fork项目
|
||||||
forkFunc = () => {
|
forkFunc = () => {
|
||||||
const { platform } = this.state;
|
const { platform } = this.state;
|
||||||
if(!platform)return;
|
if (!platform) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
forkSpin:true
|
forkSpin: true
|
||||||
})
|
})
|
||||||
const { current_user } = this.props
|
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`;
|
const url = `/${owner}/${projectsId}/forks.json`;
|
||||||
axios.post(url).then(result => {
|
axios.post(url).then(result => {
|
||||||
if (result && result.data.status === 0) {
|
if (result && result.data.status === 0) {
|
||||||
|
@ -385,11 +408,11 @@ class Detail extends Component {
|
||||||
this.props.showNotification(result.data.message);
|
this.props.showNotification(result.data.message);
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
forkSpin:false
|
forkSpin: false
|
||||||
})
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.setState({
|
this.setState({
|
||||||
forkSpin:false
|
forkSpin: false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -397,8 +420,8 @@ class Detail extends Component {
|
||||||
// 同步镜像
|
// 同步镜像
|
||||||
synchronismMirror = () => {
|
synchronismMirror = () => {
|
||||||
const { platform } = this.state;
|
const { platform } = this.state;
|
||||||
if(!platform)return;
|
if (!platform) return;
|
||||||
const { projectsId , owner } = this.props.match.params;
|
const { projectsId, owner } = this.props.match.params;
|
||||||
const url = `/${owner}/${projectsId}/sync_mirror.json`;
|
const url = `/${owner}/${projectsId}/sync_mirror.json`;
|
||||||
axios.post(url).then(result => {
|
axios.post(url).then(result => {
|
||||||
if (result && result.data && result.data.status === 0) {
|
if (result && result.data && result.data.status === 0) {
|
||||||
|
@ -412,42 +435,43 @@ 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 ?
|
return forked_from_project_id && fork_info ?
|
||||||
<div className="color-grey-9 df">
|
<div className="color-grey-9 df">
|
||||||
<span>复刻自</span>
|
<span>复刻自</span>
|
||||||
<Link to={`/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
|
<Link to={`/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
|
||||||
<span> / </span>
|
<span> / </span>
|
||||||
<Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{maxWidth:"400px"}} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
|
<Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{ maxWidth: "400px" }} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
|
||||||
</div> : ""
|
</div> : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { projectDetail, watchers_count, praises_count,
|
const { projectDetail, watchers_count, praises_count,
|
||||||
forked_count, firstSync , secondSync ,
|
forked_count, firstSync, secondSync,
|
||||||
isManager, watched, praised,
|
isManager, watched, praised,
|
||||||
project , open_devops , platform , defaultBranch , bannerList , forkSpin } = this.state;
|
project, open_devops, platform, defaultBranch, bannerList, forkSpin } = this.state;
|
||||||
const url = this.props.history.location.pathname;
|
const url = this.props.history.location.pathname;
|
||||||
const urlArr = url.split("/");
|
const urlArr = url.split("/");
|
||||||
const urlFlag = (urlArr.length === 3);
|
const urlFlag = (urlArr.length === 3);
|
||||||
|
|
||||||
const { projectsId , owner } = this.props.match.params;
|
const { projectsId, owner } = this.props.match.params;
|
||||||
const { current_user } = this.props;
|
const { current_user } = this.props;
|
||||||
let pathname = checkPathname(projectsId,owner,url);
|
let pathname = checkPathname(projectsId, owner, url);
|
||||||
|
|
||||||
const { state } = this.props.history.location;
|
const { state } = this.props.history.location;
|
||||||
|
|
||||||
const common = {
|
const common = {
|
||||||
getDetail: this.getDetail,
|
getDetail: this.getDetail,
|
||||||
changeOpenDevops:this.changeOpenDevops,
|
changeOpenDevops: this.changeOpenDevops,
|
||||||
defaultBranch
|
defaultBranch
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="detailHeader-wrapper">
|
<div className="detailHeader-wrapper">
|
||||||
<div className="normal">
|
<div className="normal">
|
||||||
<AlignTop style={{padding:"20px 0px 10px",justifyContent:"space-between"}}>
|
<AlignTop style={{ padding: "20px 0px 10px", justifyContent: "space-between" }}>
|
||||||
<div>
|
<div>
|
||||||
<AlignTop>
|
<AlignTop>
|
||||||
<div className="projectallName">
|
<div className="projectallName">
|
||||||
|
@ -457,298 +481,298 @@ class Detail extends Component {
|
||||||
<span className="ml5 mr5">/</span>
|
<span className="ml5 mr5">/</span>
|
||||||
<Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
|
<Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
|
||||||
</div>
|
</div>
|
||||||
{ projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>}
|
{projectDetail && projectDetail.private && <span className="privateTag mt6">私有</span>}
|
||||||
</AlignTop>
|
</AlignTop>
|
||||||
<div className="mt8">
|
<div className="mt8">
|
||||||
{
|
{
|
||||||
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
|
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 && projectDetail.type && projectDetail.type !== 0 ?
|
||||||
<span className="color-grey-9">镜像自 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
|
<span className="color-grey-9">镜像自 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
|
||||||
:""
|
: ""
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{
|
{
|
||||||
firstSync ? "":
|
firstSync ? "" :
|
||||||
<span className="df">
|
<span className="df">
|
||||||
{
|
|
||||||
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
|
|
||||||
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
|
|
||||||
}
|
|
||||||
<Button className="detail_tag_btn">
|
|
||||||
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.focusFunc(watched)}>
|
|
||||||
<i className={watched ? "iconfont icon-shixing color-orange font-16 mr3":"iconfont icon-kongxing color-grey-9 font-16 mr3"}></i>
|
|
||||||
<span>{watched ? '取消关注' : '关注'}</span>
|
|
||||||
</a>
|
|
||||||
{
|
{
|
||||||
watchers_count > 0 ?
|
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
|
||||||
platform ?
|
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
|
||||||
<Link className="detail_tag_btn_count" style={{color:`${watched?"#2878FF":"#666"}`}} to={platform?{ pathname: `/projects/${owner}/${projectsId}/watchers`, state }:""}>
|
|
||||||
{watchers_count}
|
|
||||||
</Link>
|
|
||||||
:
|
|
||||||
<span className="detail_tag_btn_count">{watchers_count}</span>
|
|
||||||
:""
|
|
||||||
}
|
}
|
||||||
</Button>
|
<Button className="detail_tag_btn">
|
||||||
<Button className="detail_tag_btn">
|
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={() => this.focusFunc(watched)}>
|
||||||
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.pariseFunc(praised)}>
|
<i className={watched ? "iconfont icon-shixing color-orange font-16 mr3" : "iconfont icon-kongxing color-grey-9 font-16 mr3"}></i>
|
||||||
<i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3":"iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i>
|
<span>{watched ? '取消关注' : '关注'}</span>
|
||||||
<span>{praised ? '取消点赞' : '点赞'}</span>
|
|
||||||
</a>
|
|
||||||
{
|
|
||||||
praises_count > 0 ?
|
|
||||||
platform ?
|
|
||||||
<Link className="detail_tag_btn_count" style={{color:`${praised?"#2878FF":"#666"}`}} to={{ pathname: `/projects/${owner}/${projectsId}/stargazers`, state }}>
|
|
||||||
{praises_count}
|
|
||||||
</Link>:
|
|
||||||
<span className="detail_tag_btn_count">{praises_count}</span>
|
|
||||||
:""
|
|
||||||
}
|
|
||||||
</Button>
|
|
||||||
<Button className="detail_tag_btn" loading={forkSpin}>
|
|
||||||
<Tooltip title="复刻是fork的中文名,即复制代码仓库" placement="bottom">
|
|
||||||
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={this.forkFunc}>
|
|
||||||
<i className="iconfont icon-fork color-grey-9 mr3"></i>复刻
|
|
||||||
</a>
|
</a>
|
||||||
</Tooltip>
|
{
|
||||||
{
|
watchers_count > 0 ?
|
||||||
forked_count > 0 ?
|
platform ?
|
||||||
platform ?
|
<Link className="detail_tag_btn_count" style={{ color: `${watched ? "#2878FF" : "#666"}` }} to={platform ? { pathname: `/projects/${owner}/${projectsId}/watchers`, state } : ""}>
|
||||||
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/fork_users`, state }}>
|
{watchers_count}
|
||||||
{forked_count}
|
</Link>
|
||||||
</Link>
|
:
|
||||||
:
|
<span className="detail_tag_btn_count">{watchers_count}</span>
|
||||||
<span className="detail_tag_btn_count">{forked_count}</span>
|
: ""
|
||||||
:""
|
}
|
||||||
}
|
</Button>
|
||||||
</Button>
|
<Button className="detail_tag_btn">
|
||||||
</span>
|
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={() => this.pariseFunc(praised)}>
|
||||||
|
<i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3" : "iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i>
|
||||||
|
<span>{praised ? '取消点赞' : '点赞'}</span>
|
||||||
|
</a>
|
||||||
|
{
|
||||||
|
praises_count > 0 ?
|
||||||
|
platform ?
|
||||||
|
<Link className="detail_tag_btn_count" style={{ color: `${praised ? "#2878FF" : "#666"}` }} to={{ pathname: `/projects/${owner}/${projectsId}/stargazers`, state }}>
|
||||||
|
{praises_count}
|
||||||
|
</Link> :
|
||||||
|
<span className="detail_tag_btn_count">{praises_count}</span>
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
</Button>
|
||||||
|
<Button className="detail_tag_btn" loading={forkSpin}>
|
||||||
|
<Tooltip title="复刻是fork的中文名,即复制代码仓库" placement="bottom">
|
||||||
|
<a className="detail_tag_btn_name" style={{ cursor: platform ? "pointer" : "default" }} onClick={this.forkFunc}>
|
||||||
|
<i className="iconfont icon-fork color-grey-9 mr3"></i>复刻
|
||||||
|
</a>
|
||||||
|
</Tooltip>
|
||||||
|
{
|
||||||
|
forked_count > 0 ?
|
||||||
|
platform ?
|
||||||
|
<Link className="detail_tag_btn_count" to={{ pathname: `/projects/${owner}/${projectsId}/fork_users`, state }}>
|
||||||
|
{forked_count}
|
||||||
|
</Link>
|
||||||
|
:
|
||||||
|
<span className="detail_tag_btn_count">{forked_count}</span>
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</AlignTop>
|
</AlignTop>
|
||||||
{
|
{
|
||||||
firstSync ? "" :
|
firstSync ? "" :
|
||||||
<DetailBanner
|
<DetailBanner
|
||||||
history={this.props.history}
|
history={this.props.history}
|
||||||
list={bannerList}
|
list={bannerList}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
projectsId={projectsId}
|
projectsId={projectsId}
|
||||||
pathname={pathname}
|
pathname={pathname}
|
||||||
state={state}
|
state={state}
|
||||||
projectDetail={projectDetail}
|
projectDetail={projectDetail}
|
||||||
open_devops={open_devops}
|
open_devops={open_devops}
|
||||||
platform={platform}
|
platform={platform}
|
||||||
urlFlag={urlFlag}
|
urlFlag={urlFlag}
|
||||||
isManager={isManager}
|
isManager={isManager}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
firstSync ?
|
firstSync ?
|
||||||
<Content className="spincontent">
|
<Content className="spincontent">
|
||||||
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
|
<Spin className="spinstyle" tip={project && `正在从 ${project.mirror_url} 迁移`} size="large" />
|
||||||
</Content>
|
</Content>
|
||||||
:
|
:
|
||||||
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
|
<Spin spinning={secondSync} className="spinstyle" tip="正在同步镜像" size="large">
|
||||||
<Switch {...this.props}>
|
<Switch {...this.props}>
|
||||||
{/* 资源 */}
|
{/* 资源 */}
|
||||||
<Route path="/projects/:owner/:projectsId/source"
|
<Route path="/projects/:owner/:projectsId/source"
|
||||||
render={
|
render={
|
||||||
() => (<Source {...this.props} {...this.state} {...common} />)
|
() => (<Source {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 主页 */}
|
{/* 主页 */}
|
||||||
<Route path="/projects/:owner/:projectsId/about"
|
<Route path="/projects/:owner/:projectsId/about"
|
||||||
render={
|
render={
|
||||||
() => (<DevAbout {...this.props} {...this.state} {...common} />)
|
() => (<DevAbout {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* wiki新增文件 */}
|
{/* wiki新增文件 */}
|
||||||
<Route path="/projects/:owner/:projectsId/wiki/add"
|
<Route path="/projects/:owner/:projectsId/wiki/add"
|
||||||
render={
|
render={
|
||||||
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
|
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* wiki编辑文件 */}
|
{/* wiki编辑文件 */}
|
||||||
<Route path="/projects/:owner/:projectsId/wiki/edit/:wikiName"
|
<Route path="/projects/:owner/:projectsId/wiki/edit/:wikiName"
|
||||||
render={
|
render={
|
||||||
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
|
() => (<WikiEdit {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* wiki */}
|
{/* wiki */}
|
||||||
<Route path="/projects/:owner/:projectsId/wiki"
|
<Route path="/projects/:owner/:projectsId/wiki"
|
||||||
render={
|
render={
|
||||||
() => (<Wiki {...this.props} {...this.state} {...common} />)
|
() => (<Wiki {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 工作流 */}
|
{/* 工作流 */}
|
||||||
<Route path="/projects/:owner/:projectsId/devops"
|
<Route path="/projects/:owner/:projectsId/devops"
|
||||||
render={
|
render={
|
||||||
() => (<DevIndex {...this.props} {...this.state} {...common} />)
|
() => (<DevIndex {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 标签列表 */}
|
{/* 标签列表 */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues/tags"
|
<Route path="/projects/:owner/:projectsId/issues/tags"
|
||||||
render={
|
render={
|
||||||
(props) => (<TagList {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<TagList {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 仓库设置 */}
|
{/* 仓库设置 */}
|
||||||
<Route path="/projects/:owner/:projectsId/setting"
|
<Route path="/projects/:owner/:projectsId/setting"
|
||||||
render={
|
render={
|
||||||
(props) => (<Setting {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<Setting {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 任务详情 */}
|
{/* 任务详情 */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues/:orderId/detail"
|
<Route path="/projects/:owner/:projectsId/issues/:orderId/detail"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
|
(props) => (<OrderDetail {...this.props} {...this.state} {...props} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/*修改里程碑*/}
|
{/*修改里程碑*/}
|
||||||
<Route path="/projects/:owner/:projectsId/milestones/:meilid/edit"
|
<Route path="/projects/:owner/:projectsId/milestones/:meilid/edit"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 新建里程碑 */}
|
{/* 新建里程碑 */}
|
||||||
<Route path="/projects/:owner/:projectsId/milestones/new"
|
<Route path="/projects/:owner/:projectsId/milestones/new"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/*里程碑详情*/}
|
{/*里程碑详情*/}
|
||||||
<Route path="/projects/:owner/:projectsId/milestones/:meilid"
|
<Route path="/projects/:owner/:projectsId/milestones/:meilid"
|
||||||
render={
|
render={
|
||||||
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 里程碑 */}
|
{/* 里程碑 */}
|
||||||
<Route path="/projects/:owner/:projectsId/milestones"
|
<Route path="/projects/:owner/:projectsId/milestones"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 里程碑页面新建任务 */}
|
{/* 里程碑页面新建任务 */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues/:milepostId/new"
|
<Route path="/projects/:owner/:projectsId/issues/:milepostId/new"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 新建任务 */}
|
{/* 新建任务 */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues/new"
|
<Route path="/projects/:owner/:projectsId/issues/new"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrderNew {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 修改详情 */}
|
{/* 修改详情 */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues/:orderId/updatedetail"
|
<Route path="/projects/:owner/:projectsId/issues/:orderId/updatedetail"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 复制详情 */}
|
{/* 复制详情 */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues/:orderId/copyetail"
|
<Route path="/projects/:owner/:projectsId/issues/:orderId/copyetail"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 动态 */}
|
{/* 动态 */}
|
||||||
<Route path="/projects/:owner/:projectsId/activity"
|
<Route path="/projects/:owner/:projectsId/activity"
|
||||||
render={
|
render={
|
||||||
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 代码Index */}
|
{/* 代码Index */}
|
||||||
<Route path="/projects/:owner/:projectsId/issues"
|
<Route path="/projects/:owner/:projectsId/issues"
|
||||||
render={
|
render={
|
||||||
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<OrderIndex {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 新建合并请求 */}
|
{/* 新建合并请求 */}
|
||||||
<Route path="/projects/:owner/:projectsId/pulls/new/:branch"
|
<Route path="/projects/:owner/:projectsId/pulls/new/:branch"
|
||||||
render={
|
render={
|
||||||
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
|
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/pulls/new"
|
<Route path="/projects/:owner/:projectsId/pulls/new"
|
||||||
render={
|
render={
|
||||||
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
|
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
|
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/UpdateMerge"
|
||||||
render={
|
render={
|
||||||
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/Messagecount"
|
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/Messagecount"
|
||||||
render={
|
render={
|
||||||
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/MergeSubmit"
|
<Route path="/projects/:owner/:projectsId/pulls/:mergeId/MergeSubmit"
|
||||||
render={
|
render={
|
||||||
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<MessageCount {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
|
|
||||||
<Route path="/projects/:owner/:projectsId/pulls"
|
<Route path="/projects/:owner/:projectsId/pulls"
|
||||||
render={
|
render={
|
||||||
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/watchers"
|
<Route path="/projects/:owner/:projectsId/watchers"
|
||||||
render={
|
render={
|
||||||
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<WatchUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/stargazers"
|
<Route path="/projects/:owner/:projectsId/stargazers"
|
||||||
render={
|
render={
|
||||||
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/fork_users"
|
<Route path="/projects/:owner/:projectsId/fork_users"
|
||||||
render={
|
render={
|
||||||
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 贡献者列表 */}
|
{/* 贡献者列表 */}
|
||||||
<Route path="/projects/:owner/:projectsId/contribute"
|
<Route path="/projects/:owner/:projectsId/contribute"
|
||||||
render={
|
render={
|
||||||
() => (<Contribute {...this.props} {...this.state} {...common} />)
|
() => (<Contribute {...this.props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
|
|
||||||
{/* 代码库----详情页面 */}
|
{/* 代码库----详情页面 */}
|
||||||
<Route path="/projects/:owner/:projectsId/commits/branch/:branchName"
|
<Route path="/projects/:owner/:projectsId/commits/branch/:branchName"
|
||||||
render={
|
render={
|
||||||
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} {...common}/>)
|
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/tree/:branchName"
|
<Route path="/projects/:owner/:projectsId/tree/:branchName"
|
||||||
render={
|
render={
|
||||||
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common}/>)
|
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId/:subIndex"
|
<Route path="/projects/:owner/:projectsId/:subIndex"
|
||||||
render={
|
render={
|
||||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common}/>)
|
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/projects/:owner/:projectsId"
|
<Route path="/projects/:owner/:projectsId"
|
||||||
render={
|
render={
|
||||||
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common}/>)
|
(props) => (<CoderDepot {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Spin>
|
</Spin>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -85,14 +85,14 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
|
||||||
:""
|
:""
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
item.menu_name === "resources" &&
|
// item.menu_name === "resources" &&
|
||||||
<li className={pathname==="source" ? "active" : ""}>
|
// <li className={pathname==="source" ? "active" : ""}>
|
||||||
<Link to={{ pathname: `/projects/${owner}/${projectsId}/source`, state }}>
|
// <Link to={{ pathname: `/projects/${owner}/${projectsId}/source`, state }}>
|
||||||
<i className={pathname==="source" ? "iconfont icon-ziyuanpaihanghetuijian color-grey-3 mr5 font-14":"iconfont icon-ziyuanpaihanghetuijian color-grey-6 font-14 mr5"}></i>
|
// <i className={pathname==="source" ? "iconfont icon-ziyuanpaihanghetuijian color-grey-3 mr5 font-14":"iconfont icon-ziyuanpaihanghetuijian color-grey-6 font-14 mr5"}></i>
|
||||||
<span>资源库</span>
|
// <span>资源库</span>
|
||||||
{projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""}
|
// {projectDetail && projectDetail.source_count ? <span className="num">{projectDetail.source_count}</span> :""}
|
||||||
</Link>
|
// </Link>
|
||||||
</li>
|
// </li>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
item.menu_name === "versions" &&
|
item.menu_name === "versions" &&
|
||||||
|
|
|
@ -49,7 +49,7 @@ class MergeItem extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
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 { projectsId , owner } = this.props.match.params;
|
||||||
const { current_user } = this.props;
|
const { current_user } = this.props;
|
||||||
const renderList = () => {
|
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
|
<div
|
||||||
className="milepostleft"
|
className="milepostleft"
|
||||||
style={{
|
style={{
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "./merge.css";
|
||||||
import "../Order/order.css";
|
import "../Order/order.css";
|
||||||
import "../Order/index.scss";
|
import "../Order/index.scss";
|
||||||
import NoneData from "./no_data";
|
import NoneData from "./no_data";
|
||||||
import OrderItem from "./MergeItem";
|
import MergeItem from "./MergeItem";
|
||||||
import './Index.scss';
|
import './Index.scss';
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
@ -255,7 +255,7 @@ class merge extends Component {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
data && data.user_admin_or_member &&
|
data && data.user_admin_or_developer &&
|
||||||
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
|
<a className="topWrapper_btn ml10" onClick={() => this.checkOperation()}>
|
||||||
+ 新建合并请求
|
+ 新建合并请求
|
||||||
</a>
|
</a>
|
||||||
|
@ -387,7 +387,7 @@ class merge extends Component {
|
||||||
<Spin spinning={isSpin}>
|
<Spin spinning={isSpin}>
|
||||||
{data && data.search_count && data.search_count > 0 ? (
|
{data && data.search_count && data.search_count > 0 ? (
|
||||||
<div>
|
<div>
|
||||||
<OrderItem
|
<MergeItem
|
||||||
issues={issues}
|
issues={issues}
|
||||||
search_count={search_count}
|
search_count={search_count}
|
||||||
page={select_params.page}
|
page={select_params.page}
|
||||||
|
@ -396,8 +396,8 @@ class merge extends Component {
|
||||||
project_author_name={data.project_author_name}
|
project_author_name={data.project_author_name}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
{...this.state}
|
{...this.state}
|
||||||
user_admin_or_member={data && data.user_admin_or_member}
|
user_admin_or_developer={data && data.user_admin_or_developer}
|
||||||
></OrderItem>
|
></MergeItem>
|
||||||
</div>
|
</div>
|
||||||
):""}
|
):""}
|
||||||
{search_count > select_params.limit ? (
|
{search_count > select_params.limit ? (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
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 { Base64 } from 'js-base64';
|
||||||
|
|
||||||
import '../css/index.scss';
|
import '../css/index.scss';
|
||||||
|
@ -58,6 +58,8 @@ class Index extends Component {
|
||||||
this.getGitignore();
|
this.getGitignore();
|
||||||
// 获取开源许可证
|
// 获取开源许可证
|
||||||
this.getLicenses();
|
this.getLicenses();
|
||||||
|
//判断是否为删除新建项目失败后返回,并执行对应逻辑
|
||||||
|
this.isDeleteProjectBack();
|
||||||
}
|
}
|
||||||
componentDidUpdate=(prevPros)=>{
|
componentDidUpdate=(prevPros)=>{
|
||||||
if(prevPros && this.props && !this.props.checkIfLogin()){
|
if(prevPros && this.props && !this.props.checkIfLogin()){
|
||||||
|
@ -69,6 +71,7 @@ class Index extends Component {
|
||||||
getOwner=()=>{
|
getOwner=()=>{
|
||||||
const { OIdentifier } = this.props.match.params;
|
const { OIdentifier } = this.props.match.params;
|
||||||
const { user_id } = this.props && this.props.current_user;
|
const { user_id } = this.props && this.props.current_user;
|
||||||
|
|
||||||
const url = `/owners.json`;
|
const url = `/owners.json`;
|
||||||
axios.get(url).then(result=>{
|
axios.get(url).then(result=>{
|
||||||
if(result && result.data){
|
if(result && result.data){
|
||||||
|
@ -77,16 +80,13 @@ class Index extends Component {
|
||||||
OwnerList: owner,
|
OwnerList: owner,
|
||||||
})
|
})
|
||||||
if(OIdentifier){
|
if(OIdentifier){
|
||||||
owner = owner.filter(item=>item.name === OIdentifier);
|
owner = owner.filter(item=>item.login === OIdentifier);
|
||||||
this.props.form.setFieldsValue({
|
|
||||||
user_id:OIdentifier
|
|
||||||
})
|
|
||||||
}else if(user_id){
|
}else if(user_id){
|
||||||
owner = owner.filter(item=>item.id === 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({
|
owner && this.setState({
|
||||||
owners_id:owner[0].id,
|
owners_id:owner[0].id,
|
||||||
owners_name:owner[0].name
|
owners_name:owner[0].name
|
||||||
|
@ -144,6 +144,31 @@ class Index extends Component {
|
||||||
}).catch((error) => { })
|
}).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
|
// 设置option
|
||||||
setOptionsList = (data, _head, name) => {
|
setOptionsList = (data, _head, name) => {
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
|
@ -172,6 +197,8 @@ class Index extends Component {
|
||||||
const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state;
|
const { project_language_id, project_category_id, license_id, ignore_id , owners_id , owners_name } = this.state;
|
||||||
const decoderPass = Base64.encode(values.password);
|
const decoderPass = Base64.encode(values.password);
|
||||||
const url = (projectsType && projectsType === "mirror") ? "/projects/migrate.json" : "/projects.json";
|
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, {
|
axios.post(url, {
|
||||||
...values,
|
...values,
|
||||||
auth_password:decoderPass,
|
auth_password:decoderPass,
|
||||||
|
@ -185,7 +212,7 @@ class Index extends Component {
|
||||||
this.setState({
|
this.setState({
|
||||||
isSpin: false
|
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}`);
|
this.props.history.push(`/projects/${result.data.login}/${result.data.identifier}`);
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
@ -337,7 +364,9 @@ class Index extends Component {
|
||||||
{
|
{
|
||||||
projectsType && projectsType === "mirror" &&
|
projectsType && projectsType === "mirror" &&
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i></p>
|
<p className="mt10 mb10 color-grey-3 pointer" onClick={this.changeMirrorCheck}>
|
||||||
|
需要授权验证<i className={mirrorCheck?"iconfont icon-xiajiantou font-13 ml10 color-grey-8":"iconfont icon-youjiantou font-13 ml10 color-grey-8"}></i>
|
||||||
|
<span className="ml20 font-12 color-red">如果源项目为公有仓库,禁止填写用户名密码。如果源项目为私有仓库,则必须填写正确的用户名和密码!</span></p>
|
||||||
{
|
{
|
||||||
mirrorCheck &&
|
mirrorCheck &&
|
||||||
<div className="df mb20" style={{alignItems:'center'}}>
|
<div className="df mb20" style={{alignItems:'center'}}>
|
||||||
|
|
|
@ -70,9 +70,9 @@ function Index(props){
|
||||||
function deleteEvent(type,count) {
|
function deleteEvent(type,count) {
|
||||||
let c = count;
|
let c = count;
|
||||||
if(type==="apply"){
|
if(type==="apply"){
|
||||||
setTransferCount(transferCount-count);
|
|
||||||
}else if(type==="undo"){
|
|
||||||
setApplyCount(applyCount-count);
|
setApplyCount(applyCount-count);
|
||||||
|
}else if(type==="undo"){
|
||||||
|
setTransferCount(transferCount-count);
|
||||||
}else{
|
}else{
|
||||||
setMessagesCount(0);
|
setMessagesCount(0);
|
||||||
c = messagesCount;
|
c = messagesCount;
|
||||||
|
|
|
@ -53,7 +53,7 @@ function UndoEvent(props){
|
||||||
Axios.post(url).then(result=>{
|
Axios.post(url).then(result=>{
|
||||||
if(result && result.data){
|
if(result && result.data){
|
||||||
getList();
|
getList();
|
||||||
props && props.deleteEvent("apply",1);
|
props && props.deleteEvent("undo",1);
|
||||||
}
|
}
|
||||||
}).catch(error=>{})
|
}).catch(error=>{})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState , useRef } from "react";
|
||||||
import {WhiteBack} from '../Component/layout';
|
import {WhiteBack} from '../Component/layout';
|
||||||
import AddMember from '../Component/AddMember';
|
import AddMember from '../Component/AddMember';
|
||||||
import AddGroup from '../Component/AddGroup';
|
import AddGroup from '../Component/AddGroup';
|
||||||
|
@ -8,9 +8,11 @@ import Group from './CollaboratorGroup';
|
||||||
function Collaborator(props){
|
function Collaborator(props){
|
||||||
const [ nav , setNav] = useState("1");
|
const [ nav , setNav] = useState("1");
|
||||||
const [ newId , setNewId] = useState(undefined);
|
const [ newId , setNewId] = useState(undefined);
|
||||||
|
const [ addOperation , setAddOperation] = useState(true);
|
||||||
const [ newGroupId , setNewGroupId] = useState(undefined);
|
const [ newGroupId , setNewGroupId] = useState(undefined);
|
||||||
const {projectsId ,owner} = props.match.params;
|
const {projectsId ,owner} = props.match.params;
|
||||||
|
|
||||||
|
|
||||||
const author = props && props.projectDetail && props.projectDetail.author;
|
const author = props && props.projectDetail && props.projectDetail.author;
|
||||||
|
|
||||||
function getID(id){
|
function getID(id){
|
||||||
|
@ -20,6 +22,7 @@ function Collaborator(props){
|
||||||
setNewGroupId(id);
|
setNewGroupId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WhiteBack>
|
<WhiteBack>
|
||||||
<div className="flex-a-center baseForm bbr">
|
<div className="flex-a-center baseForm bbr">
|
||||||
|
@ -27,15 +30,17 @@ function Collaborator(props){
|
||||||
author && author.type === "Organization" ?
|
author && author.type === "Organization" ?
|
||||||
<span>
|
<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 === "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>
|
||||||
:
|
:
|
||||||
<span className="font-18 text-black">协作者管理</span>
|
<span className="font-18 text-black">协作者管理</span>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
nav === "1" ?
|
nav === "1" &&
|
||||||
<AddMember getID={getID} login showNotification={props.showNotification}/>
|
<AddMember getID={getID} login showNotification={props.showNotification}/>
|
||||||
:
|
}
|
||||||
|
{
|
||||||
|
(nav !== "1" && addOperation) &&
|
||||||
<AddGroup getGroupID={getGroupID} organizeId={owner}/>
|
<AddGroup getGroupID={getGroupID} organizeId={owner}/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,7 +49,7 @@ function Collaborator(props){
|
||||||
nav === "1" ?
|
nav === "1" ?
|
||||||
<Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.projectDetail && props.projectDetail.author} showNotification={props.showNotification}/>
|
<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>
|
</div>
|
||||||
</WhiteBack>
|
</WhiteBack>
|
||||||
|
|
|
@ -10,7 +10,7 @@ const roles = {
|
||||||
read: "报告者",
|
read: "报告者",
|
||||||
};
|
};
|
||||||
const limit = 15;
|
const limit = 15;
|
||||||
function CollaboratorGroup({ newGroupId, owner, projectsId }) {
|
function CollaboratorGroup({ newGroupId, owner, projectsId , setAddOperation }) {
|
||||||
const [list, setList] = useState(undefined);
|
const [list, setList] = useState(undefined);
|
||||||
const [isSpin, setIsSpin] = useState(true);
|
const [isSpin, setIsSpin] = useState(true);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
|
@ -34,6 +34,7 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
|
||||||
setList(result.data.teams);
|
setList(result.data.teams);
|
||||||
setTotal(result.data.total_count);
|
setTotal(result.data.total_count);
|
||||||
setIsSpin(false);
|
setIsSpin(false);
|
||||||
|
setAddOperation(result.data.can_add);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {});
|
.catch((error) => {});
|
||||||
|
@ -47,16 +48,15 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
|
||||||
// 添加团队
|
// 添加团队
|
||||||
function addGroup(id) {
|
function addGroup(id) {
|
||||||
const url = `/${owner}/${projectsId}/teams.json`;
|
const url = `/${owner}/${projectsId}/teams.json`;
|
||||||
axios
|
axios.post(url, {
|
||||||
.post(url, {
|
team_id: id,
|
||||||
team_id: id,
|
})
|
||||||
})
|
.then((result) => {
|
||||||
.then((result) => {
|
if (result && result.data) {
|
||||||
if (result && result.data) {
|
getData();
|
||||||
getData();
|
}
|
||||||
}
|
})
|
||||||
})
|
.catch((error) => {});
|
||||||
.catch((error) => {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除团队
|
// 删除团队
|
||||||
|
@ -77,7 +77,11 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
|
||||||
title: "团队名",
|
title: "团队名",
|
||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
render: (value, item) => {
|
render: (value, item) => {
|
||||||
return <Link to={`/${owner}/group/${item.id}`}>{value}</Link>;
|
if(item.is_admin || item.is_member){
|
||||||
|
return <Link to={`/${owner}/group/${item.id}`}>{value}</Link>;
|
||||||
|
}else{
|
||||||
|
return <span>{value}</span>;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ const menu = [
|
||||||
{name:"合并请求",index:"pulls"},
|
{name:"合并请求",index:"pulls"},
|
||||||
{name:"Wiki",index:"wiki"},
|
{name:"Wiki",index:"wiki"},
|
||||||
{name:"工作流(beta版)",index:"devops"},
|
{name:"工作流(beta版)",index:"devops"},
|
||||||
{name:"资源库",index:"resources"},
|
// {name:"资源库",index:"resources"},
|
||||||
{name:"里程碑",index:"versions"},
|
{name:"里程碑",index:"versions"},
|
||||||
{name:"动态",index:"activity"},
|
{name:"动态",index:"activity"},
|
||||||
]
|
]
|
||||||
|
|
|
@ -24,21 +24,32 @@ export default Form.create()(
|
||||||
const [check_box, setCheckBox] = useState(false);
|
const [check_box, setCheckBox] = useState(false);
|
||||||
const [switch_box, setSwtichBox] = useState([]);
|
const [switch_box, setSwtichBox] = useState([]);
|
||||||
const [onwers, setOnwers] = useState(false);
|
const [onwers, setOnwers] = useState(false);
|
||||||
|
const [auth, setAuth] = useState("");
|
||||||
const [ descNum , setDescNum ] = useState(0);
|
const [ descNum , setDescNum ] = useState(0);
|
||||||
const [switch_box_code, setSwtichBoxCode] = useState(false);
|
const [switch_box_code, setSwtichBoxCode] = useState(false);
|
||||||
const [switch_box_pull, setSwtichBoxPull] = useState(false);
|
const [switch_box_pull, setSwtichBoxPull] = useState(false);
|
||||||
const [switch_box_issue, setSwtichBoxIssue] = useState(false);
|
const [switch_box_issue, setSwtichBoxIssue] = useState(false);
|
||||||
const [switch_box_release, setSwtichBoxRelease] = useState(false);
|
const [switch_box_release, setSwtichBoxRelease] = useState(false);
|
||||||
|
const [switch_box_wiki, setSwtichBoxWiki] = useState(false);
|
||||||
const { getFieldDecorator, validateFields, setFieldsValue } = form;
|
const { getFieldDecorator, validateFields, setFieldsValue } = form;
|
||||||
const { OIdentifier, groupId } = match.params;
|
const { OIdentifier, groupId } = match.params;
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
setFieldsValue({
|
||||||
|
authorize:"read",
|
||||||
|
includes_all_project:0
|
||||||
|
})
|
||||||
|
},[])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (GroupDetail) {
|
if (GroupDetail) {
|
||||||
setOnwers(GroupDetail.authorize === "owner");
|
setOnwers(GroupDetail.authorize === "owner");
|
||||||
|
setAuth(GroupDetail.authorize);
|
||||||
setCheckBox(GroupDetail.can_create_org_project)
|
setCheckBox(GroupDetail.can_create_org_project)
|
||||||
setSwtichBox(GroupDetail.units)
|
setSwtichBox(GroupDetail.units)
|
||||||
setFieldsValue({
|
setFieldsValue({
|
||||||
...GroupDetail
|
...GroupDetail,
|
||||||
|
includes_all_project:GroupDetail.includes_all_project ? 1 :0
|
||||||
})
|
})
|
||||||
setDescNum(GroupDetail.description ? GroupDetail.description.length : 0);
|
setDescNum(GroupDetail.description ? GroupDetail.description.length : 0);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +61,7 @@ export default Form.create()(
|
||||||
setSwtichBoxPull(switch_checked("pulls"))
|
setSwtichBoxPull(switch_checked("pulls"))
|
||||||
setSwtichBoxIssue(switch_checked("issues"))
|
setSwtichBoxIssue(switch_checked("issues"))
|
||||||
setSwtichBoxRelease(switch_checked("releases"))
|
setSwtichBoxRelease(switch_checked("releases"))
|
||||||
|
setSwtichBoxWiki(switch_checked("wiki"))
|
||||||
}
|
}
|
||||||
}, [switch_box])
|
}, [switch_box])
|
||||||
|
|
||||||
|
@ -68,11 +80,13 @@ export default Form.create()(
|
||||||
setIsSpin(true)
|
setIsSpin(true)
|
||||||
validateFields((error, values) => {
|
validateFields((error, values) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
values.unit_types = switch_box
|
// values.unit_types = switch_box
|
||||||
|
values.unit_types = ['code','pulls','issues','releases','wiki'];
|
||||||
if (groupId) { // 表示编辑,否则为新建
|
if (groupId) { // 表示编辑,否则为新建
|
||||||
const url = `/organizations/${OIdentifier}/teams/${groupId}.json`;
|
const url = `/organizations/${OIdentifier}/teams/${groupId}.json`;
|
||||||
axios.put(url, {
|
axios.put(url, {
|
||||||
...values
|
...values,
|
||||||
|
includes_all_project:values.includes_all_project === 1?true:false
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
showNotification("基本设置更新成功!");
|
showNotification("基本设置更新成功!");
|
||||||
|
@ -82,7 +96,8 @@ export default Form.create()(
|
||||||
} else {
|
} else {
|
||||||
const url = `/organizations/${OIdentifier}/teams.json`;
|
const url = `/organizations/${OIdentifier}/teams.json`;
|
||||||
axios.post(url, {
|
axios.post(url, {
|
||||||
...values
|
...values,
|
||||||
|
includes_all_project:values.includes_all_project === 1?true:false
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if (result && result.data) {
|
if (result && result.data) {
|
||||||
showNotification("团队创建成功!");
|
showNotification("团队创建成功!");
|
||||||
|
@ -132,6 +147,11 @@ export default Form.create()(
|
||||||
setSwtichBoxRelease(checked)
|
setSwtichBoxRelease(checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function switch_wiki_types(checked, event) {
|
||||||
|
switch_unit_types(checked, "wiki");
|
||||||
|
setSwtichBoxWiki(checked);
|
||||||
|
}
|
||||||
|
|
||||||
function cancelEdit(){
|
function cancelEdit(){
|
||||||
if(groupId){
|
if(groupId){
|
||||||
history.push(`/${OIdentifier}/group/${groupId}`);
|
history.push(`/${OIdentifier}/group/${groupId}`);
|
||||||
|
@ -140,6 +160,9 @@ export default Form.create()(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeAuth(params) {
|
||||||
|
setAuth(params.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
function checkname(rule, value, callback){
|
function checkname(rule, value, callback){
|
||||||
if(!value){
|
if(!value){
|
||||||
|
@ -192,8 +215,8 @@ export default Form.create()(
|
||||||
"includes_all_project",
|
"includes_all_project",
|
||||||
[],
|
[],
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Radio value={false} style={addStyle}>指定项目<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={true} style={OptionStyle}>所有项目<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":""
|
</Radio.Group>, false, 0,onwers ? "hide":""
|
||||||
)}
|
)}
|
||||||
{helper(
|
{helper(
|
||||||
|
@ -202,37 +225,42 @@ export default Form.create()(
|
||||||
[],
|
[],
|
||||||
<Checkbox checked={check_box} onChange={change_check_box_status} style={OptionStyle}>新建项目<span className="color-grey-8 ml10">(成员可以在组织中新建项目。创建者将自动获得新建的项目的管理员权限)</span></Checkbox>, false, 20,onwers ? "hide":""
|
<Checkbox checked={check_box} onChange={change_check_box_status} style={OptionStyle}>新建项目<span className="color-grey-8 ml10">(成员可以在组织中新建项目。创建者将自动获得新建的项目的管理员权限)</span></Checkbox>, false, 20,onwers ? "hide":""
|
||||||
)}
|
)}
|
||||||
{/* {helper(
|
{helper(
|
||||||
'版本库权限:',
|
'版本库权限:',
|
||||||
"authorize",
|
"authorize",
|
||||||
[],
|
[],
|
||||||
<Radio.Group>
|
<Radio.Group onChange={changeAuth}>
|
||||||
<Radio value="read" style={addStyle}>读取权限<span className="color-grey-8 ml10">(成员可以查看和克隆团队项目)</span></Radio>
|
<Radio value="read" style={addStyle}>读取权限<span className="color-grey-8 ml10">(成员可以查看和克隆团队项目)</span></Radio>
|
||||||
<Radio value="write" style={addStyle}>写入权限<span className="color-grey-8 ml10">(成员可以查看和推送提交到团队项目)</span></Radio>
|
<Radio value="write" style={addStyle}>写入权限<span className="color-grey-8 ml10">(成员可以查看和推送提交到团队项目)</span></Radio>
|
||||||
<Radio value="admin" style={OptionStyle}>管理员权限<span className="color-grey-8 ml10">(成员可以拉取和推送到团队项目同时可以添加协作者)</span></Radio>
|
<Radio value="admin" style={OptionStyle}>管理员权限<span className="color-grey-8 ml10">(成员可以拉取和推送到团队项目同时可以添加协作者)</span></Radio>
|
||||||
</Radio.Group>, false, 20,onwers ? "hide":""
|
</Radio.Group>, false, 20,onwers ? "hide":""
|
||||||
)} */}
|
)}
|
||||||
</Form>
|
</Form>
|
||||||
{/* <p className="required">允许访问项目单元:</p>
|
{/* <div className={(auth!=="owner" && auth !=="admin") ? "" :"hide"}>
|
||||||
<AlignCenter className="mb10">
|
<p className="required">允许访问项目单元:</p>
|
||||||
<Switch checked={switch_box_code} onClick={switch_code_types} />
|
<AlignCenter className="mb10">
|
||||||
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码、文件、提交和分支)</span></span>
|
<Switch checked={switch_box_code} onClick={switch_code_types} />
|
||||||
</AlignCenter>
|
<span className="ml30 color-grey-3">代码库<span className="color-grey-8 ml15">(查看源码、文件、提交和分支)</span></span>
|
||||||
<AlignCenter className="mb10">
|
</AlignCenter>
|
||||||
<Switch checked={switch_box_issue} onClick={switch_issue_types} />
|
<AlignCenter className="mb10">
|
||||||
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告、任务和里程碑)</span></span>
|
<Switch checked={switch_box_issue} onClick={switch_issue_types} />
|
||||||
</AlignCenter>
|
<span className="ml30 color-grey-3">任务<span className="color-grey-8 ml15">(组织 bug 报告、任务和里程碑)</span></span>
|
||||||
<AlignCenter className="mb10">
|
</AlignCenter>
|
||||||
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
|
<AlignCenter className="mb10">
|
||||||
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
|
<Switch checked={switch_box_pull} onClick={switch_pull_types} />
|
||||||
</AlignCenter>
|
<span className="ml30 color-grey-3">合并请求<span className="color-grey-8 ml15">(启用合并请求和代码评审)</span></span>
|
||||||
<AlignCenter className="mb20">
|
</AlignCenter>
|
||||||
<Switch checked={switch_box_release} onClick={switch_releas_types} />
|
<AlignCenter className="mb10">
|
||||||
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
|
<Switch checked={switch_box_release} onClick={switch_releas_types} />
|
||||||
</AlignCenter>
|
<span className="ml30 color-grey-3">版本发布<span className="color-grey-8 ml15">(跟踪项目版本和下载)</span></span>
|
||||||
*/}
|
</AlignCenter>
|
||||||
|
<AlignCenter className="mb20">
|
||||||
|
<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> */}
|
||||||
<Button type={"primary"} onClick={saveGroupFrom}>{groupId ? "更新团队设置" : "新建团队"}</Button>
|
<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>
|
</Div>
|
||||||
</WhiteBack>
|
</WhiteBack>
|
||||||
</Spin>
|
</Spin>
|
||||||
|
|
|
@ -368,5 +368,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.hide{
|
.hide{
|
||||||
display: hidden;
|
display: none;
|
||||||
}
|
}
|
|
@ -75,7 +75,7 @@ function List(props){
|
||||||
<Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/>
|
<Search placeholder="输入仓库名称进行搜索" onSearch={onSearch}/>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{ organizeDetail && organizeDetail.is_admin ?
|
{ organizeDetail && organizeDetail.can_create_project ?
|
||||||
<Sort menu={menu_new}>
|
<Sort menu={menu_new}>
|
||||||
<a className="addBtn mr30">+ 新建项目</a>
|
<a className="addBtn mr30">+ 新建项目</a>
|
||||||
</Sort>
|
</Sort>
|
||||||
|
|
|
@ -97,7 +97,12 @@ function RightBox({ OIdentifier , history , admin }) {
|
||||||
return(
|
return(
|
||||||
<div className="teammembers" key={key}>
|
<div className="teammembers" key={key}>
|
||||||
<div>
|
<div>
|
||||||
<Link to={`/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
|
{
|
||||||
|
(item.is_admin || item.is_member) ?
|
||||||
|
<Link to={`/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
|
||||||
|
:
|
||||||
|
<ColorListName>{item.name}</ColorListName>
|
||||||
|
}
|
||||||
<Align>
|
<Align>
|
||||||
<Span>{item.num_users}名成员</Span>
|
<Span>{item.num_users}名成员</Span>
|
||||||
<Span>{item.num_projects}个仓库</Span>
|
<Span>{item.num_projects}个仓库</Span>
|
||||||
|
|
|
@ -168,7 +168,7 @@ export default Form.create()(
|
||||||
'权限:',
|
'权限:',
|
||||||
"repo_admin_change_team_access",
|
"repo_admin_change_team_access",
|
||||||
[],
|
[],
|
||||||
<Checkbox style={radioStyle}>仓库管理员可以添加或移除团队的访问权限</Checkbox>,false,true
|
<Checkbox style={radioStyle}>项目管理员可以添加或移除团队的访问权限</Checkbox>,false,true
|
||||||
)}
|
)}
|
||||||
<Divider/>
|
<Divider/>
|
||||||
{helper(
|
{helper(
|
||||||
|
|
|
@ -75,7 +75,12 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
||||||
return(
|
return(
|
||||||
<div key={key}>
|
<div key={key}>
|
||||||
<p className="g-head">
|
<p className="g-head">
|
||||||
<Link to={`/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
|
{
|
||||||
|
(item.is_admin || item.is_member) ?
|
||||||
|
<Link to={`/${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>
|
<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_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}/>}
|
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
|
||||||
|
|
|
@ -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 { Button, Dropdown, Icon, Input, Menu, Tooltip, Select, Upload, message, Spin } from 'antd';
|
||||||
import { getImageUrl, timeAgo } from 'educoder';
|
import { getImageUrl, timeAgo } from 'educoder';
|
||||||
import cookie from 'react-cookies';
|
import cookie from 'react-cookies';
|
||||||
// import Loading from "../../Loading";
|
import CopyTool from '../Component/CopyTool';
|
||||||
import DelModal from './components/ModalFun';
|
import DelModal from './components/ModalFun';
|
||||||
import Welcome from './Welcome';
|
import Welcome from './Welcome';
|
||||||
import { wikiPages, getWiki, deleteWiki } from './api';
|
import { wikiPages, getWiki, deleteWiki } from './api';
|
||||||
|
@ -14,15 +14,12 @@ const InputGroup = Input.Group;
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
export default (props) => {
|
export default (props) => {
|
||||||
const { match, current_user, history, showNotification, project, projectDetail } = props;
|
const { match, history, showNotification, project, projectDetail } = props;
|
||||||
// const permission = projectDetail && projectDetail.permission !== "Reporter";
|
|
||||||
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
|
const permission = projectDetail && projectDetail.permission && projectDetail.permission !== "Reporter";
|
||||||
|
|
||||||
let projectsId = match.params.projectsId;
|
let projectsId = match.params.projectsId;
|
||||||
let owner = match.params.owner;
|
let owner = match.params.owner;
|
||||||
|
|
||||||
console.log(project);
|
|
||||||
|
|
||||||
const [fileArrInit, setFileArrInit] = useState(null);
|
const [fileArrInit, setFileArrInit] = useState(null);
|
||||||
const [checkItem, setCheckItem] = useState({});
|
const [checkItem, setCheckItem] = useState({});
|
||||||
const [itemDetail, setItemDetail] = useState({});
|
const [itemDetail, setItemDetail] = useState({});
|
||||||
|
@ -85,7 +82,7 @@ export default (props) => {
|
||||||
DelModal({
|
DelModal({
|
||||||
title: '删除页面',
|
title: '删除页面',
|
||||||
contentTitle: `您确定要删除“${item.name}”此页面吗?`,
|
contentTitle: `您确定要删除“${item.name}”此页面吗?`,
|
||||||
content: '此操作将删除该页面,请进行确认以防文件的丢失。',
|
content: '此操作将删除该页面,请进行确认以防文件的丢失',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
deleteWiki({
|
deleteWiki({
|
||||||
owner: owner,
|
owner: owner,
|
||||||
|
@ -109,17 +106,6 @@ export default (props) => {
|
||||||
window.location.href = `/${login}`;
|
window.location.href = `/${login}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 复制链接
|
|
||||||
const copyUrl = useCallback(() => {
|
|
||||||
let wikiUrl = document.getElementById("wikiUrl");
|
|
||||||
wikiUrl.select();
|
|
||||||
if (document.execCommand('copy')) {
|
|
||||||
document.execCommand('copy');
|
|
||||||
}
|
|
||||||
message.success('复制成功');
|
|
||||||
wikiUrl.blur();
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
function addFile() {
|
function addFile() {
|
||||||
history.push(`/projects/${owner}/${projectsId}/wiki/add`);
|
history.push(`/projects/${owner}/${projectsId}/wiki/add`);
|
||||||
}
|
}
|
||||||
|
@ -231,6 +217,7 @@ export default (props) => {
|
||||||
<Button type="default" className="ml10">导出<Icon type="caret-down" /></Button>
|
<Button type="default" className="ml10">导出<Icon type="caret-down" /></Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Button type="default" className="ml10" onClick={preview}>预览</Button>
|
<Button type="default" className="ml10" onClick={preview}>预览</Button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -246,8 +233,8 @@ export default (props) => {
|
||||||
|
|
||||||
{
|
{
|
||||||
fileArr.map(item => {
|
fileArr.map(item => {
|
||||||
return <div className="wiki-nav-title-parent">
|
return <div className="wiki-nav-title-parent" key={item.name}>
|
||||||
<div className={`wiki-nav-title ${item.name === checkItem.name ? 'active' : ''}`} key={item.name} onClick={() => { setCheckItem(item) }}>
|
<div className={`wiki-nav-title ${item.name === checkItem.name ? 'active' : ''}`} onClick={() => { setCheckItem(item) }}>
|
||||||
<div className="nav-title-left">
|
<div className="nav-title-left">
|
||||||
<i className="iconfont icon-wenjianjia2 mr3"></i>
|
<i className="iconfont icon-wenjianjia2 mr3"></i>
|
||||||
<span className="nav-title-left-text">{item.name}</span>
|
<span className="nav-title-left-text">{item.name}</span>
|
||||||
|
@ -266,9 +253,7 @@ export default (props) => {
|
||||||
<Option value="SSH">SSH</Option>
|
<Option value="SSH">SSH</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
|
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
|
||||||
<Tooltip placement="bottom" title={'复制'}>
|
<CopyTool className="copy-wiki" inputId="wikiUrl" />
|
||||||
<i className="iconfont icon-fuzhiicon copy-svg" onClick={copyUrl}></i>
|
|
||||||
</Tooltip>
|
|
||||||
</InputGroup>}
|
</InputGroup>}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -277,11 +262,11 @@ export default (props) => {
|
||||||
<div className="wiki-content-head">
|
<div className="wiki-content-head">
|
||||||
<div className="wiki-content-head-left">
|
<div className="wiki-content-head-left">
|
||||||
<h3 className="wiki-detail-title">{checkItem.name}</h3>
|
<h3 className="wiki-detail-title">{checkItem.name}</h3>
|
||||||
<span className="user-box mr10" onClick={() => { goUser(current_user.login) }}>
|
<span className="user-box mr10" onClick={() => { checkItem.commit && goUser(checkItem.commit.author.name) }}>
|
||||||
{itemDetail.image_url && <img alt="头像" className="head-log-small" src={getImageUrl(`/${itemDetail.image_url}`)} />}
|
{itemDetail.image_url && <img alt="头像" className="head-log-small" src={getImageUrl(`/${itemDetail.image_url}`)} />}
|
||||||
<span >{checkItem.commit ? checkItem.commit.author.name : ''}</span>
|
<span >{itemDetail.userName}</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="time-ago">上次修改于{checkItem.commit && timeAgo(checkItem.commit.author.when)}</span>
|
<span className="time-ago">上次修改于{checkItem.commit ? timeAgo(checkItem.commit.author.when):'刚刚'}</span>
|
||||||
</div>
|
</div>
|
||||||
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
|
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -199,7 +199,7 @@ body {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.copy-svg {
|
.copy-wiki {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { useEffect, useCallback, useState } from 'react';
|
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 { wikiPages, getWiki, } from './api';
|
||||||
import { httpUrl } from './fetch';
|
import { httpUrl } from './fetch';
|
||||||
import './Index.scss';
|
import './Index.scss';
|
||||||
|
@ -59,16 +60,6 @@ export default (props) => {
|
||||||
});
|
});
|
||||||
}, [project, checkItem]);
|
}, [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() {
|
function goEdit() {
|
||||||
history.push(`/projects/${owner}/${projectsId}/wiki/edit/${checkItem.name}`);
|
history.push(`/projects/${owner}/${projectsId}/wiki/edit/${checkItem.name}`);
|
||||||
}
|
}
|
||||||
|
@ -113,9 +104,7 @@ export default (props) => {
|
||||||
<Option value="SSH">SSH</Option>
|
<Option value="SSH">SSH</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
|
<Input id="wikiUrl" value={urlType === 'HTTPS' ? checkItem.wiki_clone_link.https : checkItem.wiki_clone_link.ssh} />
|
||||||
<Tooltip placement="bottom" title={'复制'}>
|
<CopyTool className="copy-wiki" inputId="wikiUrl"/>
|
||||||
<i className="iconfont icon-fuzhiicon copy-svg" onClick={copyUrl}></i>
|
|
||||||
</Tooltip>
|
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import * as ReactDOM from 'react-dom';
|
import * as ReactDOM from 'react-dom';
|
||||||
import LoginDialog from '../../../../modules/login/LoginDialog';
|
import LoginDialog from '../../../../modules/login/LoginDialog';
|
||||||
import './index.scss';
|
|
||||||
|
|
||||||
// 使用函数调用删除组件
|
// 使用函数调用登录组件
|
||||||
export default function DelModal(props) {
|
export default function Login(props) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
|
||||||
|
@ -16,9 +15,6 @@ export default function DelModal(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
/**
|
|
||||||
* Sync render blocks React event. Let's make this async.
|
|
||||||
*/
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<MyLoginDialog afterClose={destroy} />
|
<MyLoginDialog afterClose={destroy} />
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +1,33 @@
|
||||||
|
/* eslint-disable react/jsx-no-duplicate-props */
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import * as ReactDOM from 'react-dom';
|
import * as ReactDOM from 'react-dom';
|
||||||
import { Modal, Button } from 'antd';
|
import { Modal, Button } from 'antd';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
|
InitModal.defaultProps = {
|
||||||
|
okText: '确认', //确定按钮的文字
|
||||||
|
cancelText: '取消', //取消按钮的文字
|
||||||
|
className: '', //
|
||||||
|
inputId: 'copyText', //要复制的文本的ID
|
||||||
|
};
|
||||||
|
|
||||||
// 使用函数调用删除组件
|
// 使用函数调用删除组件
|
||||||
export default function DelModal(props) {
|
export default function DelModal(props) {
|
||||||
renderModal({ ...props, type: 'delete' })
|
renderModal({ ...props, type: 'delete' })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function confirmModal(props) {
|
// 使用函数调用选择模态框组件
|
||||||
|
export function Confirm(props) {
|
||||||
renderModal({ ...props, type: 'confirm' })
|
renderModal({ ...props, type: 'confirm' })
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderModal(props) {
|
function renderModal(props) {
|
||||||
const type = props.type;
|
const { type, afterClose } = props;
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
|
||||||
function destroy() {
|
function destroy() {
|
||||||
|
afterClose && afterClose();
|
||||||
const unmountResult = ReactDOM.unmountComponentAtNode(div);
|
const unmountResult = ReactDOM.unmountComponentAtNode(div);
|
||||||
if (unmountResult && div.parentNode) {
|
if (unmountResult && div.parentNode) {
|
||||||
div.parentNode.removeChild(div);
|
div.parentNode.removeChild(div);
|
||||||
|
@ -26,18 +36,26 @@ function renderModal(props) {
|
||||||
|
|
||||||
function modalType(type) {
|
function modalType(type) {
|
||||||
if (type === 'delete') {
|
if (type === 'delete') {
|
||||||
return <DeleteModal title="删除页面" contentTitle="确定要删除吗?" afterClose={destroy} {...props} />
|
return <InitModal
|
||||||
|
title="删除"
|
||||||
|
contentTitle="确定要删除吗?"
|
||||||
|
okText="确认删除"
|
||||||
|
{...props}
|
||||||
|
|
||||||
|
afterClose={destroy}
|
||||||
|
contentTitle={<React.Fragment>
|
||||||
|
<i className="red-circle iconfont icon-shanchu_tc_icon mr3"></i>
|
||||||
|
{props.contentTitle}
|
||||||
|
</React.Fragment>}
|
||||||
|
/>
|
||||||
} else if (type === 'confirm') {
|
} else if (type === 'confirm') {
|
||||||
return <ConfirmModal title="选择" afterClose={destroy} {...props} />
|
return <InitModal title="选择" afterClose={destroy} {...props} />
|
||||||
} else {
|
} else {
|
||||||
return <ConfirmModal title="选择" afterClose={destroy} {...props} />
|
return <InitModal title="选择" afterClose={destroy} {...props} />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
/**
|
|
||||||
* Sync render blocks React event. Let's make this async.
|
|
||||||
*/
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
modalType(type),
|
modalType(type),
|
||||||
|
@ -48,16 +66,17 @@ function renderModal(props) {
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 真正的删除组件
|
// 选择模态框组件
|
||||||
function DeleteModal({
|
function InitModal({
|
||||||
onCancel,
|
onCancel,
|
||||||
onOk,
|
onOk,
|
||||||
title,
|
title,
|
||||||
contentTitle,
|
contentTitle,
|
||||||
content,
|
content,
|
||||||
afterClose,
|
|
||||||
okText,
|
okText,
|
||||||
cancelText,
|
cancelText,
|
||||||
|
afterClose,
|
||||||
|
className,
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const [visible, setVisible] = useState(true);
|
const [visible, setVisible] = useState(true);
|
||||||
|
@ -78,71 +97,20 @@ function DeleteModal({
|
||||||
onCancel={onCancelModal}
|
onCancel={onCancelModal}
|
||||||
afterClose={afterClose}
|
afterClose={afterClose}
|
||||||
title={title}
|
title={title}
|
||||||
className="myself-modal"
|
className={`myself-modal ${className}`}
|
||||||
centered
|
centered
|
||||||
footer={[
|
footer={[
|
||||||
<Button key="back" onClick={onCancelModal}>
|
<Button type="default" key="back" onClick={onCancelModal}>
|
||||||
{cancelText||'取消'}
|
{cancelText}
|
||||||
</Button>,
|
</Button>,
|
||||||
<Button className="foot-submit" key="submit" onClick={onSuccess}>
|
<Button className="foot-submit" key="submit" onClick={onSuccess}>
|
||||||
{okText||'确认删除'}
|
{okText}
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<p className="delete-title">
|
{contentTitle && <p className="content-title">{contentTitle}</p>}
|
||||||
<i className="red-circle iconfont icon-shanchu_tc_icon mr3"></i>
|
<p className="content-descibe">{content}</p>
|
||||||
{contentTitle}</p>
|
|
||||||
<p className="delete-descibe">{content}</p>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 选择组件
|
|
||||||
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 (
|
|
||||||
<Modal
|
|
||||||
visible={visible}
|
|
||||||
onCancel={onCancelModal}
|
|
||||||
afterClose={afterClose}
|
|
||||||
title={title}
|
|
||||||
className="myself-modal"
|
|
||||||
centered
|
|
||||||
footer={[
|
|
||||||
<Button key="back" onClick={onCancelModal}>
|
|
||||||
{cancelText||'取消'}
|
|
||||||
</Button>,
|
|
||||||
<Button className="foot-submit" key="submit" onClick={onSuccess}>
|
|
||||||
{okText||'确认'}
|
|
||||||
</Button>,
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
{contentTitle && <p className="delete-title">{contentTitle}</p>}
|
|
||||||
<p className="delete-descibe">{content}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
.ant-modal-body {
|
.ant-modal-body {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.delete-title {
|
.content-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
color: #ca0002;
|
color: #ca0002;
|
||||||
font-size: 1.5rem !important;
|
font-size: 1.5rem !important;
|
||||||
}
|
}
|
||||||
.delete-descibe {
|
.content-descibe {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 33px;
|
line-height: 33px;
|
||||||
|
@ -53,4 +53,11 @@
|
||||||
border-color: #df0002;
|
border-color: #df0002;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.ant-btn-default:hover,
|
||||||
|
.ant-btn-default:active,
|
||||||
|
.ant-btn-default:focus {
|
||||||
|
background: #f3f4f6;
|
||||||
|
color: #333;
|
||||||
|
border-color: #d0d0d0;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ import Search from '../Component/Search';
|
||||||
import Item from './Team-item';
|
import Item from './Team-item';
|
||||||
import Nodata from '../Nodata';
|
import Nodata from '../Nodata';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
const limit = 15;
|
const limit = 15;
|
||||||
function Team(props){
|
function Team(props){
|
||||||
|
@ -14,7 +15,7 @@ function Team(props){
|
||||||
const [ sort_direction , setSort_direction ] = useState("asc");
|
const [ sort_direction , setSort_direction ] = useState("asc");
|
||||||
const [ sort_by ,setSort_by ] = useState("created_at");
|
const [ sort_by ,setSort_by ] = useState("created_at");
|
||||||
const [ search ,setSearch ] = useState(undefined);
|
const [ search ,setSearch ] = useState(undefined);
|
||||||
|
const { checkIfLogin , showLoginDialog } = props;
|
||||||
const { username } = props.match.params;
|
const { username } = props.match.params;
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(username){
|
if(username){
|
||||||
|
@ -47,14 +48,6 @@ function Team(props){
|
||||||
</Menu>
|
</Menu>
|
||||||
)
|
)
|
||||||
|
|
||||||
function newFunc() {
|
|
||||||
const { checkIfLogin , showLoginDialog } = props;
|
|
||||||
if(checkIfLogin()){
|
|
||||||
props.history.push(`/organize/new`);
|
|
||||||
}else{
|
|
||||||
showLoginDialog && showLoginDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<div className="headerbox">
|
<div className="headerbox">
|
||||||
|
@ -62,7 +55,10 @@ function Team(props){
|
||||||
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
|
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<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}>
|
<Dropdown overlay={menu}>
|
||||||
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
Loading…
Reference in New Issue