import{d as y,ey as g,ez as k,H as C,b as T,c as _,u as I}from"./outputWidgets.d6334d0e.js";import{e as w,k as h}from"./icons.09e1f108.js";import{a as x}from"./asyncComputed.95fd0999.js";import"./router.c9839d0e.js";import"./columns.6b92da60.js";import{T as s}from"./tables.fb272f9c.js";import{C as D}from"./CrudView.a040df87.js";import{n as i}from"./string.cb6de819.js";import"./Form.afe8a620.js";import"./Title.132c3f7f.js";import"./transButton.97ae4a5a.js";import"./Text.2f6a30da.js";import"./index.85dd1fea.js";import"./gateway.78108c4a.js";import"./activeRecord.aa738a85.js";import"./pubsub.9d7d329e.js";import"./index.f4ac7424.js";import"./url.dce42ecb.js";import"./index.9476b093.js";import"./index.e0fb68fa.js";import"./index.98d66b02.js";import"./index.2221e01c.js";import"./index.6da051f8.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]="4a7da558-2db1-4f04-92d7-a2a725281b81",a._sentryDebugIdIdentifier="sentry-dbid-4a7da558-2db1-4f04-92d7-a2a725281b81")}catch{}})();const Z=y({__name:"Tables",setup(a){const o=g(),t=k().params.projectId,{loading:m,result:d,refetch:p}=x(()=>s.list(t)),c=async e=>{const r=await s.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},b=C(()=>{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:f}){o.push({name:"tableEditor",params:{tableId:f,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),p()}}]}]})))!=null?r:[]}}),u=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(T(),_(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:u,"create-button-text":"Create Table",onCreate:c},null,8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.9d73f6df.js.map
