import{d as w,eA as _,ez as P,J as k,u as c,b as h,c as I,ew as C,cL as x}from"./outputWidgets.75a5b0b9.js";import{e as z,b as D}from"./icons.c04528be.js";import{a as v}from"./asyncComputed.c701d7b0.js";import{P as d}from"./project.f661f5a0.js";import"./console.3fb52eaf.js";import{O as N}from"./organization.98baeec7.js";import"./index.a131125e.js";import{_ as O}from"./CrudView.vue_vue_type_script_setup_true_lang.ff628288.js";import{a as A}from"./ant-design.7c6678de.js";import"./gateway.99e43695.js";import"./activeRecord.115270b9.js";import"./pubsub.3fa240d3.js";import"./index.a1ee75ca.js";import"./Form.2c716183.js";import"./Title.b6c9692d.js";import"./index.b50eb903.js";import"./index.4598445f.js";import"./index.b6767512.js";import"./dayjs.d3366d83.js";import"./index.e24c456b.js";import"./index.7aacb57f.js";import"./TabPane.0d7849ee.js";import"./index.e9ba5796.js";import"./CollapsePanel.46ee4c6b.js";import"./index.3916405f.js";import"./index.5a67eb5f.js";import"./index.fe803cdf.js";import"./index.5e9c5434.js";import"./index.00d295c9.js";import"./index.fc88890c.js";import"./index.9c0809a0.js";import"./index.49e953af.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]="2e1465d7-cee6-4874-bb48-0277de86a652",r._sentryDebugIdIdentifier="sentry-dbid-2e1465d7-cee6-4874-bb48-0277de86a652")}catch{}})();const de=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([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=a.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=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{de as default};
//# sourceMappingURL=Projects.84163d14.js.map
