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,bG as S}from"./outputWidgets.23a77d09.js";import{I as v,i as D}from"./icons.7faba5d8.js";import{a as E}from"./asyncComputed.87bcbfab.js";import"./router.5013253c.js";import{T as m}from"./tables.4a8f7486.js";import"./index.fb6a8be1.js";import{C as B}from"./CrudView.a71d1967.js";import{n as c}from"./string.3abfe698.js";import"./Form.1abced8c.js";import"./hasIn.897d62dc.js";import"./popupNotifcation.8aa8d2a6.js";import"./record.99cdbef5.js";import"./pubsub.a21150d7.js";import"./index.cf4c23b9.js";import"./Paragraph.a35411f7.js";import"./Base.a26f807d.js";import"./Typography.d216066f.js";import"./Modal.e2700fe9.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.eb5c86c6.js";import"./url.9d816829.js";import"./index.869792c3.js";import"./Title.61f38aef.js";import"./Text.bfbdf9cf.js";import"./index.34e34ded.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="bbfa8aa1-a267-4ce5-9e84-a1341c83808a",o._sentryDebugIdIdentifier="sentry-dbid-bbfa8aa1-a267-4ce5-9e84-a1341c83808a")}catch{}})();const re=T({__name:"Tables",setup(o){const t=_(),a=k().params.projectId,{loading:d,result:u,refetch:b}=E(()=>m.list(a)),f=async e=>{const r=await m.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},s=()=>{t.push({name:"sql",params:{projectId:a}})},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:a}}},{type:"actions",actions:[{icon:v,label:"Edit Table",onClick({key:C}){t.push({name:"tableEditor",params:{tableId:C,projectId:a}})}},{icon:D,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,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)=>(I(),h(B,{"entity-name":"table",loading:l(d),"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{re as default};
//# sourceMappingURL=Tables.36bc8647.js.map
