(this["webpackJsonpuniadmin-ui"]=this["webpackJsonpuniadmin-ui"]||[]).push([[41],{1076:function(e,t,a){"use strict";a.r(t);a(15),a(42),a(62),a(56),a(29),a(40),a(539);var r=a(562),n=(a(490),a(505)),c=(a(247),a(248)),u=(a(229),a(231)),i=(a(223),a(222)),o=a(0),s=a.n(o),p=a(13),l=(a(11),a(1)),d=a(215),m=a(27),f=a.n(m),b=a(647),O=a.n(b),g=a(10),v=a.n(g),j=a(263),h=a(220),x=a(302),k=a(5),S=a(2);t.default=Object(h.a)((function(e){var t,a,o=e.currentGroupId,m=e.tags,b=S.a.groupStore.rootGroup,h=S.a.envStore.gpui.params.groupOptions,w=null!==h&&void 0!==h&&null!==(t=h.filter)&&void 0!==t&&t.fromKey?S.a.envStore.gpui.params[null===h||void 0===h||null===(a=h.filter)||void 0===a?void 0:a.fromKey]:["string","number"].includes(null===h||void 0===h?void 0:h.filter)?null===h||void 0===h?void 0:h.filter:S.a.envStore.gpui.params.groupId,y=Object(g.useState)(""),E=Object(d.a)(y,2),C=E[0],G=E[1],T=Object(g.useRef)([]),A=Object(g.useState)([]),M=Object(d.a)(A,2),N=M[0],I=M[1],_=Object(g.useState)(!1),z=Object(d.a)(_,2),B=z[0],L=z[1],R=Object(g.useState)(!1),q=Object(d.a)(R,2),J=q[0],K=q[1],D=Object(g.useRef)(1),H=Object(g.useState)(!1),X=Object(d.a)(H,2),Z=X[0],F=X[1],P=Object(g.useRef)(m),Q=Object(g.useCallback)(function(){var e=Object(l.a)(s.a.mark((function e(t){var a,r,n,c,u,i,o;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.id,!C){e.next=17;break}return K(!0),I(T.current.concat(Object(p.a)(new Array(20)).map((function(){return{loading:!0}})))),r={parent_id:a,current_page:D.current,page_size:20,tags:P.current,name:C},e.next=7,k.a.groupApi.searchGroup(r);case 7:n=e.sent,c=n.items,u=n.total,i=c.map((function(e){return e.name=e.parents.map((function(e){return e.name})).join("-"),e})),T.current=[].concat(Object(p.a)(T.current),Object(p.a)(i)),F(u>T.current.length),I(T.current),K(!1),e.next=22;break;case 17:return e.next=19,S.a.groupStore.getGroupDescendants({id:a,tags:P.current,type:"organization",includes:"ascendants"});case 19:(o=e.sent).map((function(e){return e.name=e.parent.parent.name+"-"+e.parent.name+"-"+e.name,e})),I(o);case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[C,P]),U=Object(g.useCallback)(function(){var e=Object(l.a)(s.a.mark((function e(t){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=t.toLocaleLowerCase(),C!==t){e.next=3;break}return e.abrupt("return");case 3:D.current=1,F(!!t),T.current=[],G(t);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[C]);Object(g.useEffect)((function(){T.current=[]}),[o]),Object(g.useEffect)((function(){(function(){var e=Object(l.a)(s.a.mark((function e(){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,L(!0),e.next=4,Q({id:b.id});case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(0);case 8:return e.prev=8,L(!1),e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,6,8,11]])})));return function(){return e.apply(this,arguments)}})()()}),[b.id,Q]);var V=Object(g.useCallback)(Object(l.a)(s.a.mark((function e(){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return D.current++,K(!0),e.next=4,Q({id:b.id});case 4:K(!1);case 5:case"end":return e.stop()}}),e)}))),[b.id,Q]),W=Object(g.useMemo)((function(){return B||J||!Z?null:v.a.createElement(i.a,{className:O.a.loadMore,type:"text",size:"small",onClick:V},"\u70b9\u51fb\u52a0\u8f7d\u66f4\u591a")}),[V,B,J,Z]);return v.a.createElement("div",{className:O.a.groupTree},v.a.createElement(u.a.Search,{allowClear:!0,placeholder:"\u8bf7\u8f93\u5165\u5173\u952e\u8bcd",onSearch:U}),v.a.createElement(r.b,{className:O.a.list,loading:B,loadMore:W,dataSource:N,renderItem:function(e){return v.a.createElement(r.b.Item,{className:f()({current:String(o)===String(e.id)})},v.a.createElement(n.a,{loading:e.loading,active:!0,title:!1,paragraph:{rows:1}},v.a.createElement(c.b,{className:O.a.title},v.a.createElement(x.a,{groupType:e.type}),w?v.a.createElement("div",{title:e.name},e.name):v.a.createElement(j.b,{to:"/apps-auth/group/".concat(e.id),title:e.name},e.name))))}}))}))},647:function(e,t,a){e.exports={groupTree:"groupTree--2p226",spin:"spin--3OqsL",tree:"tree--2Co7q",emptyText:"emptyText--2aA09",list:"list--22mOk",title:"title--3B_0e",loadMore:"loadMore--HA7yo",addGroupButton:"addGroupButton--1iAZX"}}}]);