import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.0ed3a637.js";import{e as w,i as h}from"./icons.8d5441dc.js";import{a as x}from"./asyncComputed.054ae312.js";import"./router.d8af0f7d.js";import"./columns.15b333c9.js";import{T as s}from"./tables.8e5779c7.js";import{C as D}from"./CrudView.931c84f7.js";import{n as i}from"./string.c66112fe.js";import"./Base.69739fb7.js";import"./transButton.3ca23b61.js";import"./Text.e89a9af1.js";import"./Title.53f943d2.js";import"./index.230ffe19.js";import"./gateway.678b6185.js";import"./activeRecord.e0ef2424.js";import"./pubsub.5dd4605f.js";import"./url.4f7be002.js";import"./index.0f5ee3e7.js";import"./index.feaa4503.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]="2c464e21-cc01-4b58-8857-1e3dff328ff0",a._sentryDebugIdIdentifier="sentry-dbid-2c464e21-cc01-4b58-8857-1e3dff328ff0")}catch{}})();const U=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:b}){o.push({name:"tableEditor",params:{tableId:b,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),d()}}]}]})))!=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:u.value,fields:f,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.d68f2fc0.js.map
