import{d as y,ey as g,ez as k,H as C,b as T,c as _,u as I}from"./outputWidgets.a8447bcb.js";import{e as w,k as h}from"./icons.6de7af10.js";import{a as x}from"./asyncComputed.6c2627ea.js";import"./router.8be149da.js";import"./columns.79610386.js";import{T as s}from"./tables.aa6ae4db.js";import{C as D}from"./CrudView.996cd8b2.js";import{n as i}from"./string.763f9f5d.js";import"./Form.a869b3cf.js";import"./Title.4127a4b4.js";import"./transButton.26020e2e.js";import"./Text.722e2789.js";import"./index.41d49230.js";import"./gateway.9d217caa.js";import"./activeRecord.52c1b6f8.js";import"./pubsub.3b516de1.js";import"./index.f4ac7424.js";import"./url.0a1547fb.js";import"./index.ee9a096e.js";import"./index.c058ebd2.js";import"./index.823e1eed.js";import"./index.71f713cd.js";import"./index.5fa32c06.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]="b067f2d9-bb0c-4e38-a847-41e323fddf13",a._sentryDebugIdIdentifier="sentry-dbid-b067f2d9-bb0c-4e38-a847-41e323fddf13")}catch{}})();const Z=y({__name:"Tables",setup(a){const o=g(),t=k().params.projectId,{loading:m,result:d,refetch:c}=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}})},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),c()}}]}]})))!=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:p},null,8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.acf4c9ba.js.map
