修改websocket问题
This commit is contained in:
parent
fb872f3a3d
commit
52e08e77e5
|
@ -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,344 +435,344 @@ class Detail extends Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
textFunc = (forked_from_project_id,fork_info)=>{
|
textFunc = (forked_from_project_id, fork_info) => {
|
||||||
let type = fork_info && fork_info.fork_project_user_type;
|
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={`${type ==="Organization" ? "/organize":'/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
|
<Link to={`${type === "Organization" ? "/organize" : '/users'}/${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">
|
||||||
{project && project.author &&
|
{project && project.author &&
|
||||||
<Link to={`${project.author.type ==="Organization" ? "/organize":'/users'}/${project.author.login}`}>{project.author.name}</Link>
|
<Link to={`${project.author.type === "Organization" ? "/organize" : '/users'}/${project.author.login}`}>{project.author.name}</Link>
|
||||||
}
|
}
|
||||||
<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>
|
||||||
)
|
)
|
||||||
|
|
|
@ -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()){
|
||||||
|
@ -144,6 +146,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 +199,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 +214,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 +366,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'}}>
|
||||||
|
|
Loading…
Reference in New Issue