import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.91878a00.js";import{e as w,g as h}from"./icons.842bb077.js";import{a as x}from"./asyncComputed.6ced1d7b.js";import"./router.77bfbaae.js";import{T as s,n as i}from"./tables.27d94666.js";import"./index.8262a422.js";import{C as D}from"./CrudView.d6529c3b.js";import"./Base.80d71c98.js";import"./transButton.c9ea1045.js";import"./Text.24e27494.js";import"./Title.cb0c3b9b.js";import"./index.571df689.js";import"./record.8ded570d.js";import"./pubsub.862a9619.js";import"./gateway.6c51aaca.js";import"./url.dddb8fdb.js";import"./index.aed07cef.js";import"./index.43a9b125.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]="e014c379-0f62-4549-947e-d07c4117daa3",a._sentryDebugIdIdentifier="sentry-dbid-e014c379-0f62-4549-947e-d07c4117daa3")}catch{}})();const Q=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{Q as default};
//# sourceMappingURL=Tables.a0048450.js.map
