(this.webpackJsonpui_v2=this.webpackJsonpui_v2||[]).push([[16],{1333:function(e,n,r){},1370:function(e,n,r){"use strict";r.r(n);var t=r(6),l=r(0),a=r.n(l),u=r(99),i=r(230),c=r(138),o=r(9),s=r(244),d=r(223),v=r(242),f=r(617),g=r(222),L=r(1);function b(e){var n,r,t=e.index,l=e.style,a=e.data;return Object(L.jsx)("div",{style:l,children:Object(L.jsx)("pre",{className:"LogRow__line",children:null===(n=a.logsList)||void 0===n||null===(r=n[t-1])||void 0===r?void 0:r.value})})}b.displayName="RunLogsTab";var h,m=a.a.memo(b);!function(e){e.DEFAULT="default",e.LIVE_UPDATE="live-update",e.LOAD_MORE="load-more"}(h||(h={}));r(1333);function j(e){var n,r,l,b,j,O=e.isRunLogsLoading,E=e.runHash,p=e.runLogs,I=e.inProgress,R=e.updatedLogsCount,T=a.a.useRef(null),D=a.a.useRef(null),x=a.a.useRef({}),_=a.a.useRef({}),y=a.a.useState(h.DEFAULT),A=Object(t.a)(y,2),N=A[0],U=A[1],S=a.a.useRef(null),w=a.a.useState(0),H=Object(t.a)(w,2),P=H[0],F=H[1],V=a.a.useState(0),k=Object(t.a)(V,2),C=k[0],M=k[1],z=a.a.useRef(null),B=a.a.useRef(null),J=a.a.useState(null),W=Object(t.a)(J,2),q=W[0],G=W[1],K=a.a.useRef(null);function Q(){if(I){var e=setInterval((function(){var e,n;U(h.LIVE_UPDATE),_.current=f.a.getRunLogs({runHash:E,record_range:z.current?"".concat(+(null===(e=S.current)||void 0===e?void 0:e[1])>5?+(null===(n=S.current)||void 0===n?void 0:n[1])-5:0,":"):"",isLiveUpdate:!0}),_.current.call()}),3e3);T.current={intervalId:e}}}return a.a.useEffect((function(){return _.current=f.a.getRunLogs({runHash:E}),_.current.call(),g.a(d.a.runDetails.tabs.logs.tabView),Q(),function(){var e;_.current.abort(),(null===(e=T.current)||void 0===e?void 0:e.intervalId)&&clearInterval(T.current.intervalId)}}),[]),a.a.useEffect((function(){var e;!I&&(null===(e=T.current)||void 0===e?void 0:e.intervalId)&&(clearInterval(T.current.intervalId),_.current.abort())}),[I]),a.a.useEffect((function(){var e=u.a.sortBy(Object.values(null!==p&&void 0!==p?p:{}),"index"),n=u.a.sortBy(e.map((function(e){return e.index})));S.current=[n[0],n[n.length-1]],G(n),z.current=e}),[p]),a.a.useEffect((function(){var e,n,r,t,l;if(N===h.LOAD_MORE&&K.current)null===(r=x.current)||void 0===r||null===(t=r.scrollToItem)||void 0===t||t.call(r,(null===(l=K.current)||void 0===l?void 0:l[0])+R,"start"),U(h.DEFAULT);else if(N===h.LIVE_UPDATE&&(null===(e=K.current)||void 0===e?void 0:e[1])+R>=(null===(n=z.current)||void 0===n?void 0:n.length)-1){var a,i,c;if(!u.a.isEmpty(q))null===(a=x.current)||void 0===a||null===(i=a.scrollToItem)||void 0===i||i.call(a,(null===(c=z.current)||void 0===c?void 0:c.length)-1,"end")}else if(N===h.DEFAULT){var o,s,d;if(!u.a.isEmpty(q))null===(o=x.current)||void 0===o||null===(s=o.scrollToItem)||void 0===s||s.call(o,(null===(d=z.current)||void 0===d?void 0:d.length)-1,"end")}else{var v,f,g,L;null===(v=x.current)||void 0===v||null===(f=v.scrollToItem)||void 0===f||f.call(v,null!==(g=null===(L=K.current)||void 0===L?void 0:L[0])&&void 0!==g?g:0,"start")}}),[null===(n=z.current)||void 0===n?void 0:n.length,q]),a.a.useEffect((function(){var e,n;N===h.DEFAULT&&P&&C&&(u.a.isEmpty(q)||null===(e=x.current)||void 0===e||null===(n=e.scrollToItem)||void 0===n||n.call(e,K.current[0],"start"))}),[P,C]),Object(v.a)((function(){D.current&&(F(D.current.offsetHeight),M(D.current.offsetWidth))}),D),Object(L.jsx)(o.a,{children:Object(L.jsx)(c.a,{isLoading:O,className:"runDetailParamsTabLoader",height:"100%",children:u.a.isEmpty(p)||u.a.isEmpty(q)?Object(L.jsx)(s.a,{size:"xLarge",className:"runDetailParamsTabLoader",title:"No Logs"}):Object(L.jsx)("div",{className:"RunDetailLogsTabWrapper",children:Object(L.jsx)("div",{className:"RunDetailLogsTab",children:Object(L.jsx)("div",{className:"Logs",ref:D,children:Object(L.jsx)("div",{className:"Logs__wrapper",children:Object(L.jsx)(i.c,{ref:x,height:(null===(r=D.current)||void 0===r?void 0:r.offsetHeight)||100,itemCount:(null===(l=z.current)||void 0===l?void 0:l.length)+1,itemSize:function(){return 17},width:"100%",overscanCount:100,initialScrollOffset:null!==(b=B.current)&&void 0!==b?b:15*(null===(j=z.current)||void 0===j?void 0:j.length),onItemsRendered:function(e){K.current=[e.visibleStartIndex,e.visibleStopIndex]},itemData:{logsList:z.current},onScroll:function(e){var n,r,t,l;B.current=e.scrollOffset,e.scrollOffset<=15&&0!==+(null===q||void 0===q?void 0:q[0])&&"backward"===e.scrollDirection&&((null===(n=T.current)||void 0===n?void 0:n.intervalId)&&(clearInterval(T.current.intervalId),_.current.abort()),U(h.LOAD_MORE),_.current=f.a.getRunLogs({runHash:E,record_range:"".concat(+(null===(r=S.current)||void 0===r?void 0:r[0])>100?+(null===(t=S.current)||void 0===t?void 0:t[0])-100:0,":").concat(null===(l=S.current)||void 0===l?void 0:l[0]),isLiveUpdate:!0}),_.current.call(),Q())},children:m},"".concat(P).concat(C))})})})})})})}j.displayName="RunLogsTab";var O=a.a.memo(j);n.default=O}}]);
//# sourceMappingURL=RunLogsTab.js.map?version=d9651bc49f1af952ec7e