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,bV as S}from"./outputWidgets.108432da.js";import{I as v,i as D}from"./icons.9db31d3d.js";import{a as E}from"./asyncComputed.9818a09a.js";import"./router.2ffebeb2.js";import{T as m}from"./tables.f004ae48.js";import"./index.23178e03.js";import{C as B}from"./CrudView.a9daec59.js";import{n as d}from"./string.543a462d.js";import"./Form.a76f1164.js";import"./hasIn.7973e16b.js";import"./record.15041cf5.js";import"./pubsub.98ab975f.js";import"./index.cf4c23b9.js";import"./Paragraph.d17409a8.js";import"./Base.f7c93d8e.js";import"./Typography.6afbacd7.js";import"./Modal.efcd7ec2.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c535f159.js";import"./url.42281f8e.js";import"./index.3d290fbb.js";import"./Title.98d4c800.js";import"./Text.1a62e50a.js";import"./index.5578279a.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]="fa09ebc9-9019-4e2b-9065-084e5b3b3d4b",o._sentryDebugIdIdentifier="sentry-dbid-fa09ebc9-9019-4e2b-9065-084e5b3b3d4b")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:b,refetch:u}=E(()=>m.list(t)),f=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=b.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),u()}}]}]})))!=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(p),"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:f,onSecondaryClick:s},{more:i(()=>[x(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.6a591205.js.map
