import{d as T,eA as _,eB as k,H as w,b as I,c as h,w as i,u as l,f as x,ar as N,bG as S}from"./outputWidgets.9bb29762.js";import{I as v,i as D}from"./icons.d08bf04b.js";import{a as E}from"./asyncComputed.ac1a0197.js";import"./router.f15646c4.js";import{T as m}from"./tables.62e321f0.js";import"./index.2f604abe.js";import{C as B}from"./CrudView.8ffa6c50.js";import{n as d}from"./string.651f1f90.js";import"./Form.472b1af8.js";import"./hasIn.fa8167cd.js";import"./popupNotifcation.b12790e0.js";import"./record.dd7b0559.js";import"./pubsub.90d4935e.js";import"./index.cf4c23b9.js";import"./Paragraph.9dbf4710.js";import"./Base.abff5e35.js";import"./Typography.184e8c0b.js";import"./Modal.8f9ba470.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.79f00877.js";import"./url.c222fac4.js";import"./index.fcc99b17.js";import"./Title.b342fcc9.js";import"./Text.5324981a.js";import"./index.b2ab466e.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]="02dc792e-f1e8-4039-8abf-3d1aa44ae7f8",o._sentryDebugIdIdentifier="sentry-dbid-02dc792e-f1e8-4039-8abf-3d1aa44ae7f8")}catch{}})();const re=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:u,refetch:b}=E(()=>m.list(t)),f=async e=>{const r=await m.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},s=()=>{a.push({name:"sql",params:{projectId:t}})},y=w(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=u.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:v,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:D,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),b()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>d(e,!0),blur:e=>d(e,!1)}];return(e,r)=>(I(),h(B,{"entity-name":"table",loading:l(p),"docs-path":"tables/overview",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:y.value,fields:g,"create-button-text":"Create Table",onCreate:f,onSecondaryClick:s},{more:i(()=>[x(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{re as default};
//# sourceMappingURL=Tables.ef80fbe3.js.map
