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.ed989e0a.js";import{H as v,i as D}from"./icons.8f8b8d07.js";import{a as E}from"./asyncComputed.9f78a6df.js";import"./router.5e7d449c.js";import{T as m}from"./tables.01e4a4d2.js";import"./index.46777a19.js";import{C as B}from"./CrudView.919cb08b.js";import{n as c}from"./string.068afc10.js";import"./Form.fe660512.js";import"./hasIn.264c6078.js";import"./popupNotifcation.c17802b7.js";import"./record.f2e811cc.js";import"./pubsub.14278e58.js";import"./index.cf4c23b9.js";import"./Paragraph.4678e06b.js";import"./Base.42a4c5ca.js";import"./Typography.5e43ce25.js";import"./Modal.1ce4fb47.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a2269c93.js";import"./url.7656a70f.js";import"./index.881316ff.js";import"./Title.7eb91981.js";import"./Text.8e13d454.js";import"./index.f09baa6d.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]="78b74c37-0269-42bb-ace6-85e83af55a7e",o._sentryDebugIdIdentifier="sentry-dbid-78b74c37-0269-42bb-ace6-85e83af55a7e")}catch{}})();const re=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:d,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=>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(()=>[x(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{re as default};
//# sourceMappingURL=Tables.5c851544.js.map
