import{d as y,ey as g,ez as k,G as C,b as T,c as _,u as I}from"./outputWidgets.0fb707c7.js";import{e as w,k as h}from"./icons.24a85994.js";import{a as x}from"./asyncComputed.a0ca296c.js";import"./router.81de177d.js";import"./columns.37a1e6f7.js";import{T as s}from"./tables.54524732.js";import{C as D}from"./CrudView.e365e55f.js";import{n as i}from"./string.90423849.js";import"./Form.0dcb97c0.js";import"./Title.f00a58f9.js";import"./transButton.220177fb.js";import"./Text.3ec0a64d.js";import"./index.140c5bc8.js";import"./gateway.7ee47e62.js";import"./activeRecord.204186f3.js";import"./pubsub.7d8bce56.js";import"./index.cf4c23b9.js";import"./url.d43b75f5.js";import"./index.85d2f01b.js";import"./index.8dbf2994.js";import"./index.0d3d2205.js";import"./index.e8ef1073.js";import"./index.a2e845fd.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]="5e5aa092-7d29-4ade-a978-29622ecec899",a._sentryDebugIdIdentifier="sentry-dbid-5e5aa092-7d29-4ade-a978-29622ecec899")}catch{}})();const Z=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:f}){o.push({name:"tableEditor",params:{tableId:f,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),c()}}]}]})))!=null?r:[]}}),b=[{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:b,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.7c2466e0.js.map
