import{d as T,eA as _,eB as k,H as w,b as h,c as I,w as i,u as l,eP as x,f as N,aq as S,bF as v}from"./outputWidgets.225dd371.js";import{G as D}from"./PhPencil.vue.bd1d8b41.js";import{a as E}from"./asyncComputed.8a54909a.js";import"./router.8e23138d.js";import{T as m}from"./tables.92e8ef0a.js";import"./index.2924e62a.js";import{C as B}from"./CrudView.72bd6d5e.js";import{n as d}from"./string.321f230b.js";import"./Form.12e2d16e.js";import"./hasIn.1e38e049.js";import"./popupNotifcation.6873325b.js";import"./record.b805ac15.js";import"./pubsub.3bce7ea8.js";import"./index.cf4c23b9.js";import"./Paragraph.253f2b2e.js";import"./Text.a0f2d781.js";import"./Modal.0a797886.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c28d2d29.js";import"./url.29c1f37b.js";import"./index.8e2737d3.js";import"./Title.bbb77099.js";import"./index.42c8bfb7.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]="6631e852-52f2-4928-a1d6-9e4e71e6d15f",o._sentryDebugIdIdentifier="sentry-dbid-6631e852-52f2-4928-a1d6-9e4e71e6d15f")}catch{}})();const ae=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:c,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:D,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:x,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)=>(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:f,onSecondaryClick:s},{more:i(()=>[N(l(v),{onClick:s},{default:i(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{ae as default};
//# sourceMappingURL=Tables.17cc4d85.js.map
