All Downloads are FREE. Search and download functionalities are using the official Maven repository.

assets.481.7f35ae3f6bfad180d021.js Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
"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 ee}});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(22653),D=n(34530),T=n(85087),L=n(802),P=n(39117),O=n(23313),U=n(24671),j=n(46321),z=n(45633),M=n(93379),B=n.n(M),_=n(7795),W=n.n(_),H=n(90569),q=n.n(H),G=n(3565),J=n.n(G),K=n(19216),V=n.n(K),Y=n(44589),F=n.n(Y),X=n(1607),$={};$.styleTagTransform=F(),$.setAttributes=J(),$.insert=q().bind(null,"head"),$.domAPI=W(),$.insertStyleElement=V(),B()(X.Z,$),X.Z&&X.Z.locals&&X.Z.locals;var Q=[A.lx.USERS,A.lx.ADMINS],ee=function(){var e=(0,p.$)().t,t=(0,h.UO)().tab,n=(0,h.k6)(),M=(0,h.TH)(),B=(0,T.a)().isAdminUser,_=(0,m.useMemo)((function(){return t===A.lx.ADMINS}),[t]),W=(0,a.CR)((0,m.useState)(!0),2),H=W[0],q=W[1],G=(0,a.CR)((0,m.useState)(!1),2),J=G[0],K=G[1],V=(0,a.CR)((0,m.useState)([]),2),Y=V[0],F=V[1],X=(0,a.CR)((0,m.useState)(),2),$=X[0],ee=X[1],te=(0,a.CR)((0,m.useState)(!1),2),ne=te[0],ae=te[1],ie=(0,a.CR)((0,m.useState)(!1),2),le=ie[0],re=ie[1],se=J&&!H,ce=(0,a.CR)((0,m.useState)(!1),2),oe=ce[0],ue=ce[1],de=(0,a.CR)((0,m.useState)(""),2),me=de[0],pe=de[1],he=(0,L.C)(N.Ou),fe=he.currentPage,be=he.handlePageChange,ye=he.handlePageSizeChange,ge=he.handlePagingChange,Ee=he.pageSize,ve=he.paging,Se=he.showPagination,Ce=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:q(!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,F(i),ge(l),[3,4];case 3:return r=s.sent(),(0,j.Eo)(r,e("server.entity-fetch-error",{entity:e("label.user")})),[3,4];case 4:return q(!1),[2]}}))}))},Ze=function(t,n){q(!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,P.rg)(t,n,Ee,l,"","",I.W.USER,i).then((function(e){var t=e.data.hits.hits.map((function(e){return e._source}));ge({total:e.data.hits.total.value}),a(t)})).catch((function(t){(0,j.Eo)(t,e("server.entity-fetch-error",{entity:e("label.user")})),a([])}))}))}(t,n,_,J).then((function(e){F(e),q(!1)}))},we=function(e){be(N.j2),pe(""),K(e),Ce({isAdmin:_,include:e?D.y.Deleted:D.y.NonDeleted,limit:Ee})},Ne=function(e){pe(e),be(N.j2);var t=new URLSearchParams({user:e});n.replace({pathname:M.pathname,search:e&&t.toString()}),e?Ze(e,N.j2):Ce({isAdmin:_,include:J?D.y.Deleted:D.y.NonDeleted,limit:Ee})};(0,m.useEffect)((function(){if(q(!0),K(!1),pe(""),be(N.j2),ye(N.Ou),Q.includes(t))if(M.search){var e=new URLSearchParams(M.search).get("user")||"";pe(e),Ze(e,1),q(!1)}else Ce({isAdmin:t===A.lx.ADMINS,limit:Ee});else q(!1)}),[t,Ee]);var Ae=function(){n.push(N.Z6.CREATE_USER)},Re=(0,m.useMemo)((function(){return(0,a.ev)((0,a.ev)([],(0,a.CR)((0,z.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},se&&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(){ee(n),re(!0)}})),m.createElement(l.Z,{placement:"left",title:!B&&R.Ov},m.createElement(r.Z,{disabled:!B,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(){ee(n),ae(!0)}})))}}])}),[se]),xe=(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:J,"data-testid":"show-deleted",onClick:we}),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:B,type:k.Wx.CREATE,onClick:Ae})))}),[B,J]);return!(0,d.isEmpty)(Y)||J||H||me?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:_?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:J,"data-testid":"show-deleted",onClick:we}),m.createElement("span",{className:"m-l-xs"},e("label.deleted"))),B&&m.createElement(r.Z,{"data-testid":"add-user",type:"primary",onClick:Ae},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:me,typingInterval:500,onSearch:Ne})),m.createElement(c.Z,{span:24},m.createElement(C.Z,{bordered:!0,className:"user-list-table",columns:Re,"data-testid":"user-list-table",dataSource:Y,loading:H,locale:{emptyText:m.createElement(E.Z,null)},pagination:!1,rowKey:"id",size:"small"})),m.createElement(c.Z,{span:24},Se&&m.createElement(v.Z,{currentPage:fe,isNumberBased:Boolean(me),pageSize:Ee,paging:ve,pagingHandler:function(e){var t,n=e.cursorType,a=e.currentPage;me?(be(a),Ze(me,a)):n&&ve[n]&&(be(a),Ce(((t={isAdmin:_})[n]=ve[n],t.include=J?D.y.Deleted:D.y.NonDeleted,t.limit=Ee,t)))},onShowSizeChange:ye})),m.createElement(u.Z,{cancelButtonProps:{type:"link"},className:"reactive-modal",closable:!1,confirmLoading:oe,maskClosable:!1,okText:e("label.restore"),open:le,title:e("label.restore-entity",{entity:e("label.user")}),onCancel:function(){re(!1),ee(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(!$)return[2];ue(!0),t={description:$.description,displayName:$.displayName,email:$.email,isAdmin:$.isAdmin,name:$.name,profile:$.profile,roles:null===(i=$.roles)||void 0===i?void 0:i.map((function(e){return e.id})),teams:null===(l=$.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 Ne(""),(0,j.XA)(e("message.entity-restored-success",{entity:e("label.user")})),re(!1),[3,5];case 3:return n=a.sent(),(0,j.Eo)(n,e("server.entity-updating-error",{entity:e("label.user")})),[3,5];case 4:return ue(!1),[7];case 5:return ee(void 0),[2]}}))}))}},m.createElement("p",null,e("message.are-you-want-to-restore",{entity:(0,U.C_)($)}))),m.createElement(y.Z,{afterDeleteAction:function(){return Ne("")},allowSoftDelete:!J,entityId:(null==$?void 0:$.id)||"",entityName:(null==$?void 0:$.name)||"",entityType:"user",visible:ne,onCancel:function(){ae(!1),ee(void 0)}})):xe}}}]);




© 2015 - 2025 Weber Informatics LLC | Privacy Policy