import{d as f,G as h,b as y,t as J,y as r,K as _}from"./registerWidgets.fff064a1.js";import{e as k,f as C,g}from"./icons.907f45d7.js";import{a as x}from"./CircularLoading.59d7fd3d.js";import{J as l}from"./jobs.af366134.js";import{R as w}from"./RuntimeList.106b52b7.js";import"./utils.3371dfe5.js";const D=f({__name:"Jobs",setup(j){const n=_(),{loading:c,result:i,refetch:s}=x(()=>l.list()),d=({key:e})=>n.push({path:`/_editor/job/${e}`}),u=async({key:e})=>{var o,t;await((t=(o=i.value)==null?void 0:o.find(a=>a.identifier===e))==null?void 0:t.duplicate()),s()},p=async()=>{const e=await l.create();n.push({path:`/_editor/job/${e.identifier}`})},m=async({key:e})=>{var o,t;confirm("Are you sure you want to delete this job?")&&(await((t=(o=i.value)==null?void 0:o.find(a=>a.identifier===e))==null?void 0:t.delete()),s())},b=h(()=>{var e,o;return{columns:[{name:"Job Name"},{name:"Path"},{name:"Job Actions"}],rows:(o=(e=i.value)==null?void 0:e.map(t=>({key:t.identifier,cells:[{text:t.title,classes:["title","centered"],link:`/_editor/job/${t.identifier}`},{text:t.identifier},{text:"",classes:["centered"],actions:[{icon:k,label:"Delete",onClick:m,dangerous:!0},{icon:C,label:"Edit Job",onClick:d},{icon:g,label:"Duplicate",onClick:u}]}]})))!=null?o:[]}});return(e,o)=>(y(),J(w,{loading:r(c),title:"Python Jobs",description:"Schedule Python scripts like events on a calendar","create-button-text":"Create Job","empty-title":"No jobs here yet",table:r(b),onCreate:p},null,8,["loading","table"]))}});export{D as default};
//# sourceMappingURL=Jobs.8e7fd096.js.map
