assets.3390.d48331438fe43fa3ff83.js Maven / Gradle / Ivy
"use strict";(self.webpackChunkopen_metadata=self.webpackChunkopen_metadata||[]).push([[3390],{88835:function(e,t,n){var a;n.d(t,{l:function(){return a}}),function(e){e.System="system",e.User="user"}(a||(a={}))},53390:function(e,t,n){n.r(t),n.d(t,{BotsPageV1:function(){return G},default:function(){return _}});var a=n(70655),l=n(67294),i=n(15137),r=n(94199),o=n(71577),c=n(71230),d=n(15746),s=n(19650),u=n(12028),m=n(96486),f=n(68432),p=n(76),h=n(89368),E=n(37565),g=n(62761),v=n(92693),b=n(43104),y=n(61105),Z=n(64632),w=n(88835),C=n(34530),k=n(85087),S=n(802),N=n(31928),P=n(24671),z=n(38212),D=n(46321),R=n(78410),x=n(83716),T=n(71112),B=n(24135),A=n(59817),I=n(84065),J=function(e){var t=e.showDeleted,n=e.handleAddBotClick,i=e.handleShowDeleted,J=(0,k.a)().isAdminUser,G=(0,f.$)().t,_=(0,a.CR)((0,l.useState)([]),2),j=_[0],F=_[1],K=(0,a.CR)((0,l.useState)(),2),L=K[0],O=K[1],W=(0,a.CR)((0,l.useState)(!0),2),M=W[0],U=W[1],H=(0,S.C)(),Q=H.currentPage,V=H.paging,$=H.pageSize,q=H.handlePagingChange,X=H.handlePageChange,Y=H.handlePageSizeChange,ee=H.showPagination,te=(0,a.CR)((0,l.useState)(!1),2),ne=te[0],ae=te[1],le=(0,a.CR)((0,l.useState)([]),2),ie=le[0],re=le[1],oe=function(e,t){return(0,a.mG)(void 0,void 0,void 0,(function(){var n,l,i,r;return(0,a.Jh)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),U(!0),[4,(0,N.Ww)({after:null==t?void 0:t.after,before:null==t?void 0:t.before,limit:$,include:e?C.y.Deleted:C.y.NonDeleted})];case 1:return n=a.sent(),l=n.data,i=n.paging,q(i),F(l),re(l),!e&&(0,m.isEmpty)(l)?ae(!0):ae(!1),[3,4];case 2:return r=a.sent(),(0,D.Eo)(r.message),[3,4];case 3:return U(!1),[7];case 4:return[2]}}))}))},ce=(0,l.useMemo)((function(){return[{title:G("label.name"),dataIndex:"displayName",key:"displayName",width:200,render:function(e,t){var n=(0,P.C_)(t),a=t.fullyQualifiedName||t.name||"";return l.createElement(p.Link,{"data-testid":"bot-link-"+n,to:(0,g.mn)(a)},n)}},{title:G("label.description"),dataIndex:"description",key:"description",render:function(e,t){return(null==t?void 0:t.description)?l.createElement(B.Z,{markdown:(null==t?void 0:t.description)||""}):l.createElement("span",{"data-testid":"no-description"},G("label.no-entity",{entity:G("label.description")}))}},{title:G("label.action-plural"),dataIndex:"id",key:"id",width:90,render:function(e,t){var n=t.provider===w.l.System,a=G(n?"message.ingestion-bot-cant-be-deleted":J?"label.delete":"message.admin-only-action"),i=!J||n;return l.createElement(r.Z,{placement:"topRight",title:a},l.createElement(o.Z,{"data-testid":"bot-delete-"+(0,P.C_)(t),disabled:i,icon:l.createElement(z.ZP,{alt:G("label.delete"),icon:z.PJ.DELETE}),type:"text",onClick:function(){return O(t)}}))}}]}),[]),de=(0,l.useCallback)((function(){return(0,a.mG)(void 0,void 0,void 0,(function(){return(0,a.Jh)(this,(function(e){return oe(t),[2]}))}))}),[L]);(0,l.useEffect)((function(){F([]),re([]),oe(t)}),[t,$]);var se=G("label.add-entity",{entity:G("label.bot")});return ne?l.createElement(c.Z,null,l.createElement(d.Z,{className:"w-full d-flex justify-end"},l.createElement(s.Z,{align:"end",size:5},l.createElement(u.Z,{checked:t,id:"switch-deleted",size:"small",onClick:i}),l.createElement("label",{htmlFor:"switch-deleted"},G("label.show-deleted")))),l.createElement(d.Z,{className:"w-full"},l.createElement(x.Z,{className:"mt-24",doc:v.Kb,heading:G("label.bot"),permission:J,type:y.Wx.CREATE,onClick:n}))):l.createElement(c.Z,{gutter:[16,16]},l.createElement(d.Z,{span:12},l.createElement(I.Z,{data:b.j.BOTS})),l.createElement(d.Z,{span:12},l.createElement(s.Z,{align:"center",className:"w-full justify-end",size:16},l.createElement(s.Z,{align:"end",size:5},l.createElement(u.Z,{checked:t,id:"switch-deleted",onClick:i}),l.createElement("label",{htmlFor:"switch-deleted"},G("label.show-deleted"))),l.createElement(r.Z,{placement:"topLeft",title:!J&&G("message.admin-only-action")},l.createElement(o.Z,{"data-testid":"add-bot",disabled:!J,type:"primary",onClick:n},se)))),l.createElement(d.Z,{span:8},l.createElement(A.Z,{removeMargin:!0,placeholder:G("label.search-for-type",{type:G("label.bot-plural")})+"...",typingInterval:500,onSearch:function(e){if(e){var t=(0,m.lowerCase)(e),n=j.filter((function(e){var n,a;return e.name.includes(t)||(null===(n=e.displayName)||void 0===n?void 0:n.includes(t))||(null===(a=e.description)||void 0===a?void 0:a.includes(t))}));re(n)}else re(j)}})),l.createElement(d.Z,{span:24},l.createElement(E.Z,{bordered:!0,columns:ce,dataSource:ie,loading:M,locale:{emptyText:l.createElement(h.Z,null)},pagination:!1,rowKey:"name",size:"small"})),l.createElement(d.Z,{span:24},ee&&l.createElement(T.Z,{currentPage:Q,pageSize:$,paging:V,pagingHandler:function(e){var t,n=e.currentPage,a=e.cursorType;X(n),a&&oe(!1,((t={})[a]=V[a],t.total=V.total,t))},onShowSizeChange:Y})),l.createElement(R.Z,{afterDeleteAction:de,allowSoftDelete:!t,entityId:(null==L?void 0:L.id)||"",entityName:(null==L?void 0:L.displayName)||"",entityType:Z.py.BOT,visible:Boolean(L),onCancel:function(){O(void 0)}}))},G=function(){var e=(0,i.k6)(),t=(0,a.CR)((0,l.useState)(!1),2),n=t[0],r=t[1];return l.createElement(J,{handleAddBotClick:function(){e.push((0,g.FO)(!0))},handleShowDeleted:function(e){r(e)},showDeleted:n})},_=G},31928:function(e,t,n){n.d(t,{Kp:function(){return o},Ww:function(){return r}});var a=n(70655),l=n(2598),i="/bots",r=function(e){return(0,a.mG)(void 0,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){switch(t.label){case 0:return[4,l.Z.get(i,{params:e})];case 1:return[2,t.sent().data]}}))}))},o=function(e){return(0,a.mG)(void 0,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){switch(t.label){case 0:return[4,l.Z.put(i,e)];case 1:return[2,t.sent().data]}}))}))}}}]);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy