import{d as T,eA as _,eB as k,H as w,b as h,c as I,w as i,u as l,f as x,ar as N,bV as S}from"./outputWidgets.0a8e4948.js";import{H as v,i as D}from"./icons.b13f0b09.js";import{a as E}from"./asyncComputed.059a4705.js";import"./router.a730a2c1.js";import{T as m}from"./tables.7f475aeb.js";import"./index.fea4a6f4.js";import{C as B}from"./CrudView.d727886c.js";import{n as d}from"./string.349cf797.js";import"./Form.c559c050.js";import"./hasIn.8bcc6abb.js";import"./record.68d70ea4.js";import"./pubsub.dcb12b9f.js";import"./index.cf4c23b9.js";import"./Paragraph.b4aaf7da.js";import"./Base.dda5d58b.js";import"./Typography.fd999a5c.js";import"./Modal.7e08920e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.db2454e0.js";import"./url.5c05e609.js";import"./index.2673874d.js";import"./Title.ca8d43a3.js";import"./Text.ec9c769b.js";import"./index.e5d762a8.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]="981030f8-5045-4af4-aa44-64fa33e25268",o._sentryDebugIdIdentifier="sentry-dbid-981030f8-5045-4af4-aa44-64fa33e25268")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:c,result:u,refetch:f}=E(()=>m.list(t)),b=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),f()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>d(e,!0),blur:e=>d(e,!1)}];return(e,r)=>(h(),I(B,{"entity-name":"table",loading:l(c),"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:b,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.f3798b1c.js.map
