import{C as T}from"./CrudView.f360b43c.js";import{a as _}from"./asyncComputed.7b5c3427.js";import{n as l}from"./string.b1ebfabb.js";import{G as k}from"./PhPencil.vue.184a28bf.js";import{d as h,eM as w,eB as I,f as x,o as N,c as S,w as i,u as m,eN as D,b as E,as as B,bH as v}from"./vue-router.74c693f1.js";import"./gateway.707771fc.js";import{T as d}from"./index.0791082e.js";import"./router.77dea3d2.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.97a16843.js";import"./BookOutlined.7a96a9c1.js";import"./url.8b7ee03b.js";import"./index.ad2af8a3.js";import"./index.33768c38.js";import"./popupNotifcation.d39bbf9b.js";import"./record.0d85e3b6.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]="0eb7b3aa-7e25-4117-9170-1dff4eb8275e",o._sentryDebugIdIdentifier="sentry-dbid-0eb7b3aa-7e25-4117-9170-1dff4eb8275e")}catch{}})();const U=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>d.list(a)),f=async e=>{const r=await d.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: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(v),{onClick:s},{default:i(()=>[B("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.8e018b9d.js.map
