import{d as w,eA as _,ez as P,J as k,u as c,b as h,c as I,ew as C,cG as x}from"./outputWidgets.17392370.js";import{e as z,b as D}from"./icons.baa5f07a.js";import{a as v}from"./asyncComputed.76849272.js";import{P as p}from"./project.3f54ada6.js";import"./console.9b12928f.js";import{O as N}from"./organization.33951447.js";import"./index.c5e8e3a4.js";import{_ as O}from"./CrudView.vue_vue_type_script_setup_true_lang.c4e89a02.js";import{a as A}from"./ant-design.9c3ff8a2.js";import"./gateway.ee06b706.js";import"./activeRecord.84b679f6.js";import"./pubsub.fc739490.js";import"./index.7c30bb7a.js";import"./Form.e398e550.js";import"./Title.bc3ff086.js";import"./CollapsePanel.853dbd0d.js";import"./index.2e2d3a0a.js";import"./index.ba0ff767.js";import"./index.84380f11.js";import"./dayjs.05e1ae11.js";import"./index.56ff0f0c.js";import"./index.bd94f307.js";import"./TabPane.25e9ccd4.js";import"./index.8aa7fba2.js";import"./index.50017ce4.js";import"./index.fffd13c2.js";import"./index.d2f4083e.js";import"./index.1fd97730.js";import"./index.3e3b85af.js";import"./index.18880d1b.js";import"./index.8c91651f.js";import"./index.8d8985c7.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]="6debd738-dc2a-4335-8167-e7bfd361814f",r._sentryDebugIdIdentifier="sentry-dbid-6debd738-dc2a-4335-8167-e7bfd361814f")}catch{}})();const pe=w({__name:"Projects",setup(r){const i=[{key:"name",label:"Project Name"}],n=_().params.organizationId,u=P(),{loading:f,result:a,refetch:y}=v(()=>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}}),g=async e=>{const t=await p.create({organizationId:n,name:e.name});m({key:t.id})},b=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=k(()=>{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:z,label:"Edit Project",onClick:m},{icon:D,label:"Delete",onClick:b,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>c(a)?(h(),I(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:g},null,8,["loading","title","table"])):C("",!0)}});export{pe as default};
//# sourceMappingURL=Projects.e421f036.js.map
