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.74b0761d.js";import{H as v,i as D}from"./icons.fd5c09b0.js";import{a as E}from"./asyncComputed.fbb4ba44.js";import"./router.e97d6286.js";import{T as m}from"./tables.a9ad5715.js";import"./index.c51517e3.js";import{C as B}from"./CrudView.742df36b.js";import{n as d}from"./string.ac25a4c2.js";import"./Form.a24c61ad.js";import"./hasIn.d2130316.js";import"./popupNotifcation.2bb5bdcc.js";import"./record.acc69298.js";import"./pubsub.4c1d9617.js";import"./index.cf4c23b9.js";import"./Paragraph.5d2768c0.js";import"./Base.4463d78c.js";import"./Typography.5e0282a3.js";import"./Modal.80395829.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.9e6cb829.js";import"./url.0584bb06.js";import"./index.0327679a.js";import"./Title.a6d4b5b0.js";import"./Text.b007494b.js";import"./index.2189f45b.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]="ba6be56f-659d-4567-b8c5-0989d9b20cb6",o._sentryDebugIdIdentifier="sentry-dbid-ba6be56f-659d-4567-b8c5-0989d9b20cb6")}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.0a6eddcd.js.map
