import{d as y,ey as g,ez as C,H as T,b as _,c as k,u as I}from"./outputWidgets.1cf78234.js";import{e as w,q as h}from"./icons.ba4d43de.js";import{a as x}from"./asyncComputed.513601fc.js";import"./router.4077f51e.js";import"./columns.301c6458.js";import{T as s}from"./tables.a7c4a20e.js";import{C as D}from"./CrudView.9f0a1020.js";import{n as i}from"./string.cd321add.js";import"./Title.a8b8fdd6.js";import"./index.748edabf.js";import"./gateway.39b6f9d7.js";import"./activeRecord.1ee4e98a.js";import"./pubsub.a66a61fd.js";import"./index.f4ac7424.js";import"./index.a7df5fa7.js";import"./Form.5fb25f40.js";import"./url.18ee0e18.js";import"./index.427c7dc5.js";import"./index.4f30f3fe.js";import"./index.960f4655.js";import"./index.7a53699a.js";import"./index.67188546.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]="08f91362-f5ec-4808-aadc-6e16048b6a07",a._sentryDebugIdIdentifier="sentry-dbid-08f91362-f5ec-4808-aadc-6e16048b6a07")}catch{}})();const Y=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{Y as default};
//# sourceMappingURL=Tables.ecd16719.js.map
