import{d as y,ez as g,eA as C,J as T,b as _,c as k,u as I}from"./outputWidgets.d94fff8c.js";import{e as w,q as h}from"./icons.fec42461.js";import{a as x}from"./asyncComputed.6da48dd7.js";import"./router.4a188c48.js";import"./index.a5166b6d.js";import{T as s}from"./tables.b7adb93e.js";import{C as D}from"./CrudView.e6c5592c.js";import{n as i}from"./string.5dafdc8d.js";import"./Title.c70c7e79.js";import"./index.3dad0da1.js";import"./gateway.8dd534ee.js";import"./activeRecord.4bb9e983.js";import"./pubsub.39314a92.js";import"./index.7d7e00b1.js";import"./Form.57801503.js";import"./url.596d80c9.js";import"./index.e7f021ad.js";import"./index.3709b59d.js";import"./index.0f14f01f.js";import"./index.209f6c1c.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]="f8f24013-4c89-42d7-8990-3a546ea9ce8c",a._sentryDebugIdIdentifier="sentry-dbid-f8f24013-4c89-42d7-8990-3a546ea9ce8c")}catch{}})();const W=y({__name:"Tables",setup(a){const o=g(),t=C().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}})},u=T(()=>{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:[]}}),b=[{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:u.value,fields:b,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.0f6493be.js.map
