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.91c9f730.js";import{I as v,i as D}from"./icons.e854b740.js";import{a as E}from"./asyncComputed.5cff1726.js";import"./router.e4c5e9fd.js";import{T as m}from"./tables.3681c62c.js";import"./index.7bd5dae7.js";import{C as B}from"./CrudView.d1c2398f.js";import{n as d}from"./string.825e50ae.js";import"./Form.f24a1c0a.js";import"./hasIn.d8588324.js";import"./popupNotifcation.e7a2b93a.js";import"./record.48aae23b.js";import"./pubsub.25829540.js";import"./index.cf4c23b9.js";import"./Paragraph.18e7082b.js";import"./Base.79932679.js";import"./Typography.c7c5698a.js";import"./Modal.41a7632f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.05ceca6e.js";import"./url.bd840ee9.js";import"./index.5a63d36f.js";import"./Title.69e80303.js";import"./Text.2f03529d.js";import"./index.946fdb2e.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]="be27e937-3184-42e4-a7d5-b3c528e6d893",o._sentryDebugIdIdentifier="sentry-dbid-be27e937-3184-42e4-a7d5-b3c528e6d893")}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.79a89142.js.map
