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.83ad65aa.js";import{H as v,i as D}from"./icons.ec92f7f9.js";import{a as E}from"./asyncComputed.eebec89e.js";import"./router.1b8539af.js";import{T as m}from"./tables.61f4a583.js";import"./index.9f577453.js";import{C as B}from"./CrudView.fb55c5f4.js";import{n as d}from"./string.ce2eea25.js";import"./Form.5deb3adb.js";import"./hasIn.597d0078.js";import"./record.df4e3ae7.js";import"./pubsub.6c6cbc8d.js";import"./index.cf4c23b9.js";import"./Paragraph.eee68d2f.js";import"./Base.5de97c83.js";import"./Typography.fea800b8.js";import"./Modal.00c72438.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d125b27a.js";import"./url.27ce9387.js";import"./index.677f843d.js";import"./Title.50be6d8b.js";import"./Text.72dc1978.js";import"./index.06a93781.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]="c3a00e2c-9f1d-40dd-b17d-f43fb4bf9e7d",o._sentryDebugIdIdentifier="sentry-dbid-c3a00e2c-9f1d-40dd-b17d-f43fb4bf9e7d")}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=>d(e,!0),blur:e=>d(e,!1)}];return(e,r)=>(h(),I(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.30fe6da2.js.map
