import{C as T}from"./CrudView.cf2efa85.js";import{a as _}from"./asyncComputed.c066d666.js";import{n as i}from"./string.6557d1ac.js";import{G as k}from"./PhPencil.vue.9dde7835.js";import{d as w,eq as h,ed as I,f as x,c as N,w as l,u as m,o as D,b as E,aF as S,bP as q,er as v}from"./vue-router.e2dfd848.js";import"./gateway.9d624aa1.js";import{T as d}from"./tables.ce119705.js";import{a as A}from"./ant-design.9176bfec.js";import"./router.4083831b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.9bf7a4fd.js";import"./BookOutlined.dcf239a2.js";import"./url.55d7f2ef.js";import"./PhDotsThreeVertical.vue.a2a5846d.js";import"./Badge.d1042aea.js";import"./index.7b491e18.js";import"./popupNotifcation.367e10ac.js";import"./record.228e1a8a.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]="b23bfeb7-be30-4c6e-9a0d-d3244b7bc08b",o._sentryDebugIdIdentifier="sentry-dbid-b23bfeb7-be30-4c6e-9a0d-d3244b7bc08b")}catch{}})();const Y=w({__name:"Tables",setup(o){const a=h(),t=I().params.projectId,{loading:b,result:p,refetch:u}=_(()=>d.list(t)),f=async e=>{const r=await d.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),u())}}]}]})))!=null?r:[]}}),C=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(D(),N(T,{"entity-name":"table",loading:m(b),"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",create:f},{more:l(()=>[E(m(q),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.dce651bf.js.map
