import{C}from"./CrudView.89c2dc44.js";import{a as _}from"./ant-design.a2a142ac.js";import{a as k}from"./asyncComputed.b7a00680.js";import{n as i}from"./string.5d4ff2a8.js";import{G as w}from"./PhPencil.vue.0e436362.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.9f6b07f8.js";import"./gateway.278d63bb.js";import{T as c}from"./tables.d4a3005e.js";import"./router.08eb431f.js";import"./Badge.5a41e29d.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.05fb37aa.js";import"./BookOutlined.03ede396.js";import"./url.1a36d266.js";import"./PhDotsThreeVertical.vue.f0803fee.js";import"./index.72530e51.js";import"./index.e3e2b3b3.js";import"./popupNotifcation.0fed36dd.js";import"./record.57192485.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]="c336eacd-527b-47af-8a05-54aad92c1528",o._sentryDebugIdIdentifier="sentry-dbid-c336eacd-527b-47af-8a05-54aad92c1528")}catch{}})();const Z=h({__name:"Tables",setup(o){const t=I(),a=x().params.projectId,{loading:p,result:u,refetch:b}=k(()=>c.list(a)),f=async e=>{const r=await c.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},y=()=>{t.push({name:"sql",params:{projectId:a}})},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:a}}},{type:"actions",actions:[{icon:w,label:"Edit Table",onClick({key:n}){t.push({name:"tableEditor",params:{tableId:n,projectId:a}})}},{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(a,s.id),b())}}]}]})))!=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:f},{more:l(()=>[S(m(A),{onClick:y},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.9c570b16.js.map
