import{d as g,eA as C,eB as T,H as k,b as _,c as I,u as h}from"./outputWidgets.244ba1c8.js";import{q as w,d as x}from"./icons.a522dd78.js";import{a as S}from"./asyncComputed.9805a381.js";import"./router.60675eeb.js";import{T as s}from"./tables.6d53f7ce.js";import"./index.bec3aec1.js";import{C as v}from"./CrudView.47ed1f4a.js";import{n as i}from"./string.857814ea.js";import"./FormItem.e7fba2a7.js";import"./hasIn.d73516ff.js";import"./record.5766e9f8.js";import"./pubsub.f74b1921.js";import"./index.cf4c23b9.js";import"./Paragraph.bffb9dac.js";import"./Base.2351f159.js";import"./Typography.52981f51.js";import"./Form.f49cd330.js";import"./Modal.ff9cdc66.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.aee5d1fe.js";import"./url.f5db59c1.js";import"./index.08ab98c1.js";import"./Title.eb85429e.js";import"./Text.fbfa9a45.js";import"./index.feab3270.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[a]="c115340b-ed00-4990-b387-fb6e3e144779",o._sentryDebugIdIdentifier="sentry-dbid-c115340b-ed00-4990-b387-fb6e3e144779")}catch{}})();const ee=g({__name:"Tables",setup(o){const a=C(),t=T().params.projectId,{loading:m,result:d,refetch:p}=S(()=>s.list(t)),c=async e=>{const r=await s.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},b=()=>{a.push({name:"sql",params:{projectId:t}})},u=k(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=d.value)==null?void 0:e.map(n=>({key:n.id,cells:[{type:"link",text:n.name,to:{name:"tableEditor",params:{tableId:n.id,projectId:t}}},{type:"actions",actions:[{icon:w,label:"Edit Table",onClick({key:y}){a.push({name:"tableEditor",params:{tableId:y,projectId:t}})}},{icon:x,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),p()}}]}]})))!=null?r:[]}}),f=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(_(),I(v,{"entity-name":"table",loading:h(m),"docs-path":"tables/overview",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:u.value,fields:f,"create-button-text":"Create Table","secondary-button-text":"Run SQL",onCreate:c,onSecondaryClick:b},null,8,["loading","table"]))}});export{ee as default};
//# sourceMappingURL=Tables.8d810420.js.map
