import{d as g,eA as C,eB as T,H as k,b as _,c as I,u as h}from"./outputWidgets.12d07fe6.js";import{q as w,d as x}from"./icons.f2b4f37f.js";import{a as S}from"./asyncComputed.4b96df58.js";import"./router.d820a159.js";import{T as s}from"./tables.2f46d92d.js";import"./index.a1296999.js";import{C as v}from"./CrudView.1d47b402.js";import{n as i}from"./string.623bb943.js";import"./FormItem.791863a4.js";import"./hasIn.7e305b7d.js";import"./record.9ee5b79a.js";import"./pubsub.1984cbae.js";import"./index.cf4c23b9.js";import"./Paragraph.01fbd56d.js";import"./Base.24118e9f.js";import"./Typography.45a7b8d7.js";import"./Form.a87331b6.js";import"./Modal.f73330d1.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.0bca7c74.js";import"./url.f2a2de62.js";import"./index.04a061be.js";import"./Title.cc650707.js";import"./Text.6b94c3bc.js";import"./index.d055bc8b.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]="1eade3ad-313f-405c-b6c6-55411bdbfb87",o._sentryDebugIdIdentifier="sentry-dbid-1eade3ad-313f-405c-b6c6-55411bdbfb87")}catch{}})();const ee=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}})},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),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:u.value,fields:f,"create-button-text":"Create Table","secondary-button-text":"Run SQL",onCreate:p,onSecondaryClick:b},null,8,["loading","table"]))}});export{ee as default};
//# sourceMappingURL=Tables.ac2e17fc.js.map
