forked from Gitlink/forgeplus
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[23],{"+hnl":function(e,t,n){},MKzF:function(e,t,n){"use strict";n.r(t);n("SchZ"),n("+hnl")},kaz8:function(e,t,n){"use strict";n.r(t);var r=n("q1tI"),a=n("17x9"),o=n("VCL8"),l=n("TSYQ"),u=n.n(l),c=n("x1Ya"),i=n("Gytx"),s=n.n(i),f=n("H84U"),p=n("6CfX");function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var a=E(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return O(this,n)}}function O(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?x(e):t}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var k=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(l,e);var t,n,a,o=g(l);function l(){var e;return m(this,l),(e=o.apply(this,arguments)).saveCheckbox=function(t){e.rcCheckbox=t},e.renderCheckbox=function(t){var n,a=t.getPrefixCls,o=x(e),l=o.props,i=o.context,s=l.prefixCls,f=l.className,p=l.children,d=l.indeterminate,m=l.style,v=l.onMouseEnter,b=l.onMouseLeave,g=k(l,["prefixCls","className","children","indeterminate","style","onMouseEnter","onMouseLeave"]),O=i.checkboxGroup,E=a("checkbox",s),j=h({},g);O&&(j.onChange=function(){g.onChange&&g.onChange.apply(g,arguments),O.toggleOption({label:p,value:l.value})},j.name=O.name,j.checked=-1!==O.value.indexOf(l.value),j.disabled=l.disabled||O.disabled);var C=u()(f,(y(n={},"".concat(E,"-wrapper"),!0),y(n,"".concat(E,"-wrapper-checked"),j.checked),y(n,"".concat(E,"-wrapper-disabled"),j.disabled),n)),w=u()(y({},"".concat(E,"-indeterminate"),d));return r.createElement("label",{className:C,style:m,onMouseEnter:v,onMouseLeave:b},r.createElement(c.a,h({},j,{prefixCls:E,className:w,ref:e.saveCheckbox})),void 0!==p&&r.createElement("span",null,p))},e}return t=l,(n=[{key:"componentDidMount",value:function(){var e=this.props.value,t=(this.context||{}).checkboxGroup,n=void 0===t?{}:t;n.registerValue&&n.registerValue(e),Object(p.a)("checked"in this.props||(this.context||{}).checkboxGroup||!("value"in this.props),"Checkbox","`value` is not validate prop, do you mean `checked`?")}},{key:"shouldComponentUpdate",value:function(e,t,n){return!s()(this.props,e)||!s()(this.state,t)||!s()(this.context.checkboxGroup,n.checkboxGroup)}},{key:"componentDidUpdate",value:function(e){var t=e.value,n=this.props.value,r=(this.context||{}).checkboxGroup,a=void 0===r?{}:r;n!==t&&a.registerValue&&a.cancelValue&&(a.cancelValue(t),a.registerValue(n))}},{key:"componentWillUnmount",value:function(){var e=this.props.value,t=(this.context||{}).checkboxGroup,n=void 0===t?{}:t;n.cancelValue&&n.cancelValue(e)}},{key:"focus",value:function(){this.rcCheckbox.focus()}},{key:"blur",value:function(){this.rcCheckbox.blur()}},{key:"render",value:function(){return r.createElement(f.a,null,this.renderCheckbox)}}])&&v(t.prototype,n),a&&v(t,a),l}(r.Component);j.__ANT_CHECKBOX=!0,j.defaultProps={indeterminate:!1},j.contextTypes={checkboxGroup:a.any},Object(o.polyfill)(j);var C=j,w=n("BGR+");function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function P(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t){return(G=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=I(e);if(t){var a=I(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return z(this,n)}}function z(e,t){return!t||"object"!==_(t)&&"function"!=typeof t?A(e):t}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var T=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},M=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&G(e,t)}(l,e);var t,n,a,o=R(l);function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=o.call(this,e)).cancelValue=function(e){t.setState((function(t){return{registeredValues:t.registeredValues.filter((function(t){return t!==e}))}}))},t.registerValue=function(e){t.setState((function(t){var n=t.registeredValues;return{registeredValues:[].concat(P(n),[e])}}))},t.toggleOption=function(e){var n=t.state.registeredValues,r=t.state.value.indexOf(e.value),a=P(t.state.value);-1===r?a.push(e.value):a.splice(r,1),"value"in t.props||t.setState({value:a});var o=t.props.onChange;if(o){var l=t.getOptions();o(a.filter((function(e){return-1!==n.indexOf(e)})).sort((function(e,t){return l.findIndex((function(t){return t.value===e}))-l.findIndex((function(e){return e.value===t}))})))}},t.renderGroup=function(e){var n=e.getPrefixCls,a=A(t),o=a.props,l=a.state,c=o.prefixCls,i=o.className,s=o.style,f=o.options,p=T(o,["prefixCls","className","style","options"]),d=n("checkbox",c),y="".concat(d,"-group"),h=Object(w.a)(p,["children","defaultValue","value","onChange","disabled"]),m=o.children;f&&f.length>0&&(m=t.getOptions().map((function(e){return r.createElement(C,{prefixCls:d,key:e.value.toString(),disabled:"disabled"in e?e.disabled:o.disabled,value:e.value,checked:-1!==l.value.indexOf(e.value),onChange:e.onChange,className:"".concat(y,"-item")},e.label)})));var v=u()(y,i);return r.createElement("div",S({className:v,style:s},h),m)},t.state={value:e.value||e.defaultValue||[],registeredValues:[]},t}return t=l,a=[{key:"getDerivedStateFromProps",value:function(e){return"value"in e?{value:e.value||[]}:null}}],(n=[{key:"getChildContext",value:function(){return{checkboxGroup:{toggleOption:this.toggleOption,value:this.state.value,disabled:this.props.disabled,name:this.props.name,registerValue:this.registerValue,cancelValue:this.cancelValue}}}},{key:"shouldComponentUpdate",value:function(e,t){return!s()(this.props,e)||!s()(this.state,t)}},{key:"getOptions",value:function(){return this.props.options.map((function(e){return"string"==typeof e?{label:e,value:e}:e}))}},{key:"render",value:function(){return r.createElement(f.a,null,this.renderGroup)}}])&&V(t.prototype,n),a&&V(t,a),l}(r.Component);M.defaultProps={options:[]},M.propTypes={defaultValue:a.array,value:a.array,options:a.array.isRequired,onChange:a.func},M.childContextTypes={checkboxGroup:a.any},Object(o.polyfill)(M);var D=M;C.Group=D;t.default=C},"my/d":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,a,o=g(n("W9HT")),l=g(n("2/Rp")),u=g(n("kaz8")),c=g(n("9yH6")),i=g(n("Vl3Y")),s=g(n("5rEg")),f=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,a=!1,o=void 0;try{for(var l,u=e[Symbol.iterator]();!(r=(l=u.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(a)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d=(r=["{\n padding:20px 30px;\n}"],a=["{\n padding:20px 30px;\n}"],Object.freeze(Object.defineProperties(r,{raw:{value:Object.freeze(a)}})));n("04bd"),n("L/Qf"),n("MKzF"),n("K4yd"),n("tULf"),n("1vPl");var y=n("q1tI"),h=g(y),m=n("spEH"),v=g(n("vOnD")),b=g(n("vDqi"));function g(e){return e&&e.__esModule?e:{default:e}}var O=s.default.TextArea,x=v.default.div(d),E={lineHeight:"25px",height:"25px",display:"block"},k=p({},E,{marginBottom:"7px"});t.default=i.default.create()((0,y.forwardRef)((function(e){var t=e.form,n=e.match,r=e.showNotification,a=e.history,d=e.GroupDetail,v=(0,y.useState)(!1),g=f(v,2),j=g[0],C=g[1],w=(0,y.useState)(!1),_=f(w,2),S=_[0],P=_[1],N=(0,y.useState)([]),V=f(N,2),G=V[0],R=V[1],z=(0,y.useState)(!1),A=f(z,2),I=A[0],T=A[1],M=(0,y.useState)(""),D=f(M,2),q=(D[0],D[1]),F=(0,y.useState)(0),L=f(F,2),U=L[0],B=L[1],H=(0,y.useState)(!1),K=f(H,2),W=(K[0],K[1]),Y=(0,y.useState)(!1),Z=f(Y,2),J=(Z[0],Z[1]),Q=(0,y.useState)(!1),X=f(Q,2),$=(X[0],X[1]),ee=(0,y.useState)(!1),te=f(ee,2),ne=(te[0],te[1]),re=(0,y.useState)(!1),ae=f(re,2),oe=(ae[0],ae[1]),le=t.getFieldDecorator,ue=t.validateFields,ce=t.setFieldsValue,ie=n.params,se=ie.OIdentifier,fe=ie.groupId;(0,y.useEffect)((function(){d&&(T("owner"===d.authorize),q(d.authorize),P(d.can_create_org_project),R(d.units),ce(p({},d,{includes_all_project:d.includes_all_project?1:0})),B(d.description?d.description.length:0))}),[d]),(0,y.useEffect)((function(){G&&G.length>0&&(W(de("code")),J(de("pulls")),$(de("issues")),ne(de("releases")),oe(de("wiki")))}),[G]);var pe=(0,y.useCallback)((function(e,t,n,r,a,o,l){return h.default.createElement("div",{className:l},h.default.createElement("span",{className:a?"required":""},e),h.default.createElement(i.default.Item,{style:{marginBottom:o+"px"||!1}},le(t,{rules:n,validateFirst:!0})(r)))}),[]);function de(e){return G.indexOf(e)>-1}return h.default.createElement(o.default,{spinning:j},h.default.createElement(m.WhiteBack,{className:"mb30",style:{border:fe?"none":"1px solid #eee"}},h.default.createElement(m.Banner,null,fe?"基本设置":"新建团队"),h.default.createElement(x,null,h.default.createElement(i.default,null,pe("团队标识:","name",[{required:!0,message:"请输入团队标识"},{validator:function(e,t,n){t||n(),t&&!t.match(/^[a-zA-Z][a-zA-Z\d]{3,14}$/)&&n("只能使用英文字母和数字,以字母开头,长度为4到15个字符"),n()}}],h.default.createElement(s.default,{placeholder:"请输入团队标识",disabled:I}),!0),pe("团队名称:","nickname",[{required:!0,message:"请输入团队名称"}],h.default.createElement(s.default,{placeholder:"请输入团队名称"}),!0),h.default.createElement("div",{className:"pr"},h.default.createElement("span",{className:"toprightNum"},U,"/200"),pe(h.default.createElement("span",{className:"mb5"},"团队描述:",h.default.createElement("span",{className:"color-grey-8"},"(描述团队的目的或作用)")),"description",[],h.default.createElement(O,{placeholder:"请输入团队描述",maxLength:200,onChange:function(e){B(e.target.value?e.target.value.length:0)}}))),pe("项目权限:","includes_all_project",[],h.default.createElement(c.default.Group,null,h.default.createElement(c.default,{value:0,style:k},"指定项目",h.default.createElement("span",{className:"color-grey-8 ml10"},"(团队成员将只能访问添加到团队的项目。 选择此项 ",h.default.createElement("span",{className:"color-grey-3"},"将不会")," 自动删除已经添加的项目)")),h.default.createElement(c.default,{value:1,style:E},"所有项目",h.default.createElement("span",{className:"color-grey-8 ml10"},"(团队可以访问所有项目。选择此选项将 ",h.default.createElement("span",{className:"color-grey-3"},"添加所有现有的")," 项目到指定团队)"))),!1,0,I?"hide":""),pe("","can_create_org_project",[],h.default.createElement(u.default,{checked:S,onChange:function(){P(!S)},style:E},"新建项目",h.default.createElement("span",{className:"color-grey-8 ml10"},"(成员可以在组织中新建项目。创建者将自动获得新建的项目的管理员权限)")),!1,20,I?"hide":""),pe("版本库权限:","authorize",[],h.default.createElement(c.default.Group,{onChange:function(e){q(e.target.value)}},h.default.createElement(c.default,{value:"read",style:k},"读取权限",h.default.createElement("span",{className:"color-grey-8 ml10"},"(成员可以查看和克隆团队项目)")),h.default.createElement(c.default,{value:"write",style:k},"写入权限",h.default.createElement("span",{className:"color-grey-8 ml10"},"(成员可以查看和推送提交到团队项目)")),h.default.createElement(c.default,{value:"admin",style:E},"管理员权限",h.default.createElement("span",{className:"color-grey-8 ml10"},"(成员可以拉取和推送到团队项目同时可以添加协作者)"))),!1,20,I?"hide":"")),h.default.createElement(l.default,{type:"primary",onClick:function(){C(!0),ue((function(e,t){if(!e)if(t.unit_types=["code","pulls","issues","releases","wiki"],fe){var n="/organizations/"+se+"/teams/"+fe+".json";b.default.put(n,p({},t,{includes_all_project:1===t.includes_all_project})).then((function(e){e&&e.data&&(r("基本设置更新成功!"),a.push("/"+se+"/teams/"+fe))})).catch((function(e){}))}else{var o="/organizations/"+se+"/teams.json";b.default.post(o,p({},t,{includes_all_project:1===t.includes_all_project})).then((function(e){e&&e.data&&(r("团队创建成功!"),a.push("/"+se+"/teams/"+e.data.id))})).catch((function(e){}))}})),C(!1)}},fe?"更新团队设置":"新建团队"),h.default.createElement(m.Cancel,{className:"ml30",onClick:function(){fe?a.push("/"+se+"/teams/"+fe):a.push("/"+se)}},h.default.createElement("span",null,"取消")))))})))}}]); |