import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.df68f70a.js";import{e as w,g as h}from"./icons.6f0b428b.js";import{a as x}from"./asyncComputed.c4f3fa7a.js";import"./router.d34810ba.js";import{T as s,n as i}from"./tables.4f399c27.js";import"./index.5b8834fd.js";import{C as D}from"./CrudView.8169c4b4.js";import"./Base.8da1f136.js";import"./transButton.b32cb3fc.js";import"./Text.5293eafa.js";import"./Title.d7a9606c.js";import"./index.a1698b08.js";import"./record.493f7d84.js";import"./pubsub.26abae80.js";import"./gateway.104fd643.js";import"./url.e14018a7.js";import"./index.4c2136c4.js";import"./index.f12da0b9.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]="3933467c-d6ed-4bce-a0d9-51602d196823",a._sentryDebugIdIdentifier="sentry-dbid-3933467c-d6ed-4bce-a0d9-51602d196823")}catch{}})();const Q=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:d,result:m,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=m.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(d),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{Q as default};
//# sourceMappingURL=Tables.47358d24.js.map
