build/static/js/199.b05e415a.chunk.js

1 line
14 KiB
JavaScript
Raw Permalink 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.

(this.webpackJsonp=this.webpackJsonp||[]).push([[199],{"Ie+W":function(e,t,a){"use strict";a("+L6B");var n=a("2/Rp"),c=a("zLi2"),r=a.n(c),o=(a("O3gP"),a("lrIw")),l=a("FLGM"),i=a.n(l),s=a("cDcd"),m=a.n(s),u=a("vDqi"),d=a.n(u),f=a("sYIF"),p=o.a.Option;t.a=function(e){var t=e.getID,a=e.login,c=e.showNotification,l=Object(s.useState)(void 0),u=r()(l,2),v=u[0],E=u[1],h=Object(s.useState)(void 0),g=r()(h,2),j=g[0],b=g[1],w=Object(s.useState)(void 0),N=r()(w,2),y=N[0],O=N[1];return Object(s.useEffect)((function(){d.a.get("/users/list.json",{params:{search:y}}).then((function(e){var t,a;e&&(a=(t=e.data.users)&&i()(t).call(t,(function(e,t){return m.a.createElement(p,{key:t,value:"".concat(e.user_id),login:"".concat(e.login),name:e.username},m.a.createElement("img",{className:"user_img radius",width:"28",height:"28",src:Object(f.i)("/".concat(e&&e.image_url)),alt:""}),m.a.createElement("span",{className:"ml10",style:{verticalAlign:"middle"}},e.username,m.a.createElement("span",{className:"color-grey ml10"},"(",e.login,")")))})),b(a))})).catch((function(e){}))}),[y]),m.a.createElement("div",{className:"addPanel"},m.a.createElement(o.a,{dataSource:j,value:y,style:{width:250},onChange:function(e){O(e)},onSelect:function(e,t){E(a?e:t.props.login),O(t.props.name)},placeholder:"搜索需要添加的用户...",allowClear:!0}),m.a.createElement(n.a,{type:"primary",ghost:!0,onClick:function(){j&&j.length>0&&y?(t&&t(v),O(void 0),E(void 0)):c("请选择存在的用户!")},className:"ml15"},m.a.createElement("i",{className:"iconfont icon-tianjiafangda mr3"}),"添加成员"))}},"XyF/":function(e,t,a){"use strict";a.r(t);var n=a("zLi2"),c=a.n(n),r=a("ZbhI"),o=a.n(r),l=a("o+MX"),i=a.n(l),s=a("cDcd"),m=a.n(s),u=a("spEH"),d=a("Ie+W"),f=(a("+L6B"),a("2/Rp")),p=(a("Pwec"),a("CtXQ")),v=(a("O3gP"),a("lrIw")),E=a("FLGM"),h=a.n(E),g=a("vDqi"),j=a.n(g),b=v.a.Option,w=function(e){var t=e.organizeId,a=e.getGroupID,n=Object(s.useState)(void 0),r=c()(n,2),o=r[0],l=r[1],i=Object(s.useState)(void 0),u=c()(i,2),d=u[0],E=u[1],g=Object(s.useState)(""),w=c()(g,2),N=w[0],y=w[1];return Object(s.useEffect)((function(){var e;e="/organizations/".concat(t,"/teams/search.json"),j.a.get(e,{params:{search:N}}).then((function(e){var t,a;e&&(a=(t=e.data.teams)&&h()(t).call(t,(function(e,t){return m.a.createElement(b,{key:t,value:"".concat(e.id),name:e.name},e.name)})),E(a))})).catch((function(e){}))}),[N]),m.a.createElement("div",{className:"addPanel"},m.a.createElement(v.a,{dataSource:d,value:N,style:{width:300},onChange:function(e){y(e||"")},onSelect:function(e,t){l(e),y(t.props.name)},placeholder:"搜索需要添加的团队...",allowClear:!0}),m.a.createElement(f.a,{type:"primary",ghost:!0,onClick:function(){a&&a(o),l(void 0)},className:"ml15"},m.a.createElement(p.a,{type:"plus",size:"16"}),"添加团队"))},N=(a("DjyN"),a("NUBc")),y=(a("T2oS"),a("W9HT")),O=(a("g9YV"),a("wCAj")),S=(a("P2fV"),a("NJEC")),I=(a("qVdP"),a("jsC+")),x=(a("5Dmo"),a("3S7+")),k=(a("lUTK"),a("BvKs")),C=(a("5NDa"),a("5rEg")),_=a("5PDf"),D=a.n(_),z=a("2CTR"),B=a("2iEm"),F=a("sYIF"),L=C.a.Search,T=[{id:"Manager",name:"管理员"},{id:"Developer",name:"开发者"},{id:"Reporter",name:"报告者"}];var P=Object(s.forwardRef)((function(e){var t=e.projectsId,a=e.owner,n=e.project_id,r=e.author,o=e.showNotification,l=e.newId,u=e.flag,d=Object(s.useState)(void 0),f=c()(d,2),v=f[0],E=f[1],g=Object(s.useState)(void 0),b=c()(g,2),w=b[0],C=b[1],_=Object(s.useState)(1),P=c()(_,2),R=P[0],M=P[1],A=Object(s.useState)(!0),G=c()(A,2),q=G[0],J=G[1],U=Object(s.useState)(void 0),V=c()(U,2),W=V[0],H=V[1],K=Object(s.useState)(void 0),X=c()(K,2),Y=X[0],Q=X[1],Z=Object(s.useState)(0),$=c()(Z,2),ee=$[0],te=$[1];function ae(){var e;J(!0);var n=i()(e="/".concat(a,"/")).call(e,t,"/collaborators.json");j.a.get(n,{params:{page:R,search:w,role:W,limit:15}}).then((function(e){e&&(R>1&&Y&&1===Y.length?M(R-1):(Q(e.data.members||[]),te(e.data.total_count)),J(!1))})).catch((function(e){J(!1)}))}function ne(e,t){H(e),E(t)}Object(s.useEffect)((function(){l&&function(e){if(e){var n,c=i()(n="/".concat(a,"/")).call(n,t,"/collaborators.json");j.a.post(c,{user_id:e}).then((function(e){e&&ae()})).catch((function(e){}))}}(l)}),[u]),Object(s.useEffect)((function(){n&&t&&a&&ae()}),[n,w,R,W]);var ce=m.a.createElement("div",null,m.a.createElement("span",{className:"mr3"},"角色"),m.a.createElement(x.a,{placement:"bottom",title:m.a.createElement("div",null,m.a.createElement("div",{className:"mb3"},"管理员:拥有仓库设置功能、代码库读、写操作"),m.a.createElement("div",{className:"mb3"},"开发人员:只拥有代码库读、写操作"),m.a.createElement("div",{className:"mb3"},"报告者:只拥有代码库读操作"))},m.a.createElement(p.a,{type:"question-circle"}))),re=function(e){return"Manager"===e?"text-green":"Developer"===e?"text-primary":"text-yellow"},oe=function(e){return m.a.createElement(k.a,null,h()(T).call(T,(function(n,c){return m.a.createElement(k.a.Item,{key:n.id,value:n.id,onClick:function(n){return function(e,n){var c,r=i()(c="/".concat(a,"/")).call(c,t,"/collaborators/change_role.json");j.a.put(r,{user_id:n,role:e.key}).then((function(e){e&&(o("权限修改成功!"),ae())})).catch((function(e){}))}(n,e)}},n.name)})))},le=[{title:"头像",dataIndex:"image_url",render:function(e,t){return m.a.createElement("span",{className:"f-wrap-alignCenter"},m.a.createElement(B.a,{to:"/".concat(t.login),className:"show-user-link"},m.a.createElement("img",{src:Object(F.i)("/".concat(e)),alt:"",width:"32px",height:"32px",className:"mr3 radius"})))}},{title:"用户名",dataIndex:"name",render:function(e,t){return m.a.createElement(B.a,{to:"/".concat(t.login),className:"show-user-link"},e)}},{title:"邮箱",dataIndex:"email",render:function(e){return m.a.createElement("span",null,e)}},{title:ce,dataIndex:"role_name",render:function(e,t){return function(e){var t=D()(T).call(T,(function(t){return t.id===e.role}));return m.a.createElement("span",null,r&&r.login===e.login?m.a.createElement("label",{className:re(e.role)},t&&t[0].name):m.a.createElement(I.a,{overlay:oe("".concat(e.id)),placement:"bottomCenter"},m.a.createElement("span",{className:re(e.role)},t&&t[0].name,m.a.createElement(p.a,{type:"caret-down",className:"ml2",size:"13"}))))}(t)}},{title:"操作",dataIndex:"action",render:function(e,n){return m.a.createElement("span",{style:{justifyContent:"center"}},r&&r.login!==n.login&&m.a.createElement(S.a,{title:"确认将此成员从项目中移除?",okText:"是",cancelText:"否",onConfirm:function(){return e=n.id,r=i()(c="/".concat(a,"/")).call(c,t,"/collaborators/remove.json"),void j.a.delete(r,{data:{user_id:e}}).then((function(e){e&&(o("成员删除成功!"),ae())})).catch((function(e){}));var e,c,r}},m.a.createElement("a",{className:"text-delete"},"删除")))}}];return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{className:"baseForm",style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},m.a.createElement(I.a,{overlay:function(e){return m.a.createElement(k.a,null,m.a.createElement(k.a.Item,{key:0,value:void 0,onClick:function(e){return ne(void 0,"角色筛选")}},"全部"),h()(T).call(T,(function(e,t){return m.a.createElement(k.a.Item,{key:e.id,value:e.id,onClick:function(t){return ne(e.id,e.name)}},e.name)})))},placement:"bottomCenter"},m.a.createElement("a",{className:"text-primary"},v||"角色筛选",m.a.createElement(p.a,{type:"caret-down",size:"16"}))),m.a.createElement(L,{placeholder:"搜索项目成员...",enterButton:"搜索",onSearch:C,style:{width:300}})),m.a.createElement(y.a,{spinning:q},m.a.createElement("div",{className:"collaboratorList baseForm"},Y&&Y.length>0&&m.a.createElement(O.a,{pagination:!1,columns:le,dataSource:Y,rowKey:function(e){return e.id}}),Y&&0===Y.length&&m.a.createElement(z.a,{_html:"暂时还没有相关数据!"}))),ee>15?m.a.createElement("div",{className:"edu-txt-center mt20 pb20"},m.a.createElement(N.a,{simple:!0,pageSize:15,current:R,total:ee,onChange:function(e){return M(e)}})):"")})),R={owner:"所有者",admin:"管理者",write:"开发者",read:"报告者"},M=function(e){var t=e.newGroupId,a=e.owner,n=e.projectsId,r=e.setAddOperation,o=Object(s.useState)(void 0),l=c()(o,2),u=l[0],d=l[1],p=Object(s.useState)(!0),v=c()(p,2),E=v[0],h=v[1],g=Object(s.useState)(1),b=c()(g,2),w=b[0],y=b[1],I=Object(s.useState)(0),x=c()(I,2),k=x[0],C=x[1];function _(){var e,t=i()(e="/".concat(a,"/")).call(e,n,"/teams.json");j.a.get(t,{params:{page:w,limit:15}}).then((function(e){e&&e.data&&(d(e.data.teams),C(e.data.total_count),h(!1),r(e.data.can_add))})).catch((function(e){}))}Object(s.useEffect)((function(){_()}),[]),Object(s.useEffect)((function(){var e,c,r;t&&(e=t,r=i()(c="/".concat(a,"/")).call(c,n,"/teams.json"),j.a.post(r,{team_id:e}).then((function(e){e&&e.data&&_()})).catch((function(e){})))}),[t]);var D=[{title:"团队名",dataIndex:"name",render:function(e,t){var n;return t.is_admin||t.is_member?m.a.createElement(B.a,{to:i()(n="/".concat(a,"/teams/")).call(n,t.id)},e):m.a.createElement("span",null,e)}},{title:"权限",dataIndex:"authorize",width:"20%",render:function(e,t){return R[e]}},{title:"操作",dataIndex:"operation",width:"25%",render:function(e,t){return t.can_remove&&m.a.createElement(S.a,{title:"确定要删除‘".concat(t.name,"’团队?"),okText:"是",cancelText:"否",onConfirm:function(){var e,c,r,o;e=t.id,o=i()(c=i()(r="/".concat(a,"/")).call(r,n,"/teams/")).call(c,e,".json"),j.a.delete(o).then((function(e){e&&e.data&&_()})).catch((function(e){}))}},m.a.createElement(f.a,{type:"danger"},"删除"))}}];return m.a.createElement("div",{className:"padding20-30",style:{minHeight:"400px"}},m.a.createElement(O.a,{dataSource:u,columns:D,pagination:!1,loading:E}),k>15?m.a.createElement("div",{className:"pb20 mt20 edu-txt-center"},m.a.createElement(N.a,{simple:!0,current:w,total:k,pageSize:15,onChange:function(e){y(e)}})):"")},A=(a("sRBo"),a("kaz8")),G=(a("OaEy"),a("2fM7")),q=a("WxoT"),J=a.n(q),U=a("J66h"),V=(C.a.Search,[{value:"manager",name:"管理员 - 拥有仓库设置功能、代码库读、写操作权限"},{value:"developer",name:"开发人员 - 拥有代码库读、写操作权限"},{value:"reporter",name:"报告者 - 拥有代码库读操作权限"}]);var W=Object(s.forwardRef)((function(e){var t=e.projectsId,a=e.owner,n=(e.project_id,e.author,e.showNotification,e.newId,e.flag,Object(s.useState)("developer")),r=c()(n,2),o=r[0],l=r[1],u=Object(s.useState)(!0),d=c()(u,2),p=d[0],v=d[1],E=Object(s.useState)(""),g=c()(E,2),b=g[0],w=g[1],N=Object(s.useState)(!1),y=c()(N,2),O=y[0],S=y[1];return Object(s.useEffect)((function(){var e,n=i()(e="/".concat(a,"/")).call(e,t,"/project_invite_links/current_link.json");j.a.get(n,{params:{role:o,is_apply:p}}).then((function(e){if(e&&e.data){var n,c,r,o={projectName:e.data.project.name,projectId:e.data.project.identifier,ownerLogin:e.data.project.owner.login,ownerName:e.data.project.owner.name,sign:e.data.sign},l=J()(o),s=U.Base64.encode(l);w(i()(n=i()(c=i()(r="".concat(window.location.origin,"/")).call(r,a,"/")).call(c,t,"/invite?invite=")).call(n,s)),S(!1)}})).catch((function(e){}))}),[o,p]),m.a.createElement("div",{className:"addMemByLinkBox"},m.a.createElement("div",{className:"font-16 mt20 mb10"},"请选择邀请用户权限"),m.a.createElement(G.a,{className:"selectBox",defaultValue:"developer",onChange:function(e){l(e)}},h()(V).call(V,(function(e){return m.a.createElement(G.a.Option,{value:e.value,key:e.value},e.name)}))),m.a.createElement(A.a,{checked:p,className:"font-15 checkBox",onChange:function(e){v(e.target.checked)}},"需要管理员审核"),m.a.createElement("div",{className:"font-16 mt25 mb10"},"邀请链接"),m.a.createElement(C.a,{id:"inviteUrl",value:b,readOnly:!0,addonAfter:m.a.createElement(f.a,{type:"primary",className:"".concat(O?"success":""),onClick:function(){var e=document.querySelector("#inviteUrl");e&&(e.select(),document.execCommand("copy")&&(document.execCommand("copy"),S(!0),document.getSelection().removeAllRanges()))}},O?"复制成功":"复制链接"),className:"linkBox"}),m.a.createElement("div",{className:"tipBox mt25"},m.a.createElement("div",{className:"ml5"},"1、管理员可通过分享邀请链接的方式邀请其他成员加入项目",m.a.createElement("br",null),"2、若已勾选管理员审核选项用户接收邀请后管理员可在个人主页中“待办事项”窗口审核成员审核信息若不需要管理员审核成员接收邀请后将直接加入项目",m.a.createElement("br",null),"3、当前邀请链接有效期为三天")))}));t.default=function(e){var t=Object(s.useState)("1"),a=c()(t,2),n=a[0],r=a[1],l=Object(s.useState)(void 0),f=c()(l,2),p=f[0],v=f[1],E=Object(s.useState)(!1),h=c()(E,2),g=h[0],j=h[1],b=Object(s.useState)(!0),N=c()(b,2),y=N[0],O=N[1],S=Object(s.useState)(void 0),I=c()(S,2),x=I[0],k=I[1],C=e.match.params,_=C.projectsId,D=C.owner,z=e.projectDetail,B=e&&e.projectDetail&&e.projectDetail.author;return Object(s.useEffect)((function(){var e;if(z&&-1===o()(e=document.title).call(e,"成员管理-")){var t,a=z.author,n=z.name;document.title=i()(t="成员管理-".concat(a.name,"/")).call(t,n)}}),[z]),m.a.createElement(u.r,null,m.a.createElement("div",{className:"flex-a-center baseForm bbr"},m.a.createElement("span",null,m.a.createElement("span",{style:{cursor:"pointer"},className:"1"===n?"font-15 text-black color-blue":"font-15 text-black",onClick:function(){r("1"),v(void 0)}},"成员管理"),m.a.createElement("span",{style:{cursor:"pointer"},className:"3"===n?"font-15 text-black color-blue ml30":"font-15 text-black ml30",onClick:function(){r("3")}},"邀请成员"),B&&"Organization"===B.type&&m.a.createElement("span",{style:{cursor:"pointer"},className:"2"===n?"font-15 text-black ml30 color-blue":"font-15 text-black ml30",onClick:function(){r("2"),v(void 0),k(void 0)}},"团队管理")),"1"===n&&m.a.createElement(d.a,{getID:function(e){v(e),j(!g)},login:!0,showNotification:e.showNotification}),"2"===n&&y&&m.a.createElement(w,{getGroupID:function(e){k(e)},organizeId:D})),m.a.createElement("div",null,"1"===n?m.a.createElement(P,{newId:p,flag:g,projectsId:_,owner:D,project_id:e.project_id,author:e.projectDetail&&e.projectDetail.author,showNotification:e.showNotification}):"2"===n?m.a.createElement(M,{setAddOperation:O,owner:D,projectsId:_,newGroupId:x}):m.a.createElement(W,{newId:p,flag:g,projectsId:_,owner:D,project_id:e.project_id,author:e.projectDetail&&e.projectDetail.author,showNotification:e.showNotification})))}}}]);