选择主分支之后从分支再显示

This commit is contained in:
谢思 2024-05-15 09:56:31 +08:00
parent fcd350c3c7
commit 9506742237
3 changed files with 6 additions and 5 deletions

View File

@ -94,7 +94,7 @@ function DeleteBox({owner, projectsId, visible, setVisible, branchList, reload,
</Form.Item>
{synchronizeTips(platform)}
</div>}
{platform && first_sync_direction && branchForm(getFieldDecorator, setFieldsValue, {}, first_sync_direction, first_sync_direction === "2" ? repositoriesBranch[platform] : branchList, platform, {})}
{platform && first_sync_direction && branchForm(getFieldDecorator, setFieldsValue, getFieldsValue, {}, first_sync_direction, first_sync_direction === "2" ? repositoriesBranch[platform] : branchList, platform, {})}
</Form>
{showConfrimContent && <div className='pt15'>
{confirmInfo1()}

View File

@ -61,11 +61,12 @@ export const synchronizeTips = (platform="Github")=>{
}
// form item
export const branchForm = (getFieldDecorator, setFieldsValue, initialValues, first_sync_direction = "1", branchList, platform, formItemLayout)=>{
export const branchForm = (getFieldDecorator, setFieldsValue, getFieldsValue, initialValues, first_sync_direction = "1", branchList, platform, formItemLayout)=>{
const branchBySelectLabel = first_sync_direction === "1" ? "Gitlink" : platform;
const branchBySelectKey = first_sync_direction === "1" ? "gitlink_branch_name" : "external_branch_name";
const branchByInputLabel = first_sync_direction === "1" ? platform : "Gitlink";
const branchByInputKey = first_sync_direction === "1" ? "external_branch_name" : "gitlink_branch_name";
const branchName = getFieldsValue([branchByInputKey])[branchByInputKey]
return <Fragment>
<Form.Item label={`${branchBySelectLabel}分支`} {...formItemLayout}>
{getFieldDecorator(branchBySelectKey,{
@ -84,7 +85,7 @@ export const branchForm = (getFieldDecorator, setFieldsValue, initialValues, fir
</Select>
)}
</Form.Item>
<Form.Item label={`${branchByInputLabel}分支`} {...formItemLayout} extra="注:若仓库存在该分支,同步后将被源分支覆盖。若不存在该分支,则会新建一条同名分支并同步代码">
<Form.Item hidden={!branchName} label={`${branchByInputLabel}分支`} {...formItemLayout} extra="注:若仓库存在该分支,同步后将被源分支覆盖。若不存在该分支,则会新建一条同名分支并同步代码">
{getFieldDecorator(branchByInputKey,{
rules:[{required:true,message:`请输入${branchByInputLabel}分支名称`}],
initialValue: initialValues[branchByInputKey]
@ -347,7 +348,7 @@ function EditStore(props){
</Form.Item>
{synchronizeTips(platform)}
</div>}
{branch === "2" && first_sync_direction && branchForm(getFieldDecorator, setFieldsValue, values, first_sync_direction, first_sync_direction === "2" ? externalRepoBranchList : branchList, platform, formItemLayout)}
{branch === "2" && first_sync_direction && branchForm(getFieldDecorator, setFieldsValue, getFieldsValue, values, first_sync_direction, first_sync_direction === "2" ? externalRepoBranchList : branchList, platform, formItemLayout)}
<div className="mt30">
<Button style={{width: '100px'}} className="mr30" onClick={()=>{
saveStep3Info();

View File

@ -126,7 +126,7 @@ function StoreList(props){
{platformLogoUnText(item.type, "21px")}{text}
</span> },
{ title: 'GitLink分支', dataIndex: 'gitlink_branch_name', className:"recordColumns"},
{ title: '最后一次同步时间', dataIndex: 'sync_time', className:"primaryColor recordColumns"},
{ title: '最后一次同步时间', dataIndex: 'sync_time', className:"recordColumns"},
{ title: '最后一次同步状态', dataIndex: 'sync_status', className:"recordColumns", render: (text)=>sync_status(text)},
{ title: '操作', dataIndex: 'enable', align: 'center', className:"primaryColor recordColumns", render: (text, item)=>{
return <div>