import{d as g,eA as C,eB as T,H as k,b as _,c as I,u as h}from"./outputWidgets.02d7c6ab.js";import{q as w,d as x}from"./icons.d148c279.js";import{a as S}from"./asyncComputed.6ba28f12.js";import"./router.1ffd6f3d.js";import{T as s}from"./tables.3f18ae99.js";import"./index.91e5c23a.js";import{C as v}from"./CrudView.9686d7bc.js";import{n as i}from"./string.a649b31c.js";import"./FormItem.08e761e4.js";import"./hasIn.16bcfc34.js";import"./record.4bf6e864.js";import"./pubsub.ee609699.js";import"./index.cf4c23b9.js";import"./Paragraph.fbd3cedb.js";import"./Base.a464e3b8.js";import"./Typography.9f15a3fb.js";import"./Form.ad29b3fb.js";import"./Modal.04499883.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.754dc12b.js";import"./url.425ecd45.js";import"./index.3efceebc.js";import"./Title.5b74a8b2.js";import"./Text.4830f6bb.js";import"./index.48b86b74.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]="c45e29d9-7b26-4ac1-a135-96cab63889c6",o._sentryDebugIdIdentifier="sentry-dbid-c45e29d9-7b26-4ac1-a135-96cab63889c6")}catch{}})();const ee=g({__name:"Tables",setup(o){const a=C(),t=T().params.projectId,{loading:m,result:c,refetch:d}=S(()=>s.list(t)),p=async e=>{const r=await s.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},u=()=>{a.push({name:"sql",params:{projectId:t}})},b=k(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=c.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:w,label:"Edit Table",onClick({key:y}){a.push({name:"tableEditor",params:{tableId:y,projectId:t}})}},{icon:x,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),d()}}]}]})))!=null?r:[]}}),f=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(_(),I(v,{"entity-name":"table",loading:h(m),"docs-path":"tables/overview",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:b.value,fields:f,"create-button-text":"Create Table","secondary-button-text":"Run SQL",onCreate:p,onSecondaryClick:u},null,8,["loading","table"]))}});export{ee as default};
//# sourceMappingURL=Tables.c3820cad.js.map
