import{d as y,ez as g,eA as C,J as T,b as _,c as k,u as I}from"./outputWidgets.df0b7764.js";import{e as w,q as h}from"./icons.649962e7.js";import{a as x}from"./asyncComputed.46396f29.js";import"./router.7d542f8a.js";import"./index.be0d60a2.js";import{T as s}from"./tables.3a7d0af3.js";import{C as D}from"./CrudView.c17fe492.js";import{n as i}from"./string.ff9f2867.js";import"./Title.d627f1f5.js";import"./index.8131d28d.js";import"./gateway.315bccd7.js";import"./activeRecord.af31c98a.js";import"./pubsub.82647744.js";import"./index.0830e379.js";import"./Form.29bcac3f.js";import"./url.b34e96a5.js";import"./index.eb14364d.js";import"./index.b2e095c7.js";import"./index.5c49f4fd.js";import"./index.317ac553.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]="f2626d7e-a158-4430-9fc4-93b845cdd163",a._sentryDebugIdIdentifier="sentry-dbid-f2626d7e-a158-4430-9fc4-93b845cdd163")}catch{}})();const W=y({__name:"Tables",setup(a){const o=g(),t=C().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}})},u=T(()=>{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:[]}}),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{W as default};
//# sourceMappingURL=Tables.99bf2b37.js.map
