import{C as T}from"./CrudView.00ba8ddf.js";import{a as _}from"./asyncComputed.5aa790b6.js";import{n}from"./string.c0b64362.js";import{G as k}from"./PhPencil.vue.7afad853.js";import{d as h,ek as w,e7 as x,f as I,c as N,w as l,u as i,el as D,o as E,b as S,ax as v,bL as B}from"./vue-router.d9feb5a3.js";import"./gateway.bcb6c1cd.js";import{T as d}from"./tables.97f7d64d.js";import"./router.3320320c.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.7780e068.js";import"./BookOutlined.06277ca0.js";import"./url.99c6614b.js";import"./PhDotsThreeVertical.vue.83d724ac.js";import"./index.3ceffa89.js";import"./popupNotifcation.326ad4ba.js";import"./record.6cf0986e.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]="c0a1a798-621a-49b8-acda-e09dd6f6b3b2",o._sentryDebugIdIdentifier="sentry-dbid-c0a1a798-621a-49b8-acda-e09dd6f6b3b2")}catch{}})();const U=h({__name:"Tables",setup(o){const t=w(),a=x().params.projectId,{loading:c,result:p,refetch:u}=_(()=>d.list(a)),b=async e=>{const r=await d.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},f=()=>{t.push({name:"sql",params:{projectId:a}})},y=I(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=p.value)==null?void 0:e.map(s=>({key:s.id,cells:[{type:"link",text:s.name,to:{name:"tableEditor",params:{tableId:s.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 s.delete(a,s.id),u()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>n(e,!0),blur:e=>n(e,!1)}];return(e,r)=>(E(),N(T,{"entity-name":"table",loading:i(c),"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:b},{more:l(()=>[S(i(B),{onClick:f},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.9011e696.js.map
