import{C as T}from"./CrudView.cec93544.js";import{a as _}from"./asyncComputed.37a42e7b.js";import{n as i}from"./string.8a83f3d1.js";import{G as k}from"./PhPencil.vue.ad2722bd.js";import{d as w,eq as h,ed as I,f as x,c as N,w as l,u as d,o as S,b as D,aF as E,bS as q,er as v}from"./vue-router.36bc5188.js";import"./gateway.6a3fe533.js";import{T as m}from"./tables.d43a3134.js";import{a as A}from"./ant-design.a27edffa.js";import"./router.748a95a3.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.7b7ee2ef.js";import"./BookOutlined.de962338.js";import"./url.a7891bdc.js";import"./PhDotsThreeVertical.vue.ac77e5a6.js";import"./index.87f1e4b3.js";import"./popupNotifcation.a7b5eb5c.js";import"./record.2cf5df84.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]="d9d3833f-db58-4635-b912-d507ca3c79b8",o._sentryDebugIdIdentifier="sentry-dbid-d9d3833f-db58-4635-b912-d507ca3c79b8")}catch{}})();const X=w({__name:"Tables",setup(o){const a=h(),t=I().params.projectId,{loading:u,result:p,refetch:b}=_(()=>m.list(t)),f=async e=>{const r=await m.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},y=()=>{a.push({name:"sql",params:{projectId:t}})},g=x(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=p.value)==null?void 0:e.map(n=>({key:n.id,cells:[{type:"link",text:n.name,to:{name:"tableEditor",params:{tableId:n.id,projectId:t}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:s}){a.push({name:"tableEditor",params:{tableId:s,projectId:t}})}},{icon:v,label:"Delete",dangerous:!0,async onClick(){!await A("Are you sure you want to delete this table and all its data?")||(await n.delete(t,n.id),b())}}]}]})))!=null?r:[]}}),C=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(S(),N(T,{"entity-name":"table",loading:d(u),"docs-path":"cloud/tables",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:g.value,fields:C,"create-button-text":"Create Table",onCreate:f},{more:l(()=>[D(d(q),{onClick:y},{default:l(()=>[E("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{X as default};
//# sourceMappingURL=Tables.402d7418.js.map
