import{C as T}from"./CrudView.3cb1fb74.js";import{a as _}from"./asyncComputed.0b7f3eaf.js";import{n as l}from"./string.876500c9.js";import{G as k}from"./PhPencil.vue.5353ab56.js";import{d as h,eM as w,eA as I,f as x,o as N,c as S,w as i,u as c,eN as D,b as E,ar as v,bG as A}from"./vue-router.637ad36e.js";import"./gateway.e1c89e24.js";import{T as m}from"./tables.0c659977.js";import"./router.3a426b39.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.9833e445.js";import"./BookOutlined.c02a6591.js";import"./url.c1cbace3.js";import"./index.ba283bad.js";import"./index.faf7cd82.js";import"./popupNotifcation.498cf509.js";import"./record.833ab838.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]="87e858ec-e272-4713-a4b8-a3af68d7a7c0",o._sentryDebugIdIdentifier="sentry-dbid-87e858ec-e272-4713-a4b8-a3af68d7a7c0")}catch{}})();const U=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>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=x(()=>{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:k,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=>l(e,!0),blur:e=>l(e,!1)}];return(e,r)=>(N(),S(T,{"entity-name":"table",loading:c(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(c(A),{onClick:s},{default:i(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.518114ca.js.map
