import{C as k}from"./CrudView.570bcf8e.js";import{a as T}from"./asyncComputed.5fa11bed.js";import{n as l}from"./string.faa727da.js";import{G as _}from"./PhPencil.vue.e0dfa26f.js";import{d as h,ek as w,e7 as x,f as I,c as N,w as i,u as m,el as S,o as D,b as E,ax as v,bL as B}from"./vue-router.c536fc2b.js";import"./gateway.c0087c9f.js";import{T as c}from"./tables.6d634a71.js";import"./router.a06a6246.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.f8595ff8.js";import"./BookOutlined.4a409157.js";import"./url.4c149b5f.js";import"./PhDotsThree.vue.605843a4.js";import"./index.a489f9a1.js";import"./popupNotifcation.188e9011.js";import"./record.f45db9bc.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]="2241981a-0891-4c40-a80e-ef2a9e0b0318",o._sentryDebugIdIdentifier="sentry-dbid-2241981a-0891-4c40-a80e-ef2a9e0b0318")}catch{}})();const U=h({__name:"Tables",setup(o){const t=w(),a=x().params.projectId,{loading:p,result:u,refetch:b}=T(()=>c.list(a)),f=async e=>{const r=await c.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},s=()=>{t.push({name:"sql",params:{projectId:a}})},y=I(()=>{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:_,label:"Edit Table",onClick({key:C}){t.push({name:"tableEditor",params:{tableId:C,projectId:a}})}},{icon:S,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=>l(e,!0),blur:e=>l(e,!1)}];return(e,r)=>(D(),N(k,{"entity-name":"table",loading:m(p),"docs-path":"cloud/tables",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(()=>[E(m(B),{onClick:s},{default:i(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.68e4bcd5.js.map
