import{d as y,ey as g,ez as C,H as T,b as _,c as k,u as I}from"./outputWidgets.8be138ba.js";import{e as w,q as h}from"./icons.35976e57.js";import{a as x}from"./asyncComputed.96c9ad3b.js";import"./router.bb47648a.js";import"./columns.5510282a.js";import{T as s}from"./tables.e9ffd6d6.js";import{C as D}from"./CrudView.cfa43f1a.js";import{n as i}from"./string.2d6559bb.js";import"./Title.12e8916a.js";import"./index.0df733bd.js";import"./gateway.93fa1934.js";import"./activeRecord.f6cce158.js";import"./pubsub.e324f67c.js";import"./index.f4ac7424.js";import"./index.98827a3d.js";import"./Form.7b75db7b.js";import"./url.ebe1e528.js";import"./index.3ef3e2d2.js";import"./index.bc7e7ec9.js";import"./index.d11a75f6.js";import"./index.568a8efe.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]="a5011479-c605-409e-85ac-bae271cff882",a._sentryDebugIdIdentifier="sentry-dbid-a5011479-c605-409e-85ac-bae271cff882")}catch{}})();const X=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{X as default};
//# sourceMappingURL=Tables.03416d34.js.map
