1import{e as U,f as F,g as P,h as R,o as r,c as m,a as e,b as p,i as t,j as S,F as w,r as C,t as l,n as V,w as v,k as I,l as L,m as O,p as d,q as Q}from"./CkpukmhO.js";import{_ as A}from"./DuTdilBw.js";import{_ as X}from"./BsA0vqU1.js";import{_ as G}from"./dk8CUGDj.js";import{u as H}from"./DulI2fsf.js";import"./DUgR6Z00.js";import"./Bm4_zX6v.js";const W={class:"px-4 md:px-8 py-6"},Y={class:"flex items-center justify-between mb-6"},Z={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6"},ee={class:"flex items-center justify-between mb-3"},te={class:"text-sm font-bold text-gray-900 capitalize"},se={class:"flex items-center gap-1"},ae=["onClick"],oe={class:"grid grid-cols-5 gap-2 text-center"},ne={class:"text-lg font-bold text-gray-900"},ie={class:"text-[9px] uppercase text-gray-400"},le={class:"bg-white rounded-xl border border-gray-200 overflow-hidden"},ce={class:"px-4 py-3 border-b border-gray-100 flex items-center gap-2"},re={class:"text-sm font-semibold text-gray-700 capitalize"},de={class:"text-xs text-gray-500"},ue=["onClick"],me={class:"flex items-center gap-1"},pe={class:"p-4"},_e={class:"bg-gray-50 rounded-lg p-3 text-xs text-gray-700 overflow-auto max-h-96"},$e=U({__name:"queues",async setup(fe){let _,$;const k=["waiting","active","completed","failed","delayed"],q=["failed","waiting","active","delayed","completed"],o=d("flows"),u=d({flows:"failed",sms:"failed",campaigns:"failed"}),j=d(null),f=d(!1),z=[{accessorKey:"id",header:"Job ID"},{accessorKey:"name",header:"Name"},{accessorKey:"timestamp",header:"Created"},{accessorKey:"attemptsMade",header:"Attempts"},{accessorKey:"failedReason",header:"Error"},{accessorKey:"data",header:"Data"},{accessorKey:"actions",header:""}],{data:B,pending:K,refresh:g}=([_,$]=F(()=>H("/api/admin/queues",{_initialData:{}},"$X7jztfXRsB")),_=await _,$(),_),D=Q(()=>B.value??{}),h=d([]),b=d(!1);async function x(n){o.value=n,b.value=!0;try{const c=await $fetch(`/api/admin/queues/${n}/jobs`,{params:{status:u.value[n]??"failed"}});h.value=c.jobs??[]}catch{h.value=[]}finally{b.value=!1}}async function J(n){try{await $fetch(`/api/admin/queues/${o.value}/jobs/${n}`,{method:"POST"}),await Promise.all([g(),x(o.value)])}catch{}}async function M(n){if(confirm("Remove this job?"))try{await $fetch(`/api/admin/queues/${o.value}/jobs/${n}`,{method:"DELETE"}),await Promise.all([g(),x(o.value)])}catch{}}return P(()=>x("flows")),R(g,3e3),(n,c)=>{const y=S,E=A,N=X,T=G;return r(),m("div",W,[e("div",Y,[c[1]||(c[1]=e("div",null,[e("h2",{class:"text-xl font-bold text-gray-900"},"Queue Monitor"),e("p",{class:"text-xs text-gray-400 mt-0.5"},"Interactive BullMQ queue overview")],-1)),p(y,{size:"sm",color:"neutral",variant:"outline",icon:"i-lucide-refresh-cw",loading:t(K),onClick:t(g)},null,8,["loading","onClick"])]),e("div",Z,[(r(!0),m(w,null,C(t(D),(s,i)=>(r(),m("div",{key:i,class:"bg-white rounded-xl border border-gray-200 p-4"},[e("div",ee,[e("h3",te,l(i),1),e("div",se,[(r(),m(w,null,C(q,a=>e("button",{key:a,class:V(["text-[10px] px-2 py-0.5 rounded-md font-medium transition-colors",t(u)[i]===a?"bg-green-100 text-green-700":"text-gray-400 hover:text-gray-600"]),onClick:ge=>{t(u)[i]=a,x(i)}},l(a)+" ("+l(s[a]??0)+") ",11,ae)),64))])]),e("div",oe,[(r(),m(w,null,C(k,a=>e("div",{key:a,class:"bg-gray-50 rounded-lg p-2"},[e("p",ne,l(s[a]??0),1),e("p",ie,l(a),1)])),64))])]))),128))]),e("div",le,[e("div",ce,[e("span",re,l(t(o))+" jobs",1),p(E,{label:t(u)[t(o)],variant:"subtle",size:"xs"},null,8,["label"])]),p(N,{data:t(h),columns:z,loading:t(b)},{"timestamp-cell":v(({row:s})=>[e("span",de,l(s.original.timestamp?new Date(s.original.timestamp).toLocaleString():"-"),1)]),"data-cell":v(({row:s})=>[e("button",{class:"text-xs text-green-600 hover:text-green-700 font-medium",onClick:i=>{j.value=s.original,f.value=!0}}," View data ",8,ue)]),"actions-cell":v(({row:s})=>[e("div",me,[t(u)[t(o)]==="failed"?(r(),I(y,{key:0,size:"2xs",color:"neutral",variant:"outline",icon:"i-lucide-rotate-ccw",onClick:i=>J(s.original.id)},null,8,["onClick"])):L("",!0),p(y,{size:"2xs",color:"error",variant:"outline",icon:"i-lucide-trash-2",onClick:i=>M(s.original.id)},null,8,["onClick"])])]),_:1},8,["data","loading"])]),p(T,{open:t(f),"onUpdate:open":c[0]||(c[0]=s=>O(f)?f.value=s:null),title:"Job Data"},{default:v(()=>[e("div",pe,[e("pre",_e,l(JSON.stringify(t(j),null,2)),1)])]),_:1},8,["open"])])}}});
1export{$e as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.