import{d as y,ey as g,ez as k,G as C,b as T,c as _,u as I}from"./outputWidgets.24bc53e6.js";import{e as w,k as h}from"./icons.346b8028.js";import{a as x}from"./asyncComputed.e4b96939.js";import"./router.5678fba5.js";import"./columns.29187485.js";import{T as s}from"./tables.a47daeee.js";import{C as D}from"./CrudView.acebed42.js";import{n as i}from"./string.82912661.js";import"./Form.026abd8d.js";import"./Title.d959e45a.js";import"./transButton.082aab94.js";import"./Text.9efc0467.js";import"./index.bf56aca1.js";import"./gateway.c4f59e31.js";import"./activeRecord.7f48ce0d.js";import"./pubsub.6b8c4d65.js";import"./index.cf4c23b9.js";import"./url.12ca99c5.js";import"./index.0ec384bd.js";import"./index.3a0ced65.js";import"./index.b19c9d88.js";import"./index.4b05c792.js";import"./index.d2b2175c.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]="0273ffdd-d3af-40f4-b2ef-5bba0185f50d",a._sentryDebugIdIdentifier="sentry-dbid-0273ffdd-d3af-40f4-b2ef-5bba0185f50d")}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}})},f=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:u}){o.push({name:"tableEditor",params:{tableId:u,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),p()}}]}]})))!=null?r:[]}}),b=[{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:f.value,fields:b,"create-button-text":"Create Table",onCreate:c},null,8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.a2205e18.js.map
