新建分支保护规则

This commit is contained in:
caishi 2020-06-19 14:08:05 +08:00
parent 1384946620
commit 277341e889
4 changed files with 97 additions and 18 deletions

View File

@ -30,7 +30,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || ''
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
}
function clearAllCookie() {
cookie.remove('_educoder_session', { path: '/' });

View File

@ -0,0 +1,60 @@
import React , { forwardRef , useCallback } from 'react';
import { Form , Input , Select , Button } from 'antd';
import Title from '../Component/Title';
import { WhiteBack , Cancel } from '../Component/layout';
import styled from 'styled-components';
const {Option} = Select;
const Div = styled.div`{
padding:20px 30px;
}`
export default Form.create()(
forwardRef(( { form })=>{
const { getFieldDecorator } = form;
const helper = useCallback(
(label, name, rules, widget , className , isRequired ) => (
<div className={className}>
<span className={isRequired?"required":""}>{label}</span>
<Form.Item>
{getFieldDecorator(name, { rules, validateFirst: true })(widget)}
</Form.Item>
</div>
),
[]
);
return(
<WhiteBack>
<Title>新建保护分支规则</Title>
<Div>
{helper(
"设置分支/通配符",
"sign",
[],
<Input placeholder="请输入分支名称或通配符规则" />,'setStyleRule'
)}
<p className="color-grey-8 mb20">例如设置为master则对名称为master的分支生效设置为*-stable release*则对名称符合此通配符的所有保护分支生效</p>
{helper(
"可推送代码成员",
"psuhmember",
[],
<Select placeholder="请选择仓库成员" >
<Option value="0">请选择仓库成员</Option>
</Select>,'setSelectWidth'
)}
{helper(
"可合并Pull Request成员",
"pullmember",
[],
<Select placeholder="请选择仓库成员" >
<Option value="0">请选择仓库成员</Option>
</Select>,'setSelectWidth'
)}
<div className="df pb30">
<Button type="primary">保存</Button>
<Cancel className="ml30">取消</Cancel>
</div>
</Div>
</WhiteBack>
)
})
)

View File

@ -6,8 +6,12 @@ import "./setting.scss";
import Loadable from "react-loadable";
import Loading from "../../Loading";
import { Box , Long , Short , Gap , WhiteBack} from '../Component/layout';
import { Box, Long, Short, Gap } from '../Component/layout';
const BranchNew = Loadable({
loader: () => import("./BranchRule"),
loading: Loading,
});
const Branch = Loadable({
loader: () => import("./Branch"),
loading: Loading,
@ -45,8 +49,8 @@ class Index extends Component {
<li className={flag ? "active" : ""}>
<p>
<Link to={`/projects/${projectsId}/setting`} className="w-100">
<i className="iconfont icon-huabanfuben font-18 mr10"></i>
<i className="iconfont icon-huabanfuben font-18 mr10"></i>
</Link>
</p>
</li>
@ -57,7 +61,7 @@ class Index extends Component {
>
<p>
<Link to={`/projects/${projectsId}/setting/collaborator`} className="w-100">
<i className="iconfont icon-chengyuan font-18 mr10"></i>
<i className="iconfont icon-chengyuan font-18 mr10"></i>
协作者管理
</Link>
</p>
@ -79,7 +83,7 @@ class Index extends Component {
>
<p>
<Link to={`/projects/${projectsId}/setting/tags`} className="w-100">
<i className="iconfont icon-biaoqian3 font-18 mr10"></i>
<i className="iconfont icon-biaoqian3 font-18 mr10"></i>
项目标签
</Link>
</p>
@ -101,7 +105,7 @@ class Index extends Component {
</Short>
<Long>
<Gap>
<Switch {...this.props}>
<Switch {...this.props}>
{/* 协作者 */}
<Route
path="/projects/:projectsId/setting/collaborator"
@ -116,6 +120,12 @@ class Index extends Component {
<Tags {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:projectsId/setting/branch/new"
render={(props) => (
<BranchNew {...this.props} {...props} {...this.state} />
)}
></Route>
<Route
path="/projects/:projectsId/setting/branch"
render={(props) => (

View File

@ -174,18 +174,27 @@
border-bottom: none;
}
}
.hooksNew{
.required{
position: relative;
&::before{
content: "*";
color: red;
position: absolute;
left: -10px;
top: -2px;
}
.required{
position: relative;
&::before{
content: "*";
color: red;
position: absolute;
left: -10px;
top: -2px;
}
}
.hooksNew{
.ant-select.ant-select-enabled{
width: 100%;
}
}
.setStyleRule{
.ant-row.ant-form-item{
margin-bottom: 10px;
}
}
.setSelectWidth{
.ant-select.ant-select-enabled{
width: 100%;
}