@bull-board/ui
Version:
A Dashboard UI built on top of bull or bullmq.
1 lines • 21.8 kB
JavaScript
;(self.webpackChunk_bull_board_ui=self.webpackChunk_bull_board_ui||[]).push([["48554"],{51529(e,t,l){l.d(t,{A:()=>s});let s={card:"card-BRjpw_",contentWrapper:"contentWrapper-Aj9Wmy",jobName:"jobName-t8DcMf",sideInfo:"sideInfo-a9IFbv",header:"header-Lw4QCc",headerActions:"headerActions-BHD8mS",statusDot:"statusDot-JKWQae",jobId:"jobId-bLy5Ry",jobNameInline:"jobNameInline-ZJ3YIs",details:"details-JRsI9B",collapseBtn:"collapseBtn-J6rMz7",content:"content-SHI77x",progress:"progress-POOya3",jobLink:"jobLink-wmCWQg",titleWithLink:"titleWithLink-UFeEb7",externalLink:"externalLink-dX0ReW",groupPill:"groupPill-dKGnlb"}},40555(e,t){t.STATUSES=void 0,t.STATUSES={latest:"latest",active:"active",waiting:"waiting",waitingChildren:"waiting-children",prioritized:"prioritized",completed:"completed",failed:"failed",delayed:"delayed",paused:"paused"}},81367(e,t,l){l.d(t,{Z:()=>n});var s=l(31085),a=l(54357);l(14041);let n=e=>{let{children:t,className:l}=e;return(0,s.jsx)("div",{className:(0,a.A)("card-xqyZlH",l),children:t})}},19414(e,t,l){l.d(t,{A:()=>a});var s=l(31085);l(14041);let a=()=>(0,s.jsx)("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 512",children:(0,s.jsx)("path",{d:"M231.293 473.899l19.799-19.799c4.686-4.686 4.686-12.284 0-16.971L70.393 256 251.092 74.87c4.686-4.686 4.686-12.284 0-16.971L231.293 38.1c-4.686-4.686-12.284-4.686-16.971 0L4.908 247.515c-4.686 4.686-4.686 12.284 0 16.971L214.322 473.9c4.687 4.686 12.285 4.686 16.971-.001z"})})},8020(e,t,l){l.d(t,{E:()=>a});var s=l(31085);l(14041);let a=()=>(0,s.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,s.jsx)("path",{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"})})},15190(e,t,l){l.d(t,{u:()=>a});var s=l(31085);l(14041);let a=()=>(0,s.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,s.jsx)("path",{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"})})},2206(e,t,l){l.d(t,{G:()=>a});var s=l(31085);l(14041);let a=()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{d:"M15 17v-2.99A4 4 0 0 0 11 10H8v5L2 9l6-6v5h3a6 6 0 0 1 6 6v3h-2z"})})},7320(e,t,l){l.d(t,{m:()=>a});var s=l(31085);l(14041);let a=()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{d:"M5 4a2 2 0 0 0-2 2v6H0l4 4 4-4H5V6h7l2-2H5zm10 4h-3l4-4 4 4h-3v6a2 2 0 0 1-2 2H6l2-2h7V8z"})})},56956(e,t,l){l.d(t,{u:()=>a});var s=l(31085);l(14041);let a=()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{d:"M6 2l2-2h4l2 2h4v2H2V2h4zM3 6h14l-1 14H4L3 6zm5 2v10h1V8H8zm3 0v10h1V8h-1z"})})},66832(e,t,l){l.d(t,{o:()=>er});var s=l(31085),a=l(40555),n=l(14041),r=l(42348),i=l(33664),c=l(43499),o=l(81367),d=l(12287);let u=e=>{let{className:t}=e;return(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 512 512",className:t,children:(0,s.jsx)("path",{d:"M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6V32c0-17.7-14.3-32-32-32H352zM80 32C35.8 32 0 67.8 0 112v320c0 44.2 35.8 80 80 80h320c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32v112c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16h112c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"})})};var h=l(40783);let p=()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,s.jsx)("path",{d:"M241 130.5l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9l-22.7 22.7c-9.4 9.4-24.5 9.4-33.9 0L224 227.5 69.3 381.5c-9.4 9.3-24.5 9.3-33.9 0l-22.7-22.7c-9.4-9.4-9.4-24.6 0-33.9L207 130.5C216.4 121.2 231.6 121.2 241 130.5z"})});var m=l(84382),x=l(27987),j=l(15510),g=l(54357),v=l(12445);let S=void 0!==window.Worker,b=null,A=new Map;async function w(e,t){if(S)return b||((b=new Worker(new URL(l.p+l.u("30697"),l.b),Object.assign({},{name:"highlight-worker"},{type:void 0}))).onmessage=e=>{let{data:t}=e,{id:l,code:s}=t;if(A.has(l)){let{resolve:e}=A.get(l);e(s)}}),new Promise((l,s)=>{let a=(0,v.Ak)(5);null==b||b.postMessage({id:a,code:e,language:t}),A.set(a,{resolve:e=>{A.delete(a),l(e)},reject:()=>{A.delete(a),s()}}),setTimeout(()=>s(),6e4)});{let{highlighter:s}=await Promise.all([l.e("2833"),l.e("85334")]).then(l.bind(l,79945));return s.highlightAuto(e,[t]).value||""}}let T=()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:(0,s.jsx)("path",{d:"M280 64l40 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 128C0 92.7 28.7 64 64 64l40 0 9.6 0C121 27.5 153.3 0 192 0s71 27.5 78.4 64l9.6 0zM64 112c-8.8 0-16 7.2-16 16l0 320c0 8.8 7.2 16 16 16l256 0c8.8 0 16-7.2 16-16l0-320c0-8.8-7.2-16-16-16l-16 0 0 24c0 13.3-10.7 24-24 24l-88 0-88 0c-13.3 0-24-10.7-24-24l0-24-16 0zm128-8a24 24 0 1 0 0-48 24 24 0 1 0 0 48z"})}),N=e=>{let{language:t,text:l}=e,[a,r]=(0,n.useState)("");return(0,n.useEffect)(()=>{let e=!1;return w(l,t).then(t=>{e||r(t)}),()=>{e=!0}},[t,l]),(0,s.jsxs)("div",{className:"codeContainerWrapper-ZpYBAP",children:[(0,s.jsx)("pre",{children:(0,s.jsx)("code",{className:(0,g.A)("hljs",t),dangerouslySetInnerHTML:{__html:a}})}),(0,s.jsx)(m.$,{onClick:()=>{navigator.clipboard.writeText(l??"")},className:"copyBtn-vLoi5u",compact:!0,children:(0,s.jsx)(T,{})})]})};var f=l(98807);l(30829);let y=()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,s.jsx)("path",{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"})}),O=e=>{let{textToCopy:t,className:l,tabIndex:a}=e,{t:i}=(0,r.Bd)(),[c,o]=(0,n.useState)(!1),d=(0,n.useRef)(),u=(0,n.useCallback)(async()=>{try{await navigator.clipboard.writeText(t),o(!0),clearTimeout(d.current),d.current=setTimeout(()=>o(!1),1500)}catch(e){alert(i("CLIPBOARD.COPY_FAILED"))}},[t,i]);return(0,s.jsx)(m.$,{onClick:u,className:`copyBtn-S91mHH ${c?"copied-Eowyzo":""} ${l||""}`,tabIndex:a,children:c?(0,s.jsx)(y,{}):(0,s.jsx)(T,{})})},C="label-ymbP05",L={container:"container-_LjKnx",basicChildStyle:"basicChildStyle-tTpXD4",collapseIcon:"collapseIcon-PhouWI",expandIcon:"expandIcon-RZtdZD",collapsedContent:"collapsedContent-wxaP6v",label:C,clickableLabel:C,punctuation:"punctuation-SIrhOo",stringValue:"stringValue-jX0CHZ",numberValue:"numberValue-FVYrm4",booleanValue:"booleanValue-Gs5QuZ",nullValue:"nullValue-Z9oy6o",undefinedValue:"undefinedValue-YPfHsD",otherValue:"otherValue-gr22aS",noQuotesForStringValues:!1},B=e=>{let{data:t,defaultCollapseDepth:l=3}=e,a=(0,n.useMemo)(()=>JSON.stringify(t,null,2),[t]),r=(0,n.useCallback)(e=>0===l?(0,f.ab)(e):e<l,[l]);return(0,s.jsxs)("div",{className:"root-Eyiful",children:[(0,s.jsx)("div",{className:"content-K6N1cP",children:(0,s.jsx)(f.UU,{data:t,shouldExpandNode:r,style:L})}),(0,s.jsx)(O,{textToCopy:a,className:"copyBtn-CoPL0E"})]})};var E=l(36271),I=l(15735),J=l(64328),D=l(47245),R=l(53846),_=l(85891),k=l(26834);let U=(e,t,l)=>{let s;if((0,E.A)(e)){if(null==l?void 0:l.short)return(0,I.A)(new Date(e),l.short);s={hour:"numeric",minute:"numeric",second:"numeric"}}else if((0,J.A)(e,new Date)){if(null==l?void 0:l.common)return(0,I.A)(new Date(e),l.common);s={month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"}}else{if(null==l?void 0:l.full)return(0,I.A)(new Date(e),l.full);s={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"}}return new Intl.DateTimeFormat(t,s).format(e)},M=(e,t,l)=>{let s=(0,D.A)(e,t),a=s/1e3;return a>5?(0,R.A)(e,t,{includeSeconds:!0,locale:_.Q}):a>=1?l("JOB.DURATION.SECS",{duration:a.toFixed(2)}):l("JOB.DURATION.MILLI_SECS",{duration:s})},H=function(e){let{job:t,status:l,className:n}=e,{t:i,i18n:c}=(0,r.Bd)(),o=(0,k._)().dateFormats||{};return(0,s.jsx)("div",{className:(0,g.A)("timelineWrapper-iZqG0C",n),children:(0,s.jsxs)("ul",{className:"timeline-lF9niS",children:[(0,s.jsxs)("li",{children:[(0,s.jsx)("small",{children:i("JOB.ADDED_AT")}),(0,s.jsx)("time",{children:U(t.timestamp||0,c.language,o)})]}),!!t.delay&&t.delay>0&&l===a.STATUSES.delayed&&(0,s.jsxs)("li",{children:[(0,s.jsx)("small",{children:i("JOB.WILL_RUN_AT")}),(0,s.jsx)("time",{children:U((t.timestamp||0)+(t.opts.delay||t.delay||0),c.language,o)}),t.delay!==t.opts.delay&&(0,s.jsxs)("small",{children:[i("JOB.DELAY_CHANGED")," "]})]}),!!t.processedOn&&(0,s.jsxs)("li",{children:[(0,s.jsxs)("small",{children:[!!t.delay&&t.delay>0&&i("JOB.DELAYED_FOR")+" ",M(t.processedOn,t.timestamp||0,i)]}),(0,s.jsx)("small",{children:i("JOB.PROCESS_STARTED_AT")}),(0,s.jsx)("time",{children:U(t.processedOn,c.language,o)}),!!t.processedBy&&(0,s.jsx)("small",{children:i("JOB.PROCESSED_BY",{processedBy:t.processedBy})})]}),!!t.finishedOn&&(0,s.jsxs)("li",{children:[(0,s.jsx)("small",{children:M(t.finishedOn,t.processedOn||0,i)}),(0,s.jsx)("small",{children:i(t.isFailed&&l!==a.STATUSES.active&&l!==a.STATUSES.completed?"JOB.FAILED_AT":"JOB.FINISHED_AT")}),(0,s.jsx)("time",{children:U(t.finishedOn,c.language,o)})]})]})})};var P=l(26347),z=l(10451),$=l(8020),V=l(15190);let W=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return!t||RegExp(`${t}`,"i").test(e.message)};function F(e){return e.map((e,t)=>({message:e,lineNumber:t+1}))}let K=e=>{let t,{actions:l,job:a}=e,{t:i}=(0,r.Bd)(),[c,o]=(0,n.useState)([]),[d,u]=(0,n.useState)(!1),[h,p]=(0,n.useState)(""),[x,j]=(0,n.useState)(""),g=(0,n.useRef)(null),v=(0,n.useRef)();(0,n.useEffect)(()=>{let e=!0;return l.getJobLogs().then(t=>{e&&o(F(t))}),()=>{e=!1}},[]),(0,P.$)(async()=>{o(F(await l.getJobLogs())),requestAnimationFrame(()=>{var e,t;null==(t=g.current)||t.scrollTo({top:null==(e=g.current)?void 0:e.scrollHeight,behavior:"smooth"})})},d?2500:null);let S=()=>{u(!d)},b=c.filter(e=>W(e,h));return(0,s.jsx)("div",{className:"jobLogs-MsL4aJ",ref:g,children:c.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("ul",{className:"toolbar-duDU2f",children:[(0,s.jsx)("li",{children:(0,s.jsx)("input",{className:"searchBar-N4o70g",type:"text",placeholder:i("JOB.LOGS.FILTER_PLACEHOLDER"),value:x,onChange:e=>{let t=e.target.value;j(t),clearTimeout(v.current),v.current=setTimeout(()=>p(t),250)}})}),!a.finishedOn&&(0,s.jsx)("li",{children:(0,s.jsx)(m.$,{isActive:d,onClick:S,children:d?(0,s.jsx)($.E,{}):(0,s.jsx)(V.u,{})})}),(0,s.jsx)("li",{children:(0,s.jsx)(m.$,{onClick:(t=g.current,async()=>t&&document.fullscreenElement!==t?await t.requestFullscreen():document.exitFullscreen()),children:(0,s.jsx)(z.P,{})})}),(0,s.jsx)("li",{children:(0,s.jsx)(O,{textToCopy:b.map(e=>e.message).join("\n")})})]}),(0,s.jsx)("div",{className:"preWrapper-V9RpQs",children:(0,s.jsx)("pre",{children:(0,s.jsx)("ol",{style:{paddingInlineStart:`${`${b.length}`.length+1}ch`},children:b.map(e=>{var t,l;let a;return(0,s.jsxs)("li",{className:null==(a=null==(l=e.message)||null==(t=l.match(/((info|warn|error)?):/i))?void 0:t[1])?void 0:a.toLowerCase(),"data-line-number":`${e.lineNumber}.`,children:[e.message,(0,s.jsx)(O,{textToCopy:e.message,className:"logLineCopyButton-LnHhmG",tabIndex:-1})]},e.lineNumber)})})})})]}):(0,s.jsxs)("div",{className:"emptyState-W3badU",children:[i("JOB.NO_LOGS"),!a.finishedOn&&(0,s.jsx)(m.$,{isActive:d,onClick:S,children:d?(0,s.jsx)($.E,{}):(0,s.jsx)(V.u,{})})]})})},G=e=>{let{selectedTab:t,job:l,actions:a,status:i}=e,{t:c}=(0,r.Bd)(),{collapseJobData:o,collapseJobProgress:u,collapseJobOptions:p,collapseJobError:x,defaultCollapseDepth:j,useCollapsibleJson:g}=(0,h.C)(),[v,S]=(0,n.useState)({data:!1,progress:!1,options:!1,error:!1}),{stacktrace:b,data:A,returnValue:w,opts:T,failedReason:f}=l;switch(t){case"Data":if(o&&!v.data)return(0,s.jsxs)(m.$,{onClick:()=>S({...v,data:!0}),children:[c("JOB.SHOW_DATA_BTN")," ",(0,s.jsx)(d.y,{})]});return g?(0,s.jsx)(B,{data:{jobData:A,returnValue:w},defaultCollapseDepth:j}):(0,s.jsx)(N,{language:"json",text:JSON.stringify({jobData:A,returnValue:w},null,2)});case"Progress":if("number"==typeof l.progress||"boolean"==typeof l.progress||null===l.progress||void 0===l.progress)return(0,s.jsx)("div",{className:"error",children:c("JOB.NO_PROGRESS")});return u&&!v.progress?(0,s.jsxs)(m.$,{onClick:()=>S({...v,progress:!0}),children:[c("JOB.SHOW_PROGRESS_BTN")," ",(0,s.jsx)(d.y,{})]}):g?(0,s.jsx)(B,{data:l.progress,defaultCollapseDepth:j}):(0,s.jsx)(N,{language:"json",text:JSON.stringify(l.progress,null,2)});case"Options":if(p&&!v.options)return(0,s.jsxs)(m.$,{onClick:()=>S({...v,options:!0}),children:[c("JOB.SHOW_OPTIONS_BTN")," ",(0,s.jsx)(d.y,{})]});return g?(0,s.jsx)(B,{data:T,defaultCollapseDepth:j}):(0,s.jsx)(N,{language:"json",text:JSON.stringify(T,null,2)});case"Error":if(0===b.length)return(0,s.jsx)("div",{className:"error",children:f||c("JOB.NO_ERRORS")});return x&&!v.error?(0,s.jsxs)(m.$,{onClick:()=>S({...v,error:!0}),children:[c("JOB.SHOW_ERRORS_BTN")," ",(0,s.jsx)(d.y,{})]}):(0,s.jsx)(N,{language:"stacktrace",text:b.join("\n")},"stacktrace");case"Logs":return(0,s.jsx)(K,{actions:a,job:l});case"Timeline":return(0,s.jsx)(H,{job:l,status:i,className:"timeline-_2T35a"});default:return null}},Y=e=>{let{status:t,job:l,actions:a,withTimeline:n=!1}=e,{tabs:i,selectedTab:c}=(0,j.i)({currentStatus:t,withTimeline:n}),{t:o}=(0,r.Bd)();return 0===i.length?null:(0,s.jsxs)("div",{className:"details-LkCTWS",children:[(0,s.jsx)("ul",{className:"tabActions-fF3v6_",children:i.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(m.$,{onClick:e.selectTab,isActive:e.isActive,children:o(`JOB.TABS.${e.title.toUpperCase()}`)})},e.title))}),(0,s.jsx)("div",{className:"tabContent-qmHNgq",children:(0,s.jsx)(G,{selectedTab:c,job:l,actions:a,status:t})})]})};var Z=l(2206),Q=l(7320),q=l(56956);let X=e=>{let{title:t,children:l}=e;return(0,s.jsx)("span",{"data-title":t,className:"tooltip-QJB3Pz",children:l})},ee={updateData:{titleKey:"UPDATE_DATA",Icon:()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:(0,s.jsx)("path",{d:"M471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7zm-299.2 220c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3 172.4 241.7zM96 64C43 64 0 107 0 160L0 416c0 53 43 96 96 96l256 0c53 0 96-43 96-96l0-96c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 96c0 17.7-14.3 32-32 32L96 448c-17.7 0-32-14.3-32-32l0-256c0-17.7 14.3-32 32-32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L96 64z"})}),actionKey:"updateJobData"},promote:{titleKey:"PROMOTE",Icon:Z.G,actionKey:"promoteJob"},clean:{titleKey:"CLEAN",Icon:q.u,actionKey:"cleanJob"},retry:{titleKey:"RETRY",Icon:Q.m,actionKey:"retryJob"},duplicate:{titleKey:"DUPLICATE",Icon:()=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,s.jsx)("path",{d:"M208 0L332.1 0c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9L448 336c0 26.5-21.5 48-48 48l-192 0c-26.5 0-48-21.5-48-48l0-288c0-26.5 21.5-48 48-48zM48 128l80 0 0 64-64 0 0 256 192 0 0-32 64 0 0 48c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 176c0-26.5 21.5-48 48-48z"})}),actionKey:"duplicateJob"}},et={[a.STATUSES.failed]:[ee.retry,ee.duplicate,ee.updateData,ee.clean],[a.STATUSES.delayed]:[ee.promote,ee.duplicate,ee.updateData,ee.clean],[a.STATUSES.completed]:[ee.duplicate,ee.retry,ee.clean],[a.STATUSES.waiting]:[ee.duplicate,ee.updateData,ee.clean],[a.STATUSES.waitingChildren]:[ee.duplicate,ee.updateData,ee.clean],[a.STATUSES.prioritized]:[ee.duplicate,ee.updateData,ee.clean],[a.STATUSES.paused]:[ee.duplicate,ee.updateData,ee.clean]},el=e=>{let{actions:t,status:l,allowRetries:a}=e,n=et[l],{t:i}=(0,r.Bd)();return n?(a||(n=n.filter(e=>"retryJob"!==e.actionKey)),(0,s.jsx)("ul",{className:"jobActions-XfoQK8",children:n.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(X,{title:i(`JOB.ACTIONS.${e.titleKey}`),children:(0,s.jsx)(m.$,{onClick:t[e.actionKey],className:"button-GXX8BV",children:(0,s.jsx)(e.Icon,{})})})},e.titleKey))})):null},es=e=>{var t;let{progress:l,status:n,className:r,strokeWidth:i=6}=e,c="number"==typeof(t=l)?t:"string"==typeof t?Number.isNaN(+t)?null:+t:t&&"boolean"!=typeof t&&"progress"in t&&"number"==typeof t.progress?t.progress:null;if(!c)return null;let o={cx:"50%",cy:"50%",r:`calc(50% - ${i/2}px)`,strokeWidth:i,"transform-origin":"center"};return(0,s.jsxs)("svg",{className:(0,g.A)("progress-Rr7sCM",r),width:"100%",height:"100%",children:[(0,s.jsx)("circle",{...o}),(0,s.jsx)("circle",{className:(0,g.A)({"failed-rTUpGj":n===a.STATUSES.failed,"success-RY6h2q":n!==a.STATUSES.failed}),pathLength:100,strokeDasharray:100,strokeDashoffset:100-c,strokeLinejoin:"round",strokeLinecap:"round",transform:"rotate(-90)",...o}),(0,s.jsx)("text",{x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"central",children:(0,s.jsx)("tspan",{dominantBaseline:"central",children:`${Math.round(c)}%`})})]})};var ea=l(51529);let en=[a.STATUSES.active,a.STATUSES.completed],er=e=>{var t,l,j,g,v,S;let{job:b,status:A,actions:w,readOnlyMode:T,allowRetries:N,jobUrl:f}=e,{t:y}=(0,r.Bd)(),{collapseJob:O}=(0,h.C)(),C=(0,c.I)(),[L,B]=n.useState(),E=!f||L||!O,I=O&&f,J=/^\d+$/.test(`${b.id}`)?"#":"",D=`${b.id}`.length<=8;return(0,s.jsx)(x.bL,{asChild:!0,open:E,children:(0,s.jsxs)(o.Z,{className:ea.A.card,children:[(0,s.jsxs)("div",{className:ea.A.header,children:[(0,s.jsxs)("div",{className:ea.A.titleWithLink,children:[f?(0,s.jsxs)(i.N_,{className:ea.A.jobLink,to:f,children:[(0,s.jsxs)("span",{className:ea.A.jobId,children:[J,b.id]}),D&&(0,s.jsx)("span",{className:ea.A.jobNameInline,children:b.name})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:ea.A.statusDot,style:{backgroundColor:`var(--${A})`}}),(0,s.jsxs)("span",{className:ea.A.jobId,children:[J,b.id]}),D&&(0,s.jsx)("span",{className:ea.A.jobNameInline,children:b.name})]}),null!=b.groupId&&(0,s.jsxs)("span",{className:ea.A.groupPill,title:`Group: ${b.groupId}`,children:["group: ",b.groupId]}),b.externalUrl&&(0,s.jsx)("a",{className:ea.A.externalLink,href:b.externalUrl.href,target:"_blank",rel:"noopener noreferrer",children:b.externalUrl.displayText??(0,s.jsx)(u,{})})]}),(0,s.jsxs)("div",{className:ea.A.headerActions,children:[!T&&(0,s.jsx)(el,{status:A,actions:w,allowRetries:N}),I&&(0,s.jsx)(m.$,{className:ea.A.collapseBtn,onClick:()=>B(!E),children:E?(0,s.jsx)(p,{}):(0,s.jsx)(d.y,{})})]})]}),(0,s.jsx)(x.UC,{asChild:!0,children:(0,s.jsxs)("div",{className:ea.A.details,children:[!C&&(0,s.jsx)("div",{className:ea.A.sideInfo,children:(0,s.jsx)(H,{job:b,status:A})}),(0,s.jsxs)("div",{className:ea.A.contentWrapper,children:[!D&&(0,s.jsxs)("h5",{className:ea.A.jobName,children:[b.name,b.attempts>1&&(0,s.jsx)("span",{children:y("JOB.ATTEMPTS",{attempts:b.attempts})}),!!(null==(l=b.opts)||null==(t=l.repeat)?void 0:t.count)&&(0,s.jsx)("span",{children:y(`JOB.REPEAT${(null==(g=b.opts)||null==(j=g.repeat)?void 0:j.limit)?"_WITH_LIMIT":""}`,{count:b.opts.repeat.count,limit:null==(S=b.opts)||null==(v=S.repeat)?void 0:v.limit})})]}),(0,s.jsx)("div",{className:ea.A.content,children:(0,s.jsx)(Y,{status:A,job:b,actions:w,withTimeline:C})}),(0,s.jsx)(es,{progress:b.progress,status:b.isFailed&&!en.includes(A)?a.STATUSES.failed:A,className:ea.A.progress})]})]})})]})})}},64771(e,t,l){l.d(t,{V:()=>a});var s=l(31085);l(14041);let a=e=>{let{actions:t,children:l}=e;return(0,s.jsxs)("div",{className:"stickyHeader-Woc0cg",children:[l,!!t&&(0,s.jsx)("div",{className:"actionContainer-gipYSV",children:t})]})}},27384(e,t,l){l.d(t,{W:()=>a});var s=l(86090);function a(){let{pathname:e}=(0,s.zy)(),t=(0,s.B6)(e,{path:["/queue/:name/:jobId"],exact:!1,strict:!1});return decodeURIComponent((null==t?void 0:t.params.jobId)||"")}},15510(e,t,l){l.d(t,{d:()=>r,i:()=>i});var s=l(40555),a=l(14041),n=l(40783);let r=["Data","Progress","Options","Logs","Error","Timeline"];function i(e){let[t,l]=(0,a.useState)([]),{defaultJobTab:i}=(0,n.C)(),[c,o]=(0,a.useState)(t.find(e=>e===i)||t[0]);return(0,a.useEffect)(()=>{let t=r.filter(e=>"Error"!==e&&"Timeline"!==e);t=e.currentStatus===s.STATUSES.failed?["Error",...t]:[...t,"Error"],e.withTimeline&&t.push("Timeline"),l(t)},[e.currentStatus,e.withTimeline]),(0,a.useEffect)(()=>{o(t.includes(i)?i:t[0])},[i,t]),{tabs:null==t?void 0:t.map(e=>({title:e,isActive:e===c,selectTab:()=>o(e)})),selectedTab:c}}},96587(e,t,l){l.d(t,{J:()=>m});var s=l(42348),a=l(85865),n=l(83839),r=l(27384),i=l(20050),c=l(36784),o=l(86052),d=l(26347),u=l(87106),h=l(40783);let p=(0,a.vt)(e=>({job:null,status:"latest",loading:!0,updateJob:(t,l)=>e(()=>({job:t,status:l,loading:!1}))}));function m(){let e=(0,c.g)(),t=(0,i._)(),l=(0,r.W)(),{actions:{updateQueues:a}}=(0,u.A)(),{t:m}=(0,s.Bd)(),{confirmJobActions:x,pollingInterval:j}=(0,h.C)(e=>{let{confirmJobActions:t,pollingInterval:l}=e;return{confirmJobActions:t,pollingInterval:l}}),{job:g,status:v,loading:S,updateJob:b}=p(e=>e),{openConfirm:A}=(0,o.S)(),w=()=>e.getJob(t,l).then(e=>{let{job:t,status:l}=e;return b(t,l)}),T=(0,n.A)(l?w:a,A);return{job:g,status:v,loading:S,actions:{getJob:w,pollJob:()=>(0,d.$)(w,j>0?1e3*j:null,[t]),promoteJob:t=>l=>T(()=>e.promoteJob(t,l.id),m("JOB.ACTIONS.CONFIRM.PROMOTE"),x),cleanJob:t=>l=>T(()=>e.cleanJob(t,l.id),m("JOB.ACTIONS.CONFIRM.CLEAN"),x),getJobLogs:t=>l=>()=>e.getJobLogs(t,l.id),retryJob:t=>l=>T(()=>e.retryJob(t,l.id),m("JOB.ACTIONS.CONFIRM.RETRY"),x),updateJobData:(t,l,s)=>T(()=>e.updateJobData(t,l.id,s),"",!1)}}}}}]);