新增分支同步弹框增加二次确认提示

This commit is contained in:
谢思 2024-05-10 11:32:38 +08:00
parent c90d065bd5
commit e3d8f926ac
2 changed files with 26 additions and 5 deletions

View File

@ -1,16 +1,30 @@
import React, {useEffect, useState} from 'react';
import { Button, Modal, Input, Select, message, Form } from 'antd';
import axios from 'axios';
import { synchronizeTips } from './editStore';
import { confirmInfo1, confirmInfo2, synchronizeTips } from './editStore';
import gitHub from '../../img/github.png';
import gitee from '../../img/gitee.png';
import '../index.scss';
function DeleteBox({owner, projectsId, visible, setVisible, branchList, reload, form, sync_repositories_unique=[]}) {
const { getFieldDecorator, validateFields , resetFields } = form;
const { getFieldDecorator, validateFields , resetFields, getFieldsValue } = form;
//
const [platform, setPlatform] = useState();
//
const repoTypes = sync_repositories_unique.map(item=>{return item.type})
const {type, external_branch_name, gitlink_branch_name, first_sync_direction} = getFieldsValue();
const showConfrimContent = external_branch_name && gitlink_branch_name && first_sync_direction;
const externalRepoBySelected = type && sync_repositories_unique.filter(item=>item.type.includes(type))[0]
const externalRepoInfo = {
address: externalRepoBySelected && externalRepoBySelected.external_repo_address,
branchName: external_branch_name,
type
}
const gitlinkRepoInfo = {
address: `${window.location.origin}/${owner}/${projectsId}.git`,
branchName: gitlink_branch_name,
type: "gitlink"
}
useEffect(()=>{
if(repoTypes.length === 1){
@ -49,8 +63,8 @@ function DeleteBox({owner, projectsId, visible, setVisible, branchList, reload,
visible={visible}
onCancel={()=>{setVisible(false)}}
footer={<div><Button style={{width: '104px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button type="primary" style={{width: '104px', height:'36px', marginLeft: '40px'}} onClick={createNew}>确认</Button></div>}
width={550}
className="cancelBound"
width={650}
className="reposyncerModal"
>
<Form {...formItemLayout}>
{repoTypes.length > 1 && <Form.Item label="同步仓库平台" className="storeFormItem">
@ -98,6 +112,13 @@ function DeleteBox({owner, projectsId, visible, setVisible, branchList, reload,
{synchronizeTips(platform)}
</div>
</Form>
{showConfrimContent && <div className='pt15'>
{confirmInfo1()}
{confirmInfo2({
mainBranch: first_sync_direction === "1" ? gitlinkRepoInfo : externalRepoInfo,
branch: first_sync_direction === "1" ? externalRepoInfo : gitlinkRepoInfo
})}
</div>}
</Modal>
)
}

View File

@ -233,7 +233,7 @@
}
.reposyncerModal{
.ant-modal-header{
// padding: 5px 24px;
padding: 5px 24px;
background: rgba(70,106,255,0.09);
.ant-modal-title{
font-weight: normal !important;