import{C}from"./CrudView.408a4461.js";import{a as _}from"./ant-design.7d916c63.js";import{a as k}from"./asyncComputed.2bec113c.js";import{n as i}from"./string.532e13bb.js";import{G as w}from"./PhPencil.vue.10ddf5aa.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 c,b as S,aG as v,bT as A,ep as B}from"./index.0f630b70.js";import"./gateway.50cd3949.js";import{T as m}from"./tables.78c50568.js";import"./router.0f31f3f1.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.bf268869.js";import"./BookOutlined.89f2a8c6.js";import"./url.90c69b58.js";import"./PhDotsThreeVertical.vue.e2e73559.js";import"./Badge.ada44968.js";import"./index.1eaf0cd2.js";import"./popupNotifcation.dd76a56c.js";import"./record.f729e500.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]="25ab3ca2-fcec-4c4e-8c62-61b890bc4963",o._sentryDebugIdIdentifier="sentry-dbid-25ab3ca2-fcec-4c4e-8c62-61b890bc4963")}catch{}})();const Y=h({__name:"Tables",setup(o){const a=I(),t=x().params.projectId,{loading:p,result:u,refetch:b}=k(()=>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=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),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:c(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(c(A),{onClick:y},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.ead2fa08.js.map
