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.3c3deba7.js";import{I as v,i as D}from"./icons.c5a369ef.js";import{a as E}from"./asyncComputed.41e37f4b.js";import"./router.2687a12c.js";import{T as m}from"./tables.70bbd5be.js";import"./index.79fda194.js";import{C as B}from"./CrudView.44eff915.js";import{n as c}from"./string.dc95a94c.js";import"./Form.21b032af.js";import"./hasIn.26cab181.js";import"./record.e2163ce9.js";import"./pubsub.59f66cb7.js";import"./index.cf4c23b9.js";import"./Paragraph.d0a77c93.js";import"./Base.c0a62eaa.js";import"./Typography.828881b4.js";import"./Modal.ace70b58.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.86e502f6.js";import"./url.89508003.js";import"./index.c3c37865.js";import"./Title.ee2bfa7b.js";import"./Text.9ff37267.js";import"./index.66ff16a7.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]="a79b6fde-2c45-4254-9b6f-5c42b8f66fbf",o._sentryDebugIdIdentifier="sentry-dbid-a79b6fde-2c45-4254-9b6f-5c42b8f66fbf")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:b,refetch:f}=E(()=>m.list(t)),u=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=b.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),f()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>c(e,!0),blur:e=>c(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:u,onSecondaryClick:s},{more:i(()=>[x(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.7e6de14e.js.map
