import{d as g,eA as C,eB as T,H as k,b as _,c as I,u as h}from"./outputWidgets.6830fc2d.js";import{q as w,d as x}from"./icons.31e4fa46.js";import{a as S}from"./asyncComputed.46a733c1.js";import"./router.c745a3c2.js";import{T as s}from"./tables.2baa6e26.js";import"./index.fddb9e1e.js";import{C as v}from"./CrudView.432fe0c4.js";import{n as i}from"./string.81ef85b7.js";import"./FormItem.278e4518.js";import"./hasIn.48daad41.js";import"./record.416df660.js";import"./pubsub.6d4f7540.js";import"./index.cf4c23b9.js";import"./Paragraph.c22304c7.js";import"./Base.e8ab0cc0.js";import"./Form.a8618886.js";import"./Modal.e109cdd2.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.6b319732.js";import"./url.1f48e231.js";import"./index.a26dbe33.js";import"./Title.10b04a9c.js";import"./Text.b2a17f23.js";import"./index.ec7fc193.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]="dbdcaa91-341a-44f1-8477-205d11bcad1a",o._sentryDebugIdIdentifier="sentry-dbid-dbdcaa91-341a-44f1-8477-205d11bcad1a")}catch{}})();const $=g({__name:"Tables",setup(o){const a=C(),t=T().params.projectId,{loading:m,result:d,refetch:c}=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=d.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),c()}}]}]})))!=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{$ as default};
//# sourceMappingURL=Tables.99c31d37.js.map
