import{d as w,eA as _,ez as P,J as k,u as s,b as h,c as I,ew as C,cG as x}from"./outputWidgets.c072fe4e.js";import{e as z,b as D}from"./icons.158b4825.js";import{a as v}from"./asyncComputed.376cdc00.js";import{P as d}from"./project.5033d689.js";import"./console.a87f2a82.js";import{O as N}from"./organization.09bd66c1.js";import"./index.90440471.js";import{_ as O}from"./CrudView.vue_vue_type_script_setup_true_lang.9296340f.js";import{a as A}from"./ant-design.5cb2a38e.js";import"./gateway.18ca6e0a.js";import"./activeRecord.fdc25b97.js";import"./pubsub.98ad9fe0.js";import"./index.00103e26.js";import"./Form.9f52866c.js";import"./Title.e3dcb8ea.js";import"./CollapsePanel.ecfd8c73.js";import"./index.d808811c.js";import"./index.ec8e038a.js";import"./index.dce83dc7.js";import"./dayjs.a56ae918.js";import"./index.4e6af937.js";import"./index.8ab39784.js";import"./TabPane.df5f41ca.js";import"./index.c5fd7926.js";import"./index.148bcdd7.js";import"./index.d9c3e0de.js";import"./index.e5a5efcd.js";import"./index.e7c5574b.js";import"./index.96de14c0.js";import"./index.28ce0851.js";import"./index.2e3640f1.js";import"./index.4cff163b.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[a]="7f07b6e9-ecb5-414c-aacb-3b7acc35dec1",r._sentryDebugIdIdentifier="sentry-dbid-7f07b6e9-ecb5-414c-aacb-3b7acc35dec1")}catch{}})();const de=w({__name:"Projects",setup(r){const a=[{key:"name",label:"Project Name"}],n=_().params.organizationId,u=P(),{loading:f,result:i,refetch:b}=v(()=>Promise.all([d.list(n),N.get(n)]).then(([e,t])=>({projects:e,organization:t}))),m=({key:e})=>u.push({name:"project",params:{projectId:e}}),y=async e=>{const t=await d.create({organizationId:n,name:e.name});m({key:t.id})},g=async({key:e})=>{var o,p;if(await A("Are you sure you want to delete this project?"))try{await((p=(o=i.value)==null?void 0:o.projects.find(c=>c.id===e))==null?void 0:p.delete())}catch(c){x.error({message:"Error deleting project",description:String(c)})}finally{await b()}},j=k(()=>{var e,t;return{columns:[{name:"Id"},{name:"Project Name"},{name:"Actions",align:"right"}],rows:(t=(e=i.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:g,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>s(i)?(h(),I(O,{key:0,"entity-name":"project",loading:s(f),title:`${s(i).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:a,onCreate:y},null,8,["loading","title","table"])):C("",!0)}});export{de as default};
//# sourceMappingURL=Projects.eb73442a.js.map
