import{d as y,ey as g,ez as k,H as C,b as T,c as _,u as I}from"./outputWidgets.a4629ff8.js";import{e as w,k as h}from"./icons.73bff2ab.js";import{a as x}from"./asyncComputed.fb8b9ba6.js";import"./router.ab2ac3ba.js";import"./columns.464a3bb5.js";import{T as s}from"./tables.d2398156.js";import{C as D}from"./CrudView.a5b1a4eb.js";import{n as i}from"./string.0031a572.js";import"./Title.cf2a531e.js";import"./index.339c7421.js";import"./gateway.68939de7.js";import"./activeRecord.a2b7d343.js";import"./pubsub.25dc8c41.js";import"./index.f4ac7424.js";import"./Text.eb216708.js";import"./Form.ab59726f.js";import"./url.d6a620b9.js";import"./index.874565bb.js";import"./index.48817ebe.js";import"./index.0f6dde5f.js";import"./index.46db6cb2.js";import"./index.56cfba6d.js";import"./index.fda4c602.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]="fcb72006-8f2a-4e40-a6ba-910e12bc7e19",a._sentryDebugIdIdentifier="sentry-dbid-fcb72006-8f2a-4e40-a6ba-910e12bc7e19")}catch{}})();const Z=y({__name:"Tables",setup(a){const o=g(),t=k().params.projectId,{loading:m,result:c,refetch:d}=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}})},b=C(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"Actions",align:"right"}],rows:(r=(e=c.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:f}){o.push({name:"tableEditor",params:{tableId:f,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),d()}}]}]})))!=null?r:[]}}),u=[{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:b.value,fields:u,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.2ca5e695.js.map
