import{d as P,K as y,b as h,t as k,z as i,J as C,H as b}from"./registerWidgets.69eb7b40.js";import{f as g,g as _,h as w}from"./icons.ea1ef9e9.js";import{a as x}from"./asyncComputed.5c8fd07f.js";import{P as l}from"./project.73d49dff.js";import"./utils.7963b0ba.js";import{C as v}from"./CrudView.bd7bc0f9.js";import"./passwordlessManager.3c745f80.js";import"./pubsub.a0411919.js";import"./DropdownMenu.1fde8cc7.js";import"./CircularLoading.3c5929bd.js";import"./Modal.bf2e2708.js";const S=P({__name:"Projects",setup(I){const r=C().params.organizationId,m=b(),{loading:d,result:a,refetch:c}=x(()=>l.list(r)),s=({key:e})=>m.push({name:"project",params:{projectId:e}}),p=async({key:e})=>{var t,o;await((o=(t=a.value)==null?void 0:t.find(n=>n.id===e))==null?void 0:o.duplicate()),c()},u=async e=>{const t=await l.create({organizationId:r,name:e.name});s({key:t.id})},j=async({key:e})=>{var t,o;confirm("Are you sure you want to delete this project?")&&(await((o=(t=a.value)==null?void 0:t.find(n=>n.id===e))==null?void 0:o.delete()),c())},f=y(()=>{var e,t;return{columns:[{name:"Project Name"},{name:"Path"},{name:"Project Actions"}],rows:(t=(e=a.value)==null?void 0:e.map(o=>({key:o.id,cells:[{text:o.name,classes:["title","centered"],link:`/projects/${encodeURIComponent(o.id)}`},{text:o.id},{text:"",classes:["centered"],actions:[{icon:g,label:"Delete",onClick:j,dangerous:!0},{icon:_,label:"Edit Project",onClick:s},{icon:w,label:"Duplicate",onClick:p}]}]})))!=null?t:[]}});return(e,t)=>(h(),k(v,{"entity-name":"project","ask-name-on-create":!0,loading:i(d),title:"Python Projects",description:"Schedule Python scripts like events on a calendar","create-button-text":"Create Project","empty-title":"No projects here yet",table:i(f),onCreate:u},null,8,["loading","table"]))}});export{S as default};
//# sourceMappingURL=Projects.f45d8b1c.js.map
