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.e9677800.js";import{G as D}from"./PhPencil.vue.502d3996.js";import{a as E}from"./asyncComputed.37b7af98.js";import"./router.e014ddc2.js";import{T as m}from"./tables.011a2811.js";import"./index.21e91f9c.js";import{C as B}from"./CrudView.8e03181d.js";import{n as c}from"./string.07505ec9.js";import"./Form.9737d51d.js";import"./hasIn.bd3f78ff.js";import"./popupNotifcation.7148cdf9.js";import"./record.767f28b7.js";import"./pubsub.9e36d89a.js";import"./index.cf4c23b9.js";import"./Paragraph.394702f6.js";import"./Base.64d54b8f.js";import"./Typography.511f4fec.js";import"./Modal.df560cc7.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a4277c3a.js";import"./url.89c6b244.js";import"./index.42279d35.js";import"./Title.c954a24a.js";import"./Text.fd9e90fd.js";import"./index.1a0bd015.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]="96e59a2d-e56b-490e-8c1f-3c7a8ff1a14e",o._sentryDebugIdIdentifier="sentry-dbid-96e59a2d-e56b-490e-8c1f-3c7a8ff1a14e")}catch{}})();const re=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:d,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=>c(e,!0),blur:e=>c(e,!1)}];return(e,r)=>(h(),I(B,{"entity-name":"table",loading:l(d),"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{re as default};
//# sourceMappingURL=Tables.01191584.js.map
