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.84a829ae.js";import{I as v,i as D}from"./icons.1332d3dc.js";import{a as E}from"./asyncComputed.dd40f6f7.js";import"./router.34c33c89.js";import{T as m}from"./tables.d394d2fc.js";import"./index.060f91c4.js";import{C as B}from"./CrudView.449ac6ae.js";import{n as c}from"./string.94829b58.js";import"./Form.43cd5faa.js";import"./hasIn.17b499bc.js";import"./popupNotifcation.5203a290.js";import"./record.98d2d912.js";import"./pubsub.28bedbe2.js";import"./index.cf4c23b9.js";import"./Paragraph.271f693c.js";import"./Base.d9274247.js";import"./Typography.c95be6a2.js";import"./Modal.faea78ae.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.4d53704f.js";import"./url.01b4d3ff.js";import"./index.e7cb0a34.js";import"./Title.86d9b79e.js";import"./Text.38fac303.js";import"./index.1b61c7ee.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]="020e9167-73ce-4365-87ff-8c1aaa7a92f1",o._sentryDebugIdIdentifier="sentry-dbid-020e9167-73ce-4365-87ff-8c1aaa7a92f1")}catch{}})();const re=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:d,result:u,refetch:f}=E(()=>m.list(t)),b=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),f()}}]}]})))!=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:b,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.7a72f236.js.map
