build/static/js/148.82fc1b24.chunk.js

1 line
8.2 KiB
JavaScript

(this.webpackJsonp=this.webpackJsonp||[]).push([[148],{ess8:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l,n,r=(l=["{\n background-color:#fff;\n padding:20px 30px;\n border-bottom:1px solid #eee;\n font-size:18px;\n color:#333;\n display:flex;\n justify-content: space-between;\n align-items:center;\n}"],n=["{\n background-color:#fff;\n padding:20px 30px;\n border-bottom:1px solid #eee;\n font-size:18px;\n color:#333;\n display:flex;\n justify-content: space-between;\n align-items:center;\n}"],Object.freeze(Object.defineProperties(l,{raw:{value:Object.freeze(n)}}))),s=c(a("q1tI"));function c(e){return e&&e.__esModule?e:{default:e}}var d=c(a("vOnD")).default.div(r);t.default=function(e){var t=e.children;return s.default.createElement(d,null,t)}},pSeD:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l=b(a("2/Rp")),n=b(a("fyUT")),r=b(a("2fM7")),s=b(a("9yH6")),c=b(a("kaz8")),d=b(a("Vl3Y")),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(e[l]=a[l])}return e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],l=!0,n=!1,r=void 0;try{for(var s,c=e[Symbol.iterator]();!(l=(s=c.next()).done)&&(a.push(s.value),!t||a.length!==t);l=!0);}catch(e){n=!0,r=e}finally{try{!l&&c.return&&c.return()}finally{if(n)throw r}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("L/Qf"),a("QCje"),a("8QGh"),a("K4yd"),a("MKzF"),a("tULf");var i=a("q1tI"),f=b(i),m=b(a("ess8")),p=a("spEH"),h=b(a("vDqi"));function b(e){return e&&e.__esModule?e:{default:e}}t.default=d.default.create()((0,i.forwardRef)((function(e){var t=e.form,a=e.match,b=e.history,_=e.showNotification,v=(0,i.useState)(!1),g=o(v,2),E=g[0],y=g[1],w=(0,i.useState)(!1),k=o(w,2),N=k[0],j=k[1],x=(0,i.useState)(void 0),O=o(x,2),S=O[0],C=O[1],H=(0,i.useState)(void 0),R=o(H,2),q=R[0],F=R[1],z=(0,i.useState)(void 0),I=o(z,2),M=I[0],P=I[1],D=(0,i.useState)(void 0),G=o(D,2),Q=G[0],V=G[1],A=a.params,J=A.projectsId,K=A.owner,L=A.branch,T=t.getFieldDecorator,U=t.validateFields,Y=t.setFieldsValue;t.getFieldsValue;(0,i.useEffect)((function(){var e="/"+K+"/"+J+"/collaborators.json";h.default.get(e).then((function(e){V(e.data.members)})).catch((function(e){}))}),[]),(0,i.useEffect)((function(){L&&function(e,t,a){var l="/"+e+"/"+t+"/protected_branches/"+a+"/edit.json";h.default.get(l).then((function(e){if(e){y(e.data.protected),j(e.data.protected);var t=e.data.protected_branch;if(t){var a=t.enable_push_whitelist?2:t.enable_push?1:0;Y(u({},t,{enable_push:a})),P(a),C(t.enable_merge_whitelist),F(t.enable_approvals_whitelist)}}})).catch((function(e){}))}(K,J,L)}),[]);var B=(0,i.useCallback)((function(e,t,a,l,n,r,s){return f.default.createElement("div",{className:n},f.default.createElement("span",{className:r?"required":""},e),f.default.createElement(d.default.Item,null,T(t,{rules:a,validateFirst:!0,valuePropName:s?"checked":"value"})(l)))}),[]);return f.default.createElement("div",{style:{backgroundColor:"#fff"}},f.default.createElement(m.default,null,"新建'",L,"'保护分支规则"),f.default.createElement(d.default,null,f.default.createElement("div",{style:{padding:"20px 30px"}},B("","branchProtect",[],f.default.createElement(c.default,{checked:E,onChange:function(e){y(e.target.checked)}},"启用分支保护",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"组织删除并限制Git推送和合并到分支")),"setHeight"),f.default.createElement("div",{className:"pl25 shortStyle"},B("","enable_push",[],f.default.createElement(s.default.Group,{disabled:!E,onChange:function(e){P(e.target.value)}},f.default.createElement(s.default,{className:"columsRadio",value:0},"禁用推送",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"此分支不允许推送")),f.default.createElement(s.default,{className:"columsRadio",value:1},"启用推送",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"任何拥有写访问权限的人将被允许推送到此分支(但不能强行推送)")),f.default.createElement(s.default,{className:"columsRadio",value:2},"启用推送白名单",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"只有列入白名单的用户或团队才能被允许推送到此分支(但不能强行推送)"))),""),f.default.createElement("div",{className:"pl25 mb15"},B("","push_whitelist_usernames",[],f.default.createElement(r.default,{mode:"multiple",placeholder:"搜索用户",style:{width:"100%"},disabled:!E||void 0===M||2!==M},Q&&Q.map((function(e){return f.default.createElement(r.default.Option,{key:e.id,value:e.login},e.name)}))),"setStyleRule")),B("","enable_merge_whitelist",[],f.default.createElement(c.default,{disabled:!E,checked:S,onChange:function(e){C(e.target.checked)}},"启用合并白名单",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"仅允许白名单用户或团队合并合并请求到此分支")),"setHeight"),f.default.createElement("div",{className:"pl25 pt5 pb5"},B("","merge_whitelist_usernames",[],f.default.createElement(r.default,{mode:"multiple",placeholder:"搜索用户",style:{width:"100%"},disabled:!E||!S},Q&&Q.map((function(e){return f.default.createElement(r.default.Option,{key:e.id,value:e.login},e.name)}))),"setStyleRule")),B("","enable_status_check",[],f.default.createElement(c.default,{disabled:!E},"启用状态检查"),"setHeight",!1,!0),f.default.createElement("div",{style:{display:"flex",alignItems:"center",padding:"10px 0px"}},B("所需的批准数","required_approvals",[],f.default.createElement(n.default,{min:0,style:{width:"140px"}}),"inlineFlex"),f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"只允许合并有足够审核人数的拉取请求")),B("","enable_approvals_whitelist",[],f.default.createElement(c.default,{name:"enable_approvals_whitelist",disabled:!E,checked:q,onChange:function(e){F(e.target.checked)}},"批准仅限列入白名单的用户或团队",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"只有白名单用户或团队的审核才能计数 没有批准的白名单,任何有写访问权限的人的审核都将计数")),"setHeight mb5"),f.default.createElement("div",{className:"pl25 mb15"},B("","approvals_whitelist_usernames",[],f.default.createElement(r.default,{mode:"multiple",placeholder:"搜索用户",style:{width:"100%"},disabled:!E||!q},Q&&Q.map((function(e){return f.default.createElement(r.default.Option,{key:e.id,value:e.login},e.name)}))),"setStyleRule")),B("","block_on_rejected_reviews",[],f.default.createElement(c.default,{disabled:!E,name:"block_on_rejected_reviews"},"拒绝审核阻止了合并",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"如果官方审查人员要求作出改动,即使有足够的批准,合并也不允许")),"setHeight mb5",!1,!0),B("","dismiss_stale_approvals",[],f.default.createElement(c.default,{disabled:!E,name:"dismiss_stale_approvals"},"取消过时的批准",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"当新的提交更改合并请求内容被推送到分支时,旧的批准将被撤销")),"setHeight mb5",!1,!0),B("","require_signed_commits",[],f.default.createElement(c.default,{disabled:!E,name:"require_signed_commits"},"需要签名提交"),"setHeight mb5",!1,!0),B("","block_on_outdated_branch",[],f.default.createElement(c.default,{disabled:!E,name:"block_on_outdated_branch"},"如果拉取请求已经过时,阻止合并",f.default.createElement("span",{className:"color-grey-9 ml5 font-12"},"当头部分支落后基础分支时,不能合并")),"setHeight",!1,!0)),f.default.createElement("div",{className:"df pb30 pt20"},f.default.createElement(l.default,{type:"primary",onClick:function(){U((function(e,t){if(!e){var a="";a=N?"/"+K+"/"+J+"/protected_branches/"+L+".json":"/"+K+"/"+J+"/protected_branches.json",(0,h.default)({method:N?E?"patch":"delete":"post",url:a,params:u({branch_name:L,enable_push:0===t.enable_push,enable_push_whitelist:2===t.enable_push},t)}).then((function(e){e&&_("保存成功!")})).catch((function(e){}))}}))}},"保存"),f.default.createElement(p.Cancel,{className:"ml30",onClick:function(){b.push("/"+K+"/"+J+"/settings/branches")}},"取消")))))})))}}]);