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,bG as S}from"./outputWidgets.f0391a74.js";import{H as v,i as D}from"./icons.f7511453.js";import{a as E}from"./asyncComputed.363f961e.js";import"./router.9521f915.js";import{T as m}from"./tables.1e84ed6e.js";import"./index.13fb7824.js";import{C as B}from"./CrudView.9f2d78f4.js";import{n as d}from"./string.b3ce1063.js";import"./Form.1aee5650.js";import"./hasIn.23612021.js";import"./popupNotifcation.bb922524.js";import"./record.6f7f627d.js";import"./pubsub.73224ce6.js";import"./index.cf4c23b9.js";import"./Paragraph.4c6547df.js";import"./Base.c690457d.js";import"./Typography.2e02df67.js";import"./Modal.7a75e616.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.6af10b5d.js";import"./url.3db2a8aa.js";import"./index.9869cb58.js";import"./Title.18e0b53f.js";import"./Text.3e9cee86.js";import"./index.0e674df9.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]="3f38b91d-d78c-4604-97e7-42bfb66fed2f",o._sentryDebugIdIdentifier="sentry-dbid-3f38b91d-d78c-4604-97e7-42bfb66fed2f")}catch{}})();const re=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{re as default};
//# sourceMappingURL=Tables.efaa96e1.js.map
