import{d as w,eB as P,eA as k,G as C,u as c,b as _,c as h,ex as I,cw as x}from"./outputWidgets.32262ea4.js";import{v,C as z}from"./icons.f6f8ddd9.js";import{a as D}from"./asyncComputed.2515c9c2.js";import"./authorManager.bf87d9ac.js";import"./index.2dfe4d35.js";import{P as p}from"./project.9d2c85ac.js";import{O as N}from"./organization.f1af1618.js";import{C as O}from"./CrudView.3a879739.js";import{a as A}from"./ant-design.295985b3.js";import"./index.cf4c23b9.js";import"./record.b25fae92.js";import"./pubsub.688bf9b2.js";import"./gateway.c70bbf22.js";import"./Text.5738d3bb.js";import"./Title.4f1fbb5b.js";import"./FormItem.dc863e60.js";import"./hasIn.4e5c4024.js";import"./Form.0ac7561e.js";import"./Modal.1c897574.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.db135e16.js";import"./router.24325fd4.js";import"./index.1d7a7a89.js";import"./url.bc186fa2.js";import"./index.e1a424df.js";import"./index.62cf3b9c.js";import"./index.0278a234.js";import"./index.df3792d3.js";import"./index.c9aa3d70.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[i]="468eb3fc-0849-49b2-a0c6-7b304e5335e6",r._sentryDebugIdIdentifier="sentry-dbid-468eb3fc-0849-49b2-a0c6-7b304e5335e6")}catch{}})();const se=w({__name:"Projects",setup(r){const i=[{key:"name",label:"Project Name"}],n=P().params.organizationId,u=k(),{loading:f,result:a,refetch:y}=D(()=>Promise.all([p.list(n),N.get(n)]).then(([e,t])=>({projects:e,organization:t}))),m=({key:e})=>u.push({name:"project",params:{projectId:e}}),b=async e=>{const t=await p.create({organizationId:n,name:e.name});m({key:t.id})},g=async({key:e})=>{var o,d;if(await A("Are you sure you want to delete this project?"))try{await((d=(o=a.value)==null?void 0:o.projects.find(s=>s.id===e))==null?void 0:d.delete())}catch(s){x.error({message:"Error deleting project",description:String(s)})}finally{await y()}},j=C(()=>{var e,t;return{columns:[{name:"Id"},{name:"Project Name"},{name:"Actions",align:"right"}],rows:(t=(e=a.value)==null?void 0:e.projects.map(o=>({key:o.id,cells:[{text:o.id.slice(0,8)},{text:o.name,link:`/projects/${encodeURIComponent(o.id)}`},{text:"",actions:[{icon:v,label:"Edit Project",onClick:m},{icon:z,label:"Delete",onClick:g,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>c(a)?(_(),h(O,{key:0,"entity-name":"project",loading:c(f),title:`${c(a).organization.name}'s Projects`,description:"Organize your team's work into different Projects, each with it's own subdomain.","create-button-text":"Create Project","empty-title":"No projects here yet",table:j.value,fields:i,onCreate:b},null,8,["loading","title","table"])):I("",!0)}});export{se as default};
//# sourceMappingURL=Projects.970c7b78.js.map
