1import{Q as D,Y as E,o as R,h as T,i as a,a1 as U,v as o,U as i,s as d,a as m,d as w,p as B,A as v,t as f,e as M,f as A,j as I}from"./vendor-vue-Ns5D07Xf.js";import{F as L,G as j,H as k}from"./platform-LXVgOIQk.js";import{u as z,f as p,E as F,o as H,F as c,a7 as O,j as C,d as G}from"./vendor-primevue-CDtTrPAe.js";import{_ as Q}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-Ckj6hzUu.js";const W={class:"page-container p-6 lg:p-10 animate-slide-up"},Y={class:"page-header items-end mb-10"},q={class:"page-header-actions"},K={class:"view-card shadow-premium border-none"},X={class:"flex flex-col"},Z={class:"flex items-center gap-2"},P={class:"flex items-center gap-2"},ee={class:"font-mono text-xs"},ae={class:"font-mono text-xs font-bold"},te={class:"p-fluid"},se={class:"field mb-4"},ie={class:"p-2 border rounded bg-gray-50"},le={class:"field mb-4"},oe=D({__name:"SystemJobsView",setup(de){const{t:l}=E(),n=z(),x=m([]),y=m(!0),u=m(!1),r=m({}),b=m(!1),g=async()=>{y.value=!0;try{x.value=await L()}catch{n.add({severity:"error",summary:l("common.error"),detail:l("platform.failedLoadSystemJobs"),life:3e3})}finally{y.value=!1}};R(g);const _=s=>{if(!s)return"Never";try{return new Date(s).toLocaleString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return s}},J=async s=>{try{await j(s.id),n.add({severity:"success",summary:l("platform.triggered"),detail:l("platform.jobStartedInBackground",{name:s.name}),life:3e3}),setTimeout(g,2500)}catch{n.add({severity:"error",summary:l("common.error"),detail:l("platform.failedTriggerJob"),life:3e3})}},S=async s=>{try{await k(s.id,{is_active:!s.is_active}),s.is_active=!s.is_active,n.add({severity:"success",summary:l("common.updated"),detail:l("platform.jobToggled",{name:s.name,state:s.is_active?l("platform.enabled"):l("platform.disabled")}),life:3e3})}catch{n.add({severity:"error",summary:l("common.error"),detail:l("platform.failedUpdateJobStatus"),life:3e3})}},N=s=>{r.value={...s},u.value=!0},V=async()=>{if(r.value.id){b.value=!0;try{await k(r.value.id,{schedule_cron:r.value.schedule_cron}),n.add({severity:"success",summary:l("common.saved"),detail:l("platform.jobScheduleUpdated"),life:3e3}),u.value=!1,g()}catch{n.add({severity:"error",summary:l("common.error"),detail:l("platform.failedSaveJobChanges"),life:3e3})}finally{b.value=!1}}};return(s,t)=>{const $=I("tooltip");return w(),T("div",W,[a("div",Y,[t[3]||(t[3]=U('<div class="page-header-left" data-v-f024530f><div class="flex items-center gap-3 mb-2" data-v-f024530f><div class="w-12 h-12 rounded-2xl bg-indigo-500/10 flex items-center justify-center text-indigo-500 shadow-sm border border-indigo-500/20" data-v-f024530f><i class="pi pi-clock text-2xl" data-v-f024530f></i></div><div data-v-f024530f><h1 class="page-title !mb-0 text-3xl font-black" data-v-f024530f> Cron Tasks & Jobs </h1><p class="page-subtitle text-lg" data-v-f024530f> Manage automated background tasks across the platform </p></div></div></div>',1)),a("div",q,[o(i(p),{label:"Refresh",icon:"pi pi-refresh",class:"p-button-lg shadow-premium",loading:y.value,onClick:g},null,8,["loading"])])]),a("div",K,[o(i(F),{value:x.value,loading:y.value,stripedRows:"",class:"custom-table",tableStyle:"min-width: 60rem"},{empty:d(()=>[...t[6]||(t[6]=[a("div",{class:"p-8 text-center text-gray-500"},[a("i",{class:"pi pi-clock text-4xl mb-4 opacity-50"}),a("p",null,"No background jobs configured.")],-1)])]),default:d(()=>[o(i(c),{header:"",style:{width:"4rem"}},{body:d(e=>[B(o(i(O),{modelValue:e.data.is_active,onChange:h=>S(e.data)},null,8,["modelValue","onChange"]),[[$,e.data.is_active?"Disable Job":"Enable Job",void 0,{top:!0}]])]),_:1}),o(i(c),{field:"name",header:"Job Configuration",style:{width:"25%"}},{body:d(e=>[a("div",X,[a("span",{class:v(["font-bold text-base text-gray-900 dark:text-gray-0",{"opacity-50":!e.data.is_active}])},f(e.data.name),3),a("span",{class:v(["text-xs text-gray-500 line-clamp-1 max-w-[300px]",{"opacity-50":!e.data.is_active}])},f(e.data.description),3)])]),_:1}),o(i(c),{field:"schedule_cron",header:"Schedule (CRON)"},{body:d(e=>[a("div",Z,[o(i(C),{value:e.data.schedule_cron,severity:"secondary",class:v(["font-mono text-xs px-3 shadow-inner",{"opacity-50":!e.data.is_active}])},null,8,["value","class"]),o(i(p),{icon:"pi pi-pencil",text:"",rounded:"",severity:"secondary",onClick:h=>N(e.data),class:"!w-6 !h-6"},null,8,["onClick"])])]),_:1}),o(i(c),{field:"last_run",header:"Last Run"},{body:d(e=>[a("div",{class:v(["flex flex-col gap-1 text-sm",{"opacity-50":!e.data.is_active}])},[a("div",P,[t[4]||(t[4]=a("i",{class:"pi pi-history text-gray-400"},null,-1)),a("span",ee,f(_(e.data.last_run)),1)]),e.data.last_status?(w(),M(i(C),{key:0,value:e.data.last_status,severity:e.data.last_status==="success"?"success":"danger",class:"!text-[10px] w-min"},null,8,["value","severity"])):A("",!0)],2)]),_:1}),o(i(c),{field:"next_run",header:"Next Expected Run"},{body:d(e=>[a("div",{class:v(["flex items-center gap-2 text-sm",{"opacity-50":!e.data.is_active}])},[t[5]||(t[5]=a("i",{class:"pi pi-calendar text-primary"},null,-1)),a("span",ae,f(_(e.data.next_run)),1)],2)]),_:1}),o(i(c),{class:"text-right"},{body:d(e=>[o(i(p),{label:"Run Now",icon:"pi pi-play",size:"small",class:"shadow-sm font-bold",severity:e.data.is_active?"info":"secondary",disabled:!e.data.is_active,onClick:h=>J(e.data)},null,8,["severity","disabled","onClick"])]),_:1})]),_:1},8,["value","loading"])]),o(i(H),{visible:u.value,"onUpdate:visible":t[2]||(t[2]=e=>u.value=e),header:"Edit System Job",modal:!0,style:{width:"450px"}},{footer:d(()=>[o(i(p),{label:"Cancel",icon:"pi pi-times",onClick:t[1]||(t[1]=e=>u.value=!1),class:"p-button-text"}),o(i(p),{label:"Save Changes",icon:"pi pi-check",onClick:V,loading:b.value},null,8,["loading"])]),default:d(()=>[a("div",te,[a("div",se,[t[7]||(t[7]=a("label",{class:"font-bold"},"Job Name",-1)),a("div",ie,f(r.value.name),1)]),a("div",le,[t[8]||(t[8]=a("label",{for:"cron",class:"font-bold"},"CRON Expression",-1)),o(i(G),{id:"cron",modelValue:r.value.schedule_cron,"onUpdate:modelValue":t[0]||(t[0]=e=>r.value.schedule_cron=e),class:"font-mono text-center tracking-widest text-lg",placeholder:"* * * * *"},null,8,["modelValue"]),t[9]||(t[9]=a("small",{class:"text-gray-500 mt-2 block"},' E.g., "0 2 * * *" means "At 02:00 everyday". Minute, Hour, Day, Month, Weekday. ',-1))])])]),_:1},8,["visible"])])}}}),ve=Q(oe,[["__scopeId","data-v-f024530f"]]);export{ve 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.