forgeplus-react/src/forge/Settings/Branch.js

42 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React , { useEffect , useState } from 'react';
import { Input , Select } from 'antd';
import { getBranch } from '../GetData/getData';
const { Option } = Select;
export default ((props)=>{
const [ branchList , setBranchList] = useState(undefined);
const { projectsId } = props.match.params;
useEffect(()=>{
getBranchs(projectsId);
},[projectsId])
async function getBranchs(id){
let result = await getBranch(id);
setBranchList(result);
}
const branchListRender = (
branchList && branchList.map((item,key)=>{
return(
<Option value={item.name}>{item.name}</Option>
)
})
)
return(
<div className="normalBox">
<div className="normalBox-title font-16">
分支列表
</div>
<p className="pl15 pt15">请选择一个默认的分支用于合并请求和提交</p>
<div className="addPanel">
<Select className="branchSelect">
{branchListRender}
</Select>
<a className="small_submitBtn ml20" onClick={this.resetSetting}>更新仓库设置</a>
</div>
</div>
)
})