import{d as g,eA as C,eB as T,H as k,b as _,c as I,u as h}from"./outputWidgets.5c52fa87.js";import{t as w,o as x}from"./icons.03282d1d.js";import{a as S}from"./asyncComputed.26d9bcc1.js";import"./router.e0fda50a.js";import{T as s}from"./tables.0a636755.js";import"./index.ff34804e.js";import{C as v}from"./CrudView.6aea262f.js";import{n as i}from"./string.a1010cd3.js";import"./FormItem.eb04c2fc.js";import"./hasIn.f2c6482d.js";import"./record.eec0c608.js";import"./pubsub.5093c187.js";import"./index.cf4c23b9.js";import"./Paragraph.cff93cf2.js";import"./Base.6d1a6939.js";import"./Form.17a01b6e.js";import"./Modal.2c05a20d.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.fa56e270.js";import"./url.8bc1ece1.js";import"./index.0be66a31.js";import"./Title.91b6cec6.js";import"./Text.c9a398d0.js";import"./index.f2d17967.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]="c428f8af-4a9a-41de-a07a-feb84edbb8bf",o._sentryDebugIdIdentifier="sentry-dbid-c428f8af-4a9a-41de-a07a-feb84edbb8bf")}catch{}})();const $=g({__name:"Tables",setup(o){const a=C(),t=T().params.projectId,{loading:m,result:d,refetch:p}=S(()=>s.list(t)),c=async e=>{const r=await s.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},b=()=>{a.push({name:"sql",params:{projectId:t}})},u=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),p()}}]}]})))!=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:u.value,fields:f,"create-button-text":"Create Table","secondary-button-text":"Run SQL",onCreate:c,onSecondaryClick:b},null,8,["loading","table"]))}});export{$ as default};
//# sourceMappingURL=Tables.74804bf4.js.map
