import{d as T,eA as _,eB as k,H as w,b as I,c as h,w as i,u as l,f as x,ar as N,bG as S}from"./outputWidgets.763535ec.js";import{I as v,i as D}from"./icons.39d7577b.js";import{a as E}from"./asyncComputed.c1b5752d.js";import"./router.4c31abb0.js";import{T as m}from"./tables.46aa735f.js";import"./index.e272e65d.js";import{C as B}from"./CrudView.0261ff81.js";import{n as d}from"./string.9b1791a8.js";import"./Form.93c1d68a.js";import"./hasIn.c3ad9d17.js";import"./popupNotifcation.59a7179b.js";import"./record.ae98c277.js";import"./pubsub.e128dec2.js";import"./index.cf4c23b9.js";import"./Paragraph.1d14da40.js";import"./Base.0423a633.js";import"./Typography.3b9809ab.js";import"./Modal.33014e22.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.0d674672.js";import"./url.0280fc81.js";import"./index.5c5eefcc.js";import"./Title.b6a28a5f.js";import"./Text.1de1f1d2.js";import"./index.351b265c.js";import"./SyncOutlined.cf45cade.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]="f76926d5-eff8-44a8-89b9-6f28300e28a4",o._sentryDebugIdIdentifier="sentry-dbid-f76926d5-eff8-44a8-89b9-6f28300e28a4")}catch{}})();const ne=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:c,result:u,refetch:f}=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=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: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),f()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>d(e,!0),blur:e=>d(e,!1)}];return(e,r)=>(I(),h(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:b,onSecondaryClick:s},{more:i(()=>[x(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{ne as default};
//# sourceMappingURL=Tables.88c36507.js.map
