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.809f1c57.js";import{H as v,i as D}from"./icons.8975fdbd.js";import{a as E}from"./asyncComputed.466c4877.js";import"./router.5b895db7.js";import{T as m}from"./tables.8799a079.js";import"./index.c651a706.js";import{C as B}from"./CrudView.4f9d2631.js";import{n as d}from"./string.c0f7416e.js";import"./Form.023148df.js";import"./hasIn.e1b15717.js";import"./popupNotifcation.0b39d2d3.js";import"./record.41a2948e.js";import"./pubsub.67132179.js";import"./index.cf4c23b9.js";import"./Paragraph.32fc6334.js";import"./Base.4c033746.js";import"./Typography.f29a9c7e.js";import"./Modal.ae5cc76f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a2ae9439.js";import"./url.638cfb3e.js";import"./index.ee508a43.js";import"./Title.f3656269.js";import"./Text.9d2b2621.js";import"./index.48e1252c.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]="f0f20235-d070-4a96-b0f1-cfe7ed0dfcc9",o._sentryDebugIdIdentifier="sentry-dbid-f0f20235-d070-4a96-b0f1-cfe7ed0dfcc9")}catch{}})();const re=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:f,refetch:u}=E(()=>m.list(t)),b=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=f.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:b,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.0d41efca.js.map
