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.b43a489b.js";import{e as z,b as D}from"./icons.de9af46a.js";import{a as v}from"./asyncComputed.a42e75bb.js";import{P as d}from"./project.289e17e1.js";import"./console.bbd86620.js";import{O as N}from"./organization.9d0e88fc.js";import"./index.d989c562.js";import{_ as O}from"./CrudView.vue_vue_type_script_setup_true_lang.85d5e2a7.js";import{a as A}from"./ant-design.dc7acb1e.js";import"./gateway.38461683.js";import"./activeRecord.2bc5cc59.js";import"./pubsub.6fd47a9d.js";import"./index.42b92ee8.js";import"./Form.1797df89.js";import"./Title.47040052.js";import"./CollapsePanel.3e5384f9.js";import"./index.523f4a12.js";import"./index.65dea612.js";import"./index.9c88be1a.js";import"./dayjs.caeff4fe.js";import"./index.0279b5ff.js";import"./index.956893d2.js";import"./TabPane.b49c19a0.js";import"./index.0887e3a5.js";import"./index.a775b9cf.js";import"./index.e641ddba.js";import"./index.479accfd.js";import"./index.9367a16c.js";import"./index.8df4e710.js";import"./index.2fc0be8f.js";import"./index.8a60ee51.js";import"./index.85f24c29.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]="99688e0f-29c2-4bc5-a531-86c336aed3ac",r._sentryDebugIdIdentifier="sentry-dbid-99688e0f-29c2-4bc5-a531-86c336aed3ac")}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:y}=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}}),g=async e=>{const t=await d.create({organizationId:n,name:e.name});m({key:t.id})},b=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(s=>s.id===e))==null?void 0:p.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=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:b,dangerous:!0}]}]})))!=null?t:[]}});return(e,t)=>c(i)?(h(),I(O,{key:0,"entity-name":"project",loading:c(f),title:`${c(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:g},null,8,["loading","title","table"])):C("",!0)}});export{de as default};
//# sourceMappingURL=Projects.84335d30.js.map
