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,bV as S}from"./outputWidgets.6bfc0239.js";import{I as v,i as D}from"./icons.5f4f8713.js";import{a as E}from"./asyncComputed.21831dee.js";import"./router.979769f7.js";import{T as m}from"./tables.29c3f8af.js";import"./index.76d87691.js";import{C as B}from"./CrudView.26794284.js";import{n as c}from"./string.2eb5a2c9.js";import"./Form.7d1a8597.js";import"./hasIn.42df2c7d.js";import"./record.dbb754fe.js";import"./pubsub.56f48661.js";import"./index.cf4c23b9.js";import"./Paragraph.100fbd75.js";import"./Base.3f4f4c87.js";import"./Typography.7fe49268.js";import"./Modal.9595e4e0.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.77240f7b.js";import"./url.c2408bab.js";import"./index.60dad040.js";import"./Title.84d6428e.js";import"./Text.3be64ce1.js";import"./index.ecc37a00.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]="b0bfacf9-410e-415e-9b26-6945492cc75d",o._sentryDebugIdIdentifier="sentry-dbid-b0bfacf9-410e-415e-9b26-6945492cc75d")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:b,refetch:u}=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=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),u()}}]}]})))!=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:f,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.4d6d8cd0.js.map
