导入项目

This commit is contained in:
caishi 2023-06-21 11:03:56 +08:00
parent e83686b55c
commit de69c09c2a
3 changed files with 13 additions and 16 deletions

View File

@ -65,7 +65,7 @@ function CoderDepot(props){
let pathname = props.history.location.pathname;
const { platform , mirror_status } = props ;
//distribution
const distribution = details && details.type !== 2 && ( details.permission && details.permission !== "Reporter");
const distribution = details && details.type ===0 && ( details.permission && details.permission !== "Reporter");
const { bannerList } = props;
useEffect(()=>{
if(bannerList && bannerList.length>0){
@ -93,7 +93,7 @@ function CoderDepot(props){
useEffect(()=>{
if(details && mirror_status!==2){
if(details && mirror_status===0){
setProjectDetail(details);
setTopics(details.topics);
setDesc(details.description);
@ -126,7 +126,7 @@ function CoderDepot(props){
},[treeValue])
useEffect(()=>{
if (projectsId && owner && defaultBranch && mirror_status!==2){
if (projectsId && owner && defaultBranch && mirror_status===0){
let b = turnbar(branchName) ;
if(pathname.indexOf(`/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${b}/`) > -1) {
let url = pathname.split(`/tree/${b}/`)[1];
@ -142,7 +142,7 @@ function CoderDepot(props){
},[projectsId,owner,pathname,defaultBranch,mirror_status])
useEffect(()=>{
if(platform && mirror_status!==2){
if(platform && mirror_status===0){
setReadOnly(props.history.location.search.indexOf('edit') !== -1);
axios.get(`/${owner}/${projectsId}/releases.json`).then((result)=>{
if(result && result.data){
@ -386,14 +386,14 @@ function CoderDepot(props){
const { current_user , checkIfLogin , showLoginDialog } = props;
const baseOper = current_user && current_user.login && issuesFlag;
const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter" && projectDetail.type !== 2 && pullsFlag && props.platform;
const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin));
const baseOperate = projectDetail && projectDetail.permission && projectDetail.permission !=="Reporter" && projectDetail.type ===0 && pullsFlag && props.platform;
const fileOperate = type === "dir" && projectDetail && projectDetail.type ===0 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin));
return(
<WhiteBack>
{mirror_status !== 2 && <UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} topicsInfo={topics} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate} showNotification={props.showNotification}/> }
{mirror_status ===0 && <UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} topicsInfo={topics} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/> }
<Spin spinning={isSpin}>
{
((dirInfo || fileInfo) && mirror_status!==2 ) &&
((dirInfo || fileInfo) && mirror_status===0 ) &&
<React.Fragment>
<DrawerPanel
history={props.history}
@ -421,7 +421,7 @@ function CoderDepot(props){
<AlignCenter>
<div className="mr30">
{
props && (props.platform && mirror_status !== 2) ?
props && (props.platform && mirror_status ===0) ?
<SelectBranch
repo_id={projectDetail && projectDetail.repo_id}
projectsId={projectsId}
@ -651,9 +651,9 @@ function CoderDepot(props){
</React.Fragment>
}
{/* 贡献者 */}
{mirror_status !==2 && <Contributors owner={owner} projectsId={projectsId} /> }
{mirror_status ===0 && <Contributors owner={owner} projectsId={projectsId} /> }
{/* 语言 */}
{ mirror_status !== 2 && <LanguagePower owner={owner} projectsId={projectsId}/> }
{ mirror_status ===0 && <LanguagePower owner={owner} projectsId={projectsId}/> }
</Gap>
</ShortWidth>
}

View File

@ -198,8 +198,6 @@ class Detail extends Component {
componentDidMount = () => {
const { mirror_status } = this.state
this.props.showNotification("getProject getProject getProject",mirror_status);
this.getProject();
let history = this.props.location;
this.clearIssueCookies(history);
@ -242,7 +240,6 @@ class Detail extends Component {
open_devops: result.data.open_devops,
platform: result.data.platform && result.data.platform !== 'educoder'
})
if (result.data.type !== 0 && result.data.mirror_status === 1) {
console.log("--------start channel --------");
// 是镜像项目,且未完成迁移
@ -262,11 +259,11 @@ class Detail extends Component {
mirror_status:1
})
} else if (result.data.mirror_status === 2) {
this.deleteProjectBack();
this.setState({
mirror_status:2,
firstSync: false
})
this.deleteProjectBack();
} else {
this.getBanner();
this.getDetail();

View File

@ -4,7 +4,7 @@ import "./sub.scss";
import axios from 'axios';
import { useState } from 'react';
const { TextArea } = Input;
function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url, topicsInfo,showNotification}){
function UpdateDescModal({form , visible , onCancel , onOk,desc,website,lesson_url, topicsInfo}){
const { getFieldDecorator, validateFields , setFieldsValue } = form;
const [topics, setTopics] = useState(undefined);