import{d as y,eA as g,eB as k,G as C,b as T,c as _,u as I}from"./outputWidgets.562826ac.js";import{e as w,k as h}from"./icons.63405824.js";import{a as x}from"./asyncComputed.df2d9552.js";import"./router.e5ce2c0b.js";import"./columns.29d297cf.js";import{T as s}from"./tables.ccef5d0e.js";import{C as D}from"./CrudView.6f7097f4.js";import{n as i}from"./string.a3af832b.js";import"./Base.bf8dc0b1.js";import"./FormItem.fc4e7da8.js";import"./transButton.17480f27.js";import"./Text.712cfc26.js";import"./Title.f7aaa881.js";import"./index.82606edc.js";import"./gateway.c80b0686.js";import"./activeRecord.6bb1bd7f.js";import"./pubsub.7185b91b.js";import"./index.cf4c23b9.js";import"./url.5a1383d2.js";import"./index.01bf1f2c.js";import"./index.583cd440.js";import"./index.9cdd1b35.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[o]="d3e3ddad-e30f-4e1a-86f8-e4ef8cef8796",a._sentryDebugIdIdentifier="sentry-dbid-d3e3ddad-e30f-4e1a-86f8-e4ef8cef8796")}catch{}})();const Y=y({__name:"Tables",setup(a){const o=g(),t=k().params.projectId,{loading:m,result:d,refetch:c}=x(()=>s.list(t)),p=async e=>{const r=await s.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},u=C(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"Actions",align:"right"}],rows:(r=(e=d.value)==null?void 0:e.map(n=>({key:n.id,cells:[{text:n.name,link:{name:"tableEditor",params:{tableId:n.id,projectId:t}}},{text:"Actions",actions:[{icon:w,label:"Edit Table",onClick({key:b}){o.push({name:"tableEditor",params:{tableId:b,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),c()}}]}]})))!=null?r:[]}}),f=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(T(),_(D,{"entity-name":"table",loading:I(m),title:"Database Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:u.value,fields:f,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.d0a23af0.js.map
