import{d as y,ey as g,ez as k,H as C,b as T,c as _,u as I}from"./outputWidgets.9a4dffd5.js";import{e as w,k as h}from"./icons.d935dec9.js";import{a as x}from"./asyncComputed.947a021a.js";import"./router.e9c58c63.js";import"./columns.2487afd8.js";import{T as s}from"./tables.17cd765d.js";import{C as D}from"./CrudView.32e9e362.js";import{n as i}from"./string.2c28b0b0.js";import"./Title.72e90637.js";import"./index.a351ac5c.js";import"./gateway.a8fa6711.js";import"./activeRecord.6b2e89dc.js";import"./pubsub.25596209.js";import"./index.f4ac7424.js";import"./index.0d204717.js";import"./Form.0ea0ca53.js";import"./url.152c5826.js";import"./index.c64df437.js";import"./index.c4327f7e.js";import"./index.d0b58c73.js";import"./index.3ecad98a.js";import"./index.0e22fd42.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]="bdc39c3a-1ab8-4236-b2d4-7a84e9482d01",a._sentryDebugIdIdentifier="sentry-dbid-bdc39c3a-1ab8-4236-b2d4-7a84e9482d01")}catch{}})();const Y=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{Y as default};
//# sourceMappingURL=Tables.95d964ba.js.map
