import{d as y,ey as g,ez as C,H as T,b as _,c as k,u as I}from"./outputWidgets.8a1294ac.js";import{e as w,q as h}from"./icons.25b21aee.js";import{a as x}from"./asyncComputed.3699cd44.js";import"./router.e765b2a2.js";import"./columns.a2ad5768.js";import{T as s}from"./tables.678d638a.js";import{C as D}from"./CrudView.707fb9d1.js";import{n as i}from"./string.e64b5e76.js";import"./Title.c5e29cf7.js";import"./index.04ab96ef.js";import"./gateway.ec720fac.js";import"./activeRecord.4f50a80e.js";import"./pubsub.5ff7800d.js";import"./index.f4ac7424.js";import"./index.21148e20.js";import"./Form.1860c0ed.js";import"./url.9a5c0e6d.js";import"./index.d5d7d1dc.js";import"./index.4fc6eb1b.js";import"./index.91683b65.js";import"./index.bf7f5369.js";import"./index.0f4f2049.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]="1fffb8d8-bcfb-42b4-a0f2-db7940361f52",a._sentryDebugIdIdentifier="sentry-dbid-1fffb8d8-bcfb-42b4-a0f2-db7940361f52")}catch{}})();const Y=y({__name:"Tables",setup(a){const o=g(),t=C().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}})},b=T(()=>{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:u}){o.push({name:"tableEditor",params:{tableId:u,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)=>(_(),k(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:f,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.aabfe698.js.map
