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

56 lines
2.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 , { useState } from 'react';
import SelectBranch from '../Branch/Select';
import Title from '../Component/Title';
import styled from 'styled-components';
import { Blueline , FlexAJ , NumUl , GreenUnder , AlignCenter , WhiteBack } from '../Component/layout';
const Div = styled.div`{
padding:20px 30px;
min-height:500px;
}`
export default ((props)=>{
const [ branch , setBranch ] = useState("master");
const { projectsId , owner } = props.match.params;
const projectDetail = props.projectDetail;
function resetSetting(){
}
function settingRule(){
props.history.push(`/projects/${owner}/${projectsId}/setting/branch/new`);
}
return(
<WhiteBack>
<Title>分支设置</Title>
<Div>
<div className="pb20" style={{borderBottom:"1px solid #eee"}}>
<p className="color-grey-3 mb10">默认分支</p>
<p className="mb10">默认分支被视作为代码库中的基本分支是所有克隆代码提交合并请求的目标分支</p>
<AlignCenter>
<SelectBranch
branch={branch}
repo_id={ projectDetail && projectDetail.repo_id}
projectsId={projectsId}
changeBranch={setBranch}
owner={owner}
history={props.history}
/>
<a className="color-blue ml20" onClick={resetSetting()}>设为默认分支</a>
</AlignCenter>
</div>
<div>
<FlexAJ className="pt20">
<span className="color-grey-3">保护分支规则</span>
<Blueline onClick={()=>settingRule()}>+&nbsp;新建规则</Blueline>
</FlexAJ>
<NumUl>
<li>限制分支的推送合并强制推送相关请去<GreenUnder>仓库设置</GreenUnder></li>
<li>一个分支同时只能有一个保护分支规则生效越早创建的规则优先级越高</li>
<li>保护分支规则只影响状态是保护分支的分支常规分支只读分支都不影响</li>
</NumUl>
</div>
</Div>
</WhiteBack>
)
})