github分支改为非必填

This commit is contained in:
谢思 2022-08-08 15:34:44 +08:00
parent 7c83425dba
commit d973661c29
3 changed files with 24 additions and 12 deletions

View File

@ -13,14 +13,26 @@ function EditStore(props){
function submit() {
validateFields((error,values)=>{
if(!error){
axios.post(`/${owner}/${projectsId}/synchronizes.json`,values).then(res=>{
if(res && res.data.message === "success"){
message.success('绑定成功');
window.location.href = `/${owner}/${projectsId}/server/reposyncer`;
}else{
message.error('绑定失败');
//
for(let i in values){
if(!values[i]){
delete values[i];
}
})
}
const keysArr = Object.keys(values);
if(keysArr.indexOf('github_address') === -1 && keysArr.indexOf('gitee_address') === -1){
form.setFields({github_address: {value:values.github_address,errors:[new Error('请至少输入一个地址')]}});
form.setFields({gitee_address: {value:values.gitee_address,errors:[new Error('请至少输入一个地址')]}});
}else{
axios.post(`/${owner}/${projectsId}/synchronizes.json`,values).then(res=>{
if(res && res.data.message === "success"){
message.success('绑定成功');
window.location.href = `/${owner}/${projectsId}/server/reposyncer`;
}else{
message.error('绑定失败');
}
})
}
}
})
}
@ -31,7 +43,7 @@ function EditStore(props){
<div className="storeTitle pb10 mb15"><img src={gitHub} alt="" className="storeLogo"/></div>
<Form.Item label="Github同步仓库地址" className="storeFormItem">
{getFieldDecorator("github_address",{
rules:[{required: true, message: '请输入Github同步仓库地址'}]
rules:[]
})(
<Input placeholder="请输入Github目标版本库地址" className="storeInput"/>
)}

View File

@ -49,13 +49,13 @@ function StoreList(props){
{/* 已绑定仓库信息 */}
{storeDetail && <div className="listStore mt20">
<div className="storeTitle pb5 mb5 font-18">已绑定仓库地址<Icon type="exclamation-circle" style={{color: '#466aff'}} className="ml10 font-14"/><span className="ml5 font-14" style={{fontWeight: 'normal'}}>对已绑定的仓库请添加同步分支实现分支的跨平台双向同步</span></div>
<div className="showStoreInfo dashedBor">
{storeDetail && storeDetail.github_address && <div className="showStoreInfo dashedBor">
<div className="infoBox">
<div className="font-15 sTil"><img src={gitHub1} alt="" className="mr10"/><span>Github仓库地址</span></div>
<Link className="linkSpan" to={`/${owner}/${projectsId}/server/reposyncer/record/${`github`}`}>{storeDetail && storeDetail.github_address}</Link>
</div>
<Button style={{width: '94px', height:'36px', padding: 0}} className="blue_border_but" onClick={()=>{setVisibleNew(true);setCreateJobBy('Github')}}>新建同步分支</Button>
</div>
</div>}
{storeDetail && storeDetail.gitee_address && <div className="showStoreInfo">
<div className="infoBox">
<div className="font-15 sTil"><img src={gitee1} alt="" className="mr10"/><span>Gitee仓库地址</span></div>
@ -70,7 +70,7 @@ function StoreList(props){
title="取消绑定"
visible={visible}
onCancel={()=>{setVisible(false)}}
footer={<div><Button style={{width: '90px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button className="okBut" style={{width: '90px', height:'36px'}} onClick={updateStore}>确认取消</Button></div>}
footer={<div><Button style={{width: '90px', height:'36px'}} onClick={()=>{setVisible(false)}}>取消</Button><Button className="okBut" style={{width: '90px', height:'36px'}} onClick={updateStore}>确认清空</Button></div>}
width={535}
className="cancelBound"
>

View File

@ -225,7 +225,7 @@
padding: 10px 25px;
background-color: #f8f8f8;
.ant-modal-title{
font-size: 14px;
font-size: 16px;
text-align: left;
font-weight: normal !important;
}