import{C}from"./CrudView.423d8744.js";import{a as _}from"./ant-design.d89b18ab.js";import{a as k}from"./asyncComputed.703c33fd.js";import{n as i}from"./string.d9c83adf.js";import{G as w}from"./PhPencil.vue.7418c4e5.js";import{d as h,eo as I,ea as x,f as N,o as D,c as E,w as l,u as m,b as S,aG as v,bT as A,ep as B}from"./index.d0f12294.js";import"./gateway.ae1d6857.js";import{T as c}from"./tables.318f703e.js";import"./router.375df57e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d6f2b20e.js";import"./BookOutlined.7c922f07.js";import"./url.121c9984.js";import"./PhDotsThreeVertical.vue.d0b16f96.js";import"./Badge.f6241be2.js";import"./index.a82e0ed1.js";import"./popupNotifcation.a0a6244b.js";import"./record.8c284c67.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]="08aff574-7095-42b8-80b0-f0ce3269ae82",o._sentryDebugIdIdentifier="sentry-dbid-08aff574-7095-42b8-80b0-f0ce3269ae82")}catch{}})();const Y=h({__name:"Tables",setup(o){const a=I(),t=x().params.projectId,{loading:p,result:u,refetch:f}=k(()=>c.list(t)),b=async e=>{const r=await c.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},y=()=>{a.push({name:"sql",params:{projectId:t}})},g=N(()=>{var e,r;return{columns:[{title:"Table Name"},{title:"",align:"right"}],rows:(r=(e=u.value)==null?void 0:e.map(s=>({key:s.id,cells:[{type:"link",text:s.name,to:{name:"tableEditor",params:{tableId:s.id,projectId:t}}},{type:"actions",actions:[{icon:w,label:"Edit Table",onClick({key:n}){a.push({name:"tableEditor",params:{tableId:n,projectId:t}})}},{icon:B,label:"Delete",dangerous:!0,async onClick(){!await _("Are you sure you want to delete this table and all its data?")||(await s.delete(t,s.id),f())}}]}]})))!=null?r:[]}}),T=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(D(),E(C,{"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:g.value,fields:T,"create-button-text":"Create Table",create:b},{more:l(()=>[S(m(A),{onClick:y},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.29c026f5.js.map
