import{d as T,eA as _,eB as k,H as w,b as h,c as I,w as i,u as l,f as x,ar as N,bV as S}from"./outputWidgets.1d9bc483.js";import{H as v,i as D}from"./icons.f304c7ce.js";import{a as E}from"./asyncComputed.3431552f.js";import"./router.9b42915a.js";import{T as m}from"./tables.5b4b911b.js";import"./index.8feaf127.js";import{C as B}from"./CrudView.4ddb21c1.js";import{n as c}from"./string.7f59c5e8.js";import"./Form.b5179437.js";import"./hasIn.720fa991.js";import"./record.19799987.js";import"./pubsub.1ce944f4.js";import"./index.cf4c23b9.js";import"./Paragraph.fe3e888e.js";import"./Base.1fa74c0b.js";import"./Typography.a8278e90.js";import"./Modal.d0c8d599.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.35e5a90b.js";import"./url.d3539301.js";import"./index.3371bd8d.js";import"./Title.e5c6db47.js";import"./Text.dd7d318a.js";import"./index.76b6c31d.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]="58d748cc-fa16-42e3-b42c-f0c9837a5317",o._sentryDebugIdIdentifier="sentry-dbid-58d748cc-fa16-42e3-b42c-f0c9837a5317")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:u,refetch:b}=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=u.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),b()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>c(e,!0),blur:e=>c(e,!1)}];return(e,r)=>(h(),I(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.45a35f80.js.map
