@bull-board/ui
Version:
A Dashboard UI built on top of bull or bullmq.
1 lines • 12.7 kB
JavaScript
;(self.webpackChunk_bull_board_ui=self.webpackChunk_bull_board_ui||[]).push([["13531"],{40555(e,s){s.STATUSES=void 0,s.STATUSES={latest:"latest",active:"active",waiting:"waiting",waitingChildren:"waiting-children",prioritized:"prioritized",completed:"completed",failed:"failed",delayed:"delayed",paused:"paused"}},81367(e,s,a){a.d(s,{Z:()=>i});var l=a(31085),t=a(54357);a(14041);let i=e=>{let{children:s,className:a}=e;return(0,l.jsx)("div",{className:(0,t.A)("card-xqyZlH",a),children:s})}},10179(e,s,a){a.d(s,{L:()=>t});var l=a(31085);a(14041);let t=()=>(0,l.jsx)("svg",{"aria-hidden":"true",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 192 512",children:(0,l.jsx)("path",{d:"M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z"})})},8020(e,s,a){a.d(s,{E:()=>t});var l=a(31085);a(14041);let t=()=>(0,l.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,l.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,s,a){a.d(s,{u:()=>t});var l=a(31085);a(14041);let t=()=>(0,l.jsx)("svg",{"aria-hidden":"true",focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,l.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"})})},56956(e,s,a){a.d(s,{u:()=>t});var l=a(31085);a(14041);let t=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:(0,l.jsx)("path",{d:"M6 2l2-2h4l2 2h4v2H2V2h4zM3 6h14l-1 14H4L3 6zm5 2v10h1V8H8zm3 0v10h1V8h-1z"})})},15098(e,s,a){a.d(s,{K:()=>j});var l=a(31085),t=a(7841);a(14041);var i=a(42348),r=a(84382),c=a(93469);let d=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,l.jsx)("path",{d:"M64 80c-8.8 0-16 7.2-16 16v320c0 8.8 7.2 16 16 16h320c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16H64zM0 96c0-35.3 28.7-64 64-64h320c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zm200 248v-64h-64c-13.3 0-24-10.7-24-24s10.7-24 24-24h64v-64c0-13.3 10.7-24 24-24s24 10.7 24 24v64h64c13.3 0 24 10.7 24 24s-10.7 24-24 24h-64v64c0 13.3-10.7 24-24 24s-24-10.7-24-24z"})});var n=a(10179);let o=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 640",children:(0,l.jsx)("path",{d:"M183.1 137.4C170.6 124.9 150.3 124.9 137.8 137.4C125.3 149.9 125.3 170.2 137.8 182.7L275.2 320L137.9 457.4C125.4 469.9 125.4 490.2 137.9 502.7C150.4 515.2 170.7 515.2 183.2 502.7L320.5 365.3L457.9 502.6C470.4 515.1 490.7 515.1 503.2 502.6C515.7 490.1 515.7 469.8 503.2 457.3L365.8 320L503.1 182.6C515.6 170.1 515.6 149.8 503.1 137.3C490.6 124.8 470.3 124.8 457.8 137.3L320.5 274.7L183.1 137.4z"})});var u=a(8020),h=a(15190);let x=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:(0,l.jsx)("path",{d:"M416 128H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h384c17.7 0 32 14.3 32 32s-14.3 32-32 32zm-96 160H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h288c17.7 0 32 14.3 32 32s-14.3 32-32 32zm-64 160H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h224c17.7 0 32 14.3 32 32s-14.3 32-32 32z"})});var p=a(56956);let j=e=>{let{queue:s,actions:a}=e,{t:j}=(0,i.Bd)();return(0,l.jsxs)(t.bL,{children:[(0,l.jsx)(t.l9,{asChild:!0,children:(0,l.jsx)(r.$,{className:"trigger-GNtOnV",children:(0,l.jsx)(n.L,{})})}),(0,l.jsx)(t.ZL,{children:(0,l.jsxs)(c.p,{align:"end",children:[(0,l.jsxs)(t.q7,{onSelect:a.addJob,children:[(0,l.jsx)(d,{}),j("QUEUE.ACTIONS.ADD_JOB")]}),(0,l.jsx)(t.q7,{onSelect:s.isPaused?a.resumeQueue(s.name):a.pauseQueue(s.name),children:s.isPaused?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h.u,{}),j("QUEUE.ACTIONS.RESUME")]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.E,{}),j("QUEUE.ACTIONS.PAUSE")]})}),"bullmq"===s.type&&!!a.onConcurrency&&(0,l.jsxs)(t.q7,{onSelect:a.onConcurrency,children:[(0,l.jsx)(x,{}),j("QUEUE.ACTIONS.SET_CONCURRENCY")]}),(0,l.jsxs)(t.q7,{onSelect:a.emptyQueue(s.name),children:[(0,l.jsx)(p.u,{}),j("QUEUE.ACTIONS.EMPTY")]}),(0,l.jsxs)(t.q7,{onSelect:a.obliterateQueue(s.name),className:"danger-GDAQpl",children:[(0,l.jsx)(o,{}),j("QUEUE.ACTIONS.OBLITERATE")]})]})})]})}},25101(e,s,a){a.d(s,{p:()=>d});var l=a(31085);a(14041);var t=a(42348),i=a(33664),r=a(38573);let c={statusBar:"statusBar-a5jlNu",statusTabs:"statusTabs-hBbuDg",tabsWrapper:"tabsWrapper-fF1t9Y",isActive:"isActive-C2L583",dot:"dot-N_ddYO",badge:"badge-megf05",trailing:"trailing-FZwfmt",waiting:"waiting-RxEe57",waitingChildren:"waitingChildren-dnj_C6",prioritized:"prioritized-G0QP5n",active:"active-t_bCgg",failed:"failed-UAbaoZ",completed:"completed-kcKLT0",delayed:"delayed-OgFXqU",paused:"paused-aQsd6J"},d=e=>{let{items:s,children:a}=e,{t:d}=(0,t.Bd)();return(0,l.jsxs)("div",{className:c.statusBar,children:[(0,l.jsx)("div",{className:c.tabsWrapper,children:(0,l.jsx)("ul",{className:c.statusTabs,children:s.map(e=>{let{status:s,to:a,isActive:t,count:n}=e,o=d(`QUEUE.STATUS.${s.toUpperCase()}`).toLocaleUpperCase();return(0,l.jsx)("li",{className:c[(0,r.C)(s)],children:(0,l.jsxs)(i.k2,{to:a,activeClassName:c.isActive,isActive:t,children:["latest"!==s&&(0,l.jsx)("span",{className:c.dot}),(0,l.jsx)("span",{"data-text":o,children:o}),null!=n&&n>0&&(0,l.jsx)("span",{className:c.badge,children:n})]})},s)})})}),!!a&&(0,l.jsx)("div",{className:c.trailing,children:a})]})}},64771(e,s,a){a.d(s,{V:()=>t});var l=a(31085);a(14041);let t=e=>{let{actions:s,children:a}=e;return(0,l.jsxs)("div",{className:"stickyHeader-Woc0cg",children:[a,!!s&&(0,l.jsx)("div",{className:"actionContainer-gipYSV",children:s})]})}},20630(e,s,a){a.d(s,{OverviewPage:()=>D});var l=a(31085),t=a(14041),i=a(42348),r=a(7841),c=a(84382),d=a(10179),n=a(8020),o=a(15190);let u=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:(0,l.jsx)("path",{d:"M183.6 42.4C177.5 35.8 169 32 160 32s-17.5 3.8-23.6 10.4l-88 96c-11.9 13-11.1 33.3 2 45.2s33.3 11.1 45.2-2L128 146.3 128 448c0 17.7 14.3 32 32 32s32-14.3 32-32l0-301.7 32.4 35.4c11.9 13 32.2 13.9 45.2 2s13.9-32.2 2-45.2l-88-96zM320 320c0 17.7 14.3 32 32 32l50.7 0-73.4 73.4c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-50.7 0 73.4-73.4c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8l-128 0c-17.7 0-32 14.3-32 32zM416 32c-12.1 0-23.2 6.8-28.6 17.7l-64 128-16 32c-7.9 15.8-1.5 35 14.3 42.9s35 1.5 42.9-14.3l7.2-14.3 88.4 0 7.2 14.3c7.9 15.8 27.1 22.2 42.9 14.3s22.2-27.1 14.3-42.9l-16-32-64-128C439.2 38.8 428.1 32 416 32zM395.8 176L416 135.6 436.2 176l-40.4 0z"})}),h=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:(0,l.jsx)("path",{d:"M288 464 c9 0 17.5 -3.8 23.6 -10.4 l88 -96 c11.9 -13 11.1 -33.3 -2 -45.2 s-33.3 -11.1 -45.2 2 L320 349.7 L320 48 c0 -17.7 -14.3 -32 -32 -32 s-32 14.3 -32 32 l0 301.7 L223.6 314.4 c-11.9 -13 -32.2 -13.9 -45.2 -2 s-13.9 32.2 -2 45.2 l88 96 C270.5 460.2 279 464 288 464 z"})}),x=()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:(0,l.jsx)("path",{d:"M288 48 c9 0 17.5 3.8 23.6 10.4 l88 96 c11.9 13 11.1 33.3 -2 45.2 s-33.3 11.1 -45.2 -2 L320 162.3 L320 464 c0 17.7 -14.3 32 -32 32 s-32 -14.3 -32 -32 l0 -301.7 L223.6 197.6 c-11.9 13 -32.2 13.9 -45.2 2 s-13.9 -32.2 -2 -45.2 l88 -96 C270.5 51.8 279 48 288 48 z"})}),p="item-Uubn_V",j=["alphabetical","failed","completed","active","waiting","delayed"],m=e=>{let{actions:s,queues:a,onSort:t,sortBy:m,sortDirection:v}=e,{t:g}=(0,i.Bd)();if(!a)return null;let w=a.every(e=>e.isPaused),S=a.every(e=>e.readOnlyMode),C="asc"===v?(0,l.jsx)(h,{}):(0,l.jsx)(x,{});return(0,l.jsxs)(r.bL,{children:[(0,l.jsx)(r.l9,{asChild:!0,children:(0,l.jsx)(c.$,{children:(0,l.jsx)(d.L,{})})}),(0,l.jsx)(r.ZL,{children:(0,l.jsxs)(r.UC,{className:"dropdown-N5QNV_",align:"end",children:[S?null:(0,l.jsxs)(l.Fragment,{children:[w?(0,l.jsxs)(r.q7,{className:p,onClick:s.resumeAll,children:[(0,l.jsx)(o.u,{}),g("QUEUE.ACTIONS.RESUME_ALL")]}):(0,l.jsxs)(r.q7,{className:p,onClick:s.pauseAll,children:[(0,l.jsx)(n.E,{}),g("QUEUE.ACTIONS.PAUSE_ALL")]}),(0,l.jsx)(r.wv,{})]}),(0,l.jsxs)(r.Pb,{children:[(0,l.jsxs)(r.ZP,{className:"subTrigger-G3bGtN item-Uubn_V",children:[(0,l.jsx)(u,{}),g("DASHBOARD.SORTING.TITLE")]}),(0,l.jsx)(r.G5,{className:"subDropdown-FqjaxT dropdown-N5QNV_",sideOffset:2,children:j.map(e=>(0,l.jsxs)(r.q7,{className:"subItem-_q8kr3 item-Uubn_V",onClick:()=>t(e),children:[g(`DASHBOARD.SORTING.${e.toUpperCase()}`),m===e&&C]},e))})]})]})})]})};var v=a(33664),g=a(46973),w=a(87106),S=a(20297),C=a(81367),N=a(15098),A=a(54357),T=a(38573);let E={stats:"stats-rA0n5N",progressBar:"progressBar-kqLFX9",bar:"bar-aiypOU",waiting:"waiting-q0vfA9",waitingChildren:"waitingChildren-S11OYM",prioritized:"prioritized-jTAxmN",completed:"completed-Bjjsoj",failed:"failed-L8BZmZ",active:"active-Aj24DJ",delayed:"delayed-huK85t",paused:"paused-xuACK2"},b=e=>{let{queue:s}=e,{t:a}=(0,i.Bd)(),t=s.statuses.reduce((e,a)=>e+(s.counts[a]||0),0);return(0,l.jsxs)("div",{className:E.stats,children:[(0,l.jsx)("div",{className:E.progressBar,children:s.statuses.filter(e=>s.counts[e]>0).map(e=>{let i=s.counts[e];return(0,l.jsx)(v.N_,{to:S.y.queuePage(s.name,{[s.name]:e}),role:"progressbar",style:{width:`${i/t*100}%`},"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":t,className:(0,A.A)(E[(0,T.C)(e)],E.bar),title:a(`QUEUE.STATUS.${e.toUpperCase()}`),children:i},e)})}),(0,l.jsx)("div",{children:a("DASHBOARD.JOBS_COUNT",{count:t})})]})},U=t.lazy(()=>Promise.all([a.e("51125"),a.e("30556")]).then(a.bind(a,42308)).then(e=>{let{AddJobModal:s}=e;return{default:s}})),y=t.lazy(()=>a.e("58975").then(a.bind(a,79778)).then(e=>{let{ConcurrencyModal:s}=e;return{default:s}})),L=e=>{let{queue:s}=e,{t:a}=(0,i.Bd)(),{actions:r}=(0,w.A)(),c=(0,g.h)(),[d]=t.useState(null);return(0,l.jsxs)(C.Z,{className:"queueCard-YHG6yO",children:[(0,l.jsxs)("div",{className:"header-gQ6Axi",children:[(0,l.jsx)(v.k2,{to:S.y.queuePage(s.name),className:"link-xZr7yB",children:s.displayName}),(0,l.jsxs)("div",{className:"headerContext-fhRYcv",children:[s.isPaused&&(0,l.jsxs)("span",{className:"pausedBadge-lWdTOt",children:["[ ",a("MENU.PAUSED")," ]"]}),!s.readOnlyMode&&(0,l.jsx)(N.K,{queue:s,actions:{...r,addJob:()=>c.open("addJob"),onConcurrency:()=>c.open("concurrency")}})]})]}),(0,l.jsx)(b,{queue:s}),(0,l.jsxs)(t.Suspense,{fallback:null,children:[c.isMounted("addJob")&&(0,l.jsx)(U,{open:c.isOpen("addJob"),onClose:c.close("addJob"),job:d,queue:s}),c.isMounted("concurrency")&&(0,l.jsx)(y,{open:c.isOpen("concurrency"),onClose:c.close("concurrency"),queue:s})]})]})};var B=a(40555);let z=[B.STATUSES.active,B.STATUSES.waiting,B.STATUSES.waitingChildren,B.STATUSES.prioritized,B.STATUSES.completed,B.STATUSES.failed,B.STATUSES.delayed,B.STATUSES.paused];var O=a(66960),f=a(25101);let M=e=>{let{children:s}=e,a=(0,O.I)().get("status"),t=z.map(e=>({status:e,to:S.y.dashboardPage(a===e?void 0:e),isActive:()=>a===e}));return(0,l.jsx)(f.p,{items:t,children:s})};var q=a(64771),_=a(10939),Q=a(40783);let D=()=>{let{t:e}=(0,i.Bd)(),{actions:s,queues:a}=(0,w.A)(),r=(0,O.I)(),{searchTerm:c}=(0,_.b)();s.pollQueues();let d=r.get("status"),n=c.toLowerCase(),{sortedQueues:o,onSort:u,sortKey:h,sortDirection:x}=function(e){let{sorting:{dashboard:{key:s,direction:a}},setSettings:l}=(0,Q.C)(e=>{let{setSettings:s,sorting:a}=e;return{sorting:a,setSettings:s}}),i=e.slice(0).sort((e,l)=>"alphabetical"===s?"asc"===a?e.displayName.localeCompare(l.displayName):l.displayName.localeCompare(e.displayName):"asc"===a?e.counts[s]-l.counts[s]:l.counts[s]-e.counts[s]),r=(0,t.useCallback)(e=>{l({sorting:{dashboard:{key:e,direction:e===s&&"asc"===a?"desc":"asc"}}})},[s,a]);return{sortedQueues:i,sortDirection:a,sortKey:s,onSort:r}}((null==a?void 0:a.filter(e=>(!d||e.counts[d]>0)&&(!c||e.name.toLowerCase().includes(n))))||[]);return(0,l.jsxs)("section",{children:[(0,l.jsx)(q.V,{actions:(0,l.jsx)(l.Fragment,{}),children:(0,l.jsx)(M,{children:(0,l.jsx)(m,{actions:s,queues:a,onSort:u,sortBy:h,sortDirection:x})})}),o.length>0?(0,l.jsx)("ul",{className:"overview-zcxjH0",children:o.map(e=>(0,l.jsx)("li",{children:(0,l.jsx)(L,{queue:e})},e.name))}):(0,l.jsx)("p",{className:"emptyState-GPHV7C",children:d?e("DASHBOARD.EMPTY_STATE_FILTERED",{status:d}):e("DASHBOARD.EMPTY_STATE")})]})}},38573(e,s,a){a.d(s,{C:()=>l});function l(e){return e.split("-").map((e,s)=>s>0?`${e[0].toUpperCase()}${e.slice(1)}`:e).join("")}}}]);