服务-Reposyncer仓库同步-选择分支-需要支持搜索+输入

This commit is contained in:
caishi 2025-03-26 09:21:24 +08:00
parent f749a66a98
commit b297588beb
1 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,5 @@
import React, {Fragment, forwardRef, useEffect, useState} from "react";
import { Button, Divider, Form, Icon, Input, Radio, Select, Steps, Tooltip, message, Modal } from "antd";
import { Button, Divider, Form, Icon, Input, Radio, Select, Steps, Tooltip, message, Modal , AutoComplete } from "antd";
import github from '../../img/github.png';
import gitee from '../../img/gitee.png';
import arrow from '../../img/arrow.png';
@ -9,6 +9,7 @@ import CopyTool from "../../../Component/CopyTool";
import { platformLogo, platformLogoUnText } from "..";
import { reposyncerHelpIcon } from "./storeList";
const { Step } = Steps;
const { Option } = AutoComplete;
export const confirmInfo1 = (tips="若存在同名从分支,首次同步主分支源码向从分支强制推送,请谨慎操作以免代码被覆盖") =>{
return <div className="flexBetween mb30" style={{alignItems: "flex-start"}}>
@ -73,16 +74,22 @@ export const branchForm = (getFieldDecorator, setFieldsValue, getFieldsValue, in
rules:[{required:true,message:`请选择${branchBySelectLabel}仓库分支`}],
initialValue: initialValues[branchBySelectKey]
})(
<Select placeholder={`请选择${branchBySelectLabel}仓库分支`} onChange={(value)=>{
const formValue = {}
formValue[branchByInputKey] = value
setFieldsValue(formValue);
}}>
<AutoComplete
placeholder={`请选择${branchBySelectLabel}仓库分支`}
filterOption={(inputValue, option) =>
option.props.children.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
}
onChange={(value)=>{
const formValue = {}
formValue[branchByInputKey] = value;
setFieldsValue(formValue);
}}
>
{branchList && branchList.map((item, index)=>{
const {name} = item;
return <Select.Option value={name} key={index}>{name}</Select.Option>
return <Option value={name} key={index}>{name}</Option>
})}
</Select>
</AutoComplete>
)}
</Form.Item>
<Form.Item hidden={!branchName} label={`${branchByInputLabel}分支`} {...formItemLayout} extra="注:若仓库存在该分支,同步后将被源分支覆盖。若不存在该分支,则会新建一条同名分支并同步代码">