Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
"use strict";(self.webpackChunkopen_metadata=self.webpackChunkopen_metadata||[]).push([[481],{1607:function(e,t,n){var a=n(8081),i=n.n(a),l=n(23645),r=n.n(l)()(i());r.push([e.id,'/*\n * Copyright 2022 Collate.\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.user-listing .ant-btn,\n.reactive-modal .ant-btn {\n border-radius: 4px;\n}\n.user-listing .user-list-table .ant-table-row .ant-table-cell:first-child,\n.reactive-modal .user-list-table .ant-table-row .ant-table-cell:first-child,\n.user-listing .user-list-table .ant-table-thead .ant-table-cell:first-child,\n.reactive-modal .user-list-table .ant-table-thead .ant-table-cell:first-child {\n padding-left: 16px;\n}\n.action-icons .ant-btn {\n height: 20px;\n width: 20px;\n padding: 0px;\n}\n',""]),t.Z=r},481:function(e,t,n){n.r(t),n.d(t,{default:function(){return te}});var a=n(70655),i=n(19650),l=n(94199),r=n(71577),s=n(71230),c=n(15746),o=n(12028),u=n(50146),d=n(96486),m=n(67294),p=n(68432),h=n(15137),f=n(8645),b=n(16687),y=n(78410),g=n(83716),E=n(89368),v=n(71112),S=n(59817),C=n(37565),Z=n(84065),w=n(73213),N=n(62761),A=n(96162),R=n(52114),x=n(43104),k=n(61105),I=n(64632),D=n(22653),T=n(34530),L=n(85087),P=n(802),U=n(39117),O=n(23313),j=n(24671),z=n(46321),M=n(45633),B=n(93379),_=n.n(B),W=n(7795),H=n.n(W),q=n(90569),G=n.n(q),J=n(3565),K=n.n(J),V=n(19216),Y=n.n(V),F=n(44589),X=n.n(F),$=n(1607),Q={};Q.styleTagTransform=X(),Q.setAttributes=K(),Q.insert=G().bind(null,"head"),Q.domAPI=H(),Q.insertStyleElement=Y(),_()($.Z,Q),$.Z&&$.Z.locals&&$.Z.locals;var ee=[A.lx.USERS,A.lx.ADMINS],te=function(){var e=(0,p.$)().t,t=(0,h.UO)().tab,n=(0,h.k6)(),B=(0,h.TH)(),_=(0,L.a)().isAdminUser,W=(0,m.useMemo)((function(){return t===A.lx.ADMINS}),[t]),H=(0,a.CR)((0,m.useState)(!0),2),q=H[0],G=H[1],J=(0,a.CR)((0,m.useState)(!1),2),K=J[0],V=J[1],Y=(0,a.CR)((0,m.useState)([]),2),F=Y[0],X=Y[1],$=(0,a.CR)((0,m.useState)(),2),Q=$[0],te=$[1],ne=(0,a.CR)((0,m.useState)(!1),2),ae=ne[0],ie=ne[1],le=(0,a.CR)((0,m.useState)(!1),2),re=le[0],se=le[1],ce=K&&!q,oe=(0,a.CR)((0,m.useState)(!1),2),ue=oe[0],de=oe[1],me=(0,a.CR)((0,m.useState)(""),2),pe=me[0],he=me[1],fe=(0,P.C)(N.Ou),be=fe.currentPage,ye=fe.handlePageChange,ge=fe.handlePageSizeChange,Ee=fe.handlePagingChange,ve=fe.pageSize,Se=fe.paging,Ce=fe.showPagination,Ze=function(t){return(0,a.mG)(void 0,void 0,void 0,(function(){var n,i,l,r;return(0,a.Jh)(this,(function(s){switch(s.label){case 0:G(!0),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,O.Rf)((0,a.pi)({isBot:!1,fields:"profile,teams,roles"},t))];case 2:return n=s.sent(),i=n.data,l=n.paging,X(i),Ee(l),[3,4];case 3:return r=s.sent(),(0,z.Eo)(r,e("server.entity-fetch-error",{entity:e("label.user")})),[3,4];case 4:return G(!1),[2]}}))}))},we=function(t,n){G(!0),function(t,n,a,i){void 0===t&&(t=w.m),void 0===n&&(n=1),void 0===a&&(a=!1),void 0===i&&(i=!1);var l="isBot:false";return a&&(l="isAdmin:true isBot:false"),new Promise((function(a){(0,U.rg)(t,n,ve,l,"","",D.W.USER,i).then((function(e){var t=e.data.hits.hits.map((function(e){return e._source}));Ee({total:e.data.hits.total.value}),a(t)})).catch((function(t){(0,z.Eo)(t,e("server.entity-fetch-error",{entity:e("label.user")})),a([])}))}))}(t,n,W,K).then((function(e){X(e),G(!1)}))},Ne=function(e){ye(N.j2),he(""),V(e),Ze({isAdmin:W,include:e?T.y.Deleted:T.y.NonDeleted,limit:ve})},Ae=function(e){he(e),ye(N.j2);var t=new URLSearchParams({user:e});n.replace({pathname:B.pathname,search:e&&t.toString()}),e?we(e,N.j2):Ze({isAdmin:W,include:K?T.y.Deleted:T.y.NonDeleted,limit:ve})};(0,m.useEffect)((function(){if(G(!0),V(!1),he(""),ye(N.j2),ge(N.Ou),ee.includes(t))if(B.search){var e=new URLSearchParams(B.search).get("user")||"";he(e),we(e,1),G(!1)}else Ze({isAdmin:t===A.lx.ADMINS,limit:ve});else G(!1)}),[t,ve]);var Re=function(){n.push(N.Z6.CREATE_USER)},xe=(0,m.useMemo)((function(){return(0,a.ev)((0,a.ev)([],(0,a.CR)((0,M.y)())),[{title:e("label.action-plural"),dataIndex:"actions",key:"actions",width:90,render:function(t,n){return m.createElement(i.Z,{align:"center",className:"w-full justify-center action-icons",size:8},ce&&m.createElement(l.Z,{placement:"bottom",title:e("label.restore")},m.createElement(r.Z,{"data-testid":"restore-user-btn-"+n.name,icon:m.createElement(b.ReactComponent,{name:e("label.restore"),width:"16px"}),type:"text",onClick:function(){te(n),se(!0)}})),m.createElement(l.Z,{placement:"left",title:!_&&R.Ov},m.createElement(r.Z,{disabled:!_,icon:m.createElement(f.ReactComponent,{"data-testid":"delete-user-btn-"+(n.displayName||n.name),name:e("label.delete"),width:"16px"}),size:"small",type:"text",onClick:function(){te(n),ie(!0)}})))}}])}),[ce]),ke=(0,m.useMemo)((function(){return m.createElement(s.Z,null,m.createElement(c.Z,{className:"w-full d-flex justify-end"},m.createElement("span",null,m.createElement(o.Z,{checked:K,"data-testid":"show-deleted",onClick:Ne}),m.createElement("span",{className:"m-l-xs"},e("label.deleted")))),m.createElement(c.Z,{className:"mt-24",span:24},m.createElement(g.Z,{heading:e("label.user"),permission:_,type:k.Wx.CREATE,onClick:Re})))}),[_,K]);return!(0,d.isEmpty)(F)||K||q||pe?m.createElement(s.Z,{className:"user-listing p-b-md","data-testid":"user-list-v1-component",gutter:[16,16]},m.createElement(c.Z,{span:12},m.createElement(Z.Z,{data:W?x.j.ADMIN:x.j.USERS})),m.createElement(c.Z,{span:12},m.createElement(i.Z,{align:"center",className:"w-full justify-end",size:16},m.createElement("span",null,m.createElement(o.Z,{checked:K,"data-testid":"show-deleted",onClick:Ne}),m.createElement("span",{className:"m-l-xs"},e("label.deleted"))),_&&m.createElement(r.Z,{"data-testid":"add-user",type:"primary",onClick:Re},e("label.add-entity",{entity:e("label.user")})))),m.createElement(c.Z,{span:8},m.createElement(S.Z,{removeMargin:!0,placeholder:e("label.search-for-type",{type:e("label.user")})+"...",searchValue:pe,typingInterval:500,onSearch:Ae})),m.createElement(c.Z,{span:24},m.createElement(C.Z,{bordered:!0,className:"user-list-table",columns:xe,"data-testid":"user-list-table",dataSource:F,loading:q,locale:{emptyText:m.createElement(E.Z,null)},pagination:!1,rowKey:"id",size:"small"})),m.createElement(c.Z,{span:24},Ce&&m.createElement(v.Z,{currentPage:be,isNumberBased:Boolean(pe),pageSize:ve,paging:Se,pagingHandler:function(e){var t,n=e.cursorType,a=e.currentPage;pe?(ye(a),we(pe,a)):n&&Se[n]&&(ye(a),Ze(((t={isAdmin:W})[n]=Se[n],t.include=K?T.y.Deleted:T.y.NonDeleted,t.limit=ve,t)))},onShowSizeChange:ge})),m.createElement(u.Z,{cancelButtonProps:{type:"link"},className:"reactive-modal",closable:!1,confirmLoading:ue,maskClosable:!1,okText:e("label.restore"),open:re,title:e("label.restore-entity",{entity:e("label.user")}),onCancel:function(){se(!1),te(void 0)},onOk:function(){return(0,a.mG)(void 0,void 0,void 0,(function(){var t,n,i,l;return(0,a.Jh)(this,(function(a){switch(a.label){case 0:if(!Q)return[2];de(!0),t={description:Q.description,displayName:Q.displayName,email:Q.email,isAdmin:Q.isAdmin,name:Q.name,profile:Q.profile,roles:null===(i=Q.roles)||void 0===i?void 0:i.map((function(e){return e.id})),teams:null===(l=Q.teams)||void 0===l?void 0:l.map((function(e){return e.id}))},a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,(0,O.Nq)(t)];case 2:if(!a.sent().data)throw e("server.entity-updating-error",{entity:e("label.user")});return Ae(""),(0,z.XA)(e("message.entity-restored-success",{entity:e("label.user")})),se(!1),[3,5];case 3:return n=a.sent(),(0,z.Eo)(n,e("server.entity-updating-error",{entity:e("label.user")})),[3,5];case 4:return de(!1),[7];case 5:return te(void 0),[2]}}))}))}},m.createElement("p",null,e("message.are-you-want-to-restore",{entity:(0,j.C_)(Q)}))),m.createElement(y.Z,{afterDeleteAction:function(){return Ae("")},allowSoftDelete:!K,entityId:(null==Q?void 0:Q.id)||"",entityName:(null==Q?void 0:Q.name)||"",entityType:I.py.USER,visible:ae,onCancel:function(){ie(!1),te(void 0)}})):ke}}}]);