diff --git a/src/forge/Component/EducoderAccount.jsx b/src/forge/Component/EducoderAccount.jsx index 59e2295f..6cd9e180 100644 --- a/src/forge/Component/EducoderAccount.jsx +++ b/src/forge/Component/EducoderAccount.jsx @@ -2,7 +2,7 @@ import React , {forwardRef, useEffect} from 'react'; import { Modal , Form , Input , Button } from 'antd'; import './EAccount.scss'; -function EducoderAccount({form , visible , onOk , email}){ +function EducoderAccount({form , visible , onOk , email , onCancel , match , unReload}){ const { getFieldDecorator, validateFields , setFieldsValue } = form; useEffect(()=>{ @@ -22,6 +22,10 @@ function EducoderAccount({form , visible , onOk , email}){ labelCol: { span: 5 }, wrapperCol: { span: 18 }, }; + function Cancel() { + onCancel(); + } + return( 确定 +
+ + +
} centered > diff --git a/src/forge/DevOps/Index.jsx b/src/forge/DevOps/Index.jsx index c3a29a3e..5a2a7bcd 100644 --- a/src/forge/DevOps/Index.jsx +++ b/src/forge/DevOps/Index.jsx @@ -33,6 +33,14 @@ const Params = Loadable({ export default ((props)=>{ + useEffect(()=>{ + const { projectsId , owner } = props.match.params; + const { giteaVisible , showEABox } = props; + if(giteaVisible){ + showEABox && showEABox(`/projects/${owner}/${projectsId}`); + } + },[]) + return( diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index f7820f10..112e8cf5 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -359,10 +359,14 @@ class Detail extends Component { forkFunc = () => { const { platform } = this.state; if(!platform)return; + const { current_user , giteaVisible , showEABox } = this.props; + if(giteaVisible){ + showEABox && showEABox(); + return; + } this.setState({ forkSpin:true }) - const { current_user } = this.props const { projectsId , owner } = this.props.match.params; const url = `/${owner}/${projectsId}/forks.json`; axios.post(url).then(result => { diff --git a/src/forge/Merge/NewMerge.js b/src/forge/Merge/NewMerge.js index 3382590a..c6fd7fc0 100644 --- a/src/forge/Merge/NewMerge.js +++ b/src/forge/Merge/NewMerge.js @@ -32,12 +32,16 @@ class NewMerge extends Component { } componentDidMount = () => { - const { projectsId } = this.props.match.params; + const { projectsId , owner } = this.props.match.params; this.getmergelist(projectsId); // 监听回退事件 if (window.history && window.history.pushState) { window.addEventListener('popstate', this.handleBack, false); } + const { giteaVisible , showEABox } = this.props; + if(giteaVisible){ + showEABox && showEABox(`/projects/${owner}/${projectsId}/pulls`); + } }; componentDidUpdate=(preProps)=>{ diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index b56b4d12..b38b4396 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -48,6 +48,10 @@ class Index extends Component { } } componentDidMount = () => { + const { giteaVisible , showEABox } = this.props; + if(giteaVisible){ + showEABox && showEABox('/projects'); + } // 获取拥有者列表 this.getOwner(); // 获取项目类别 @@ -272,7 +276,6 @@ class Index extends Component { const { getFieldDecorator } = this.props.form; // 项目类型:deposit-托管项目,mirror-镜像项目 const { projectsType } = this.props.match.params; - const { CategoryList, LanguageList, diff --git a/src/forge/Newfile/Index.js b/src/forge/Newfile/Index.js index 9b776955..d35a16d0 100644 --- a/src/forge/Newfile/Index.js +++ b/src/forge/Newfile/Index.js @@ -14,6 +14,14 @@ class Index extends Component { }; } + componentDidMount=()=>{ + const { projectsId , owner } = this.props.match.params; + const { giteaVisible , showEABox } = this.props; + if(giteaVisible){ + showEABox && showEABox(`/projects/${owner}/${projectsId}`); + } + } + // 命名文件 changeFileName = (e) => { this.setState({ diff --git a/src/forge/Newfile/upload_file.js b/src/forge/Newfile/upload_file.js index 2e2f49b6..8f6a087f 100644 --- a/src/forge/Newfile/upload_file.js +++ b/src/forge/Newfile/upload_file.js @@ -15,6 +15,14 @@ class UploadFile extends Component { }; } + componentDidMount=()=>{ + const { projectsId , owner } = this.props.match.params; + const { giteaVisible , showEABox } = this.props; + if(giteaVisible){ + showEABox && showEABox(`/projects/${owner}/${projectsId}`); + } + } + // 获取上传后的文件id数组 UploadFunc = (fileList) => { this.setState({ diff --git a/src/forge/Settings/Index.js b/src/forge/Settings/Index.js index 17ae8761..030acb24 100644 --- a/src/forge/Settings/Index.js +++ b/src/forge/Settings/Index.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component, useEffect } from "react"; import { Link, Route, Switch } from "react-router-dom"; import "../css/index.scss"; @@ -37,11 +37,22 @@ const ManageNew = Loadable({ loading: Loading, }); class Index extends Component { + + componentDidMount = () => { + const { projectsId , owner } = this.props.match.params; + const { giteaVisible , showEABox } = this.props; + if(giteaVisible){ + showEABox && showEABox(`/projects/${owner}/${projectsId}`); + } + } + render() { const { projectsId , owner } = this.props.match.params; const { pathname } = this.props.history.location; const flag = pathname === `/projects/${owner}/${projectsId}/setting`; + + return ( diff --git a/src/forge/Version/New.jsx b/src/forge/Version/New.jsx index f2e7ae61..6258f5a7 100644 --- a/src/forge/Version/New.jsx +++ b/src/forge/Version/New.jsx @@ -15,7 +15,7 @@ const { Option } = AutoComplete; export default Form.create()( forwardRef( ( - { form, projectDetail , match, showNotification, history }, + { form, projectDetail , match, showNotification, history , giteaVisible , showEABox }, ref ) => { const { getFieldDecorator, validateFields, setFieldsValue } = form; @@ -29,6 +29,13 @@ export default Form.create()( const repo_id = projectDetail && projectDetail.repo_id; const { projectsId, versionId , owner } = match.params; + + useEffect(()=>{ + if(giteaVisible){ + showEABox && showEABox(`/projects/${owner}/${projectsId}/releases`); + } + },[]) + useEffect(()=>{ getBranchs(projectsId,owner); },[projectsId]) diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index a3d5f42f..7ccafc04 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -25,7 +25,9 @@ export function TPMIndexHOC(WrappedComponent) { mygetHelmetapi: null, giteaVisible:false, email:undefined, - is_sync_pwd:undefined + is_sync_pwd:undefined, + EAVisible:false, + unReload:{} } } @@ -198,7 +200,7 @@ export function TPMIndexHOC(WrappedComponent) { }).then(result=>{ if(result && result.data && result.data.status === 0){ this.setState({ - giteaVisible:false, + EAVisible:false, email:undefined }) window.location.reload(); @@ -206,17 +208,41 @@ export function TPMIndexHOC(WrappedComponent) { }).catch(error=>{}) } + onCancel=()=>{ + const {unReload} = this.state; + this.setState({ + EAVisible:false + }) + unReload && this.props.history.push(unReload); + } + + showEABox=(url)=>{ + this.setState({ + EAVisible:true, + unReload:url + }) + } + render() { - let { isRender , current_user , giteaVisible , email } = this.state; + let { isRender , current_user , giteaVisible , email , EAVisible , unReload } = this.state; const common = { showLoginDialog: this.showLoginDialog, + showEABox:this.showEABox, checkIfLogin: this.checkIfLogin, - resetUserInfo:this.fetchUsers + resetUserInfo:this.fetchUsers, + giteaVisible }; return (
- + {isRender === true ? this.hideLoginDialog()} {...this.props}