import{C as T}from"./CrudView.c3cfdbe0.js";import{a as _}from"./asyncComputed.492220e2.js";import{n as i}from"./string.243c4431.js";import{G as k}from"./PhPencil.vue.2e11b63b.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.c5124aea.js";import"./gateway.f0a8a4c2.js";import{T as d}from"./tables.e3d4a0cb.js";import{a as A}from"./ant-design.8d54eea4.js";import"./router.09f8c7fd.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.ee60e4e5.js";import"./BookOutlined.4a8c6e69.js";import"./url.a882d197.js";import"./PhDotsThreeVertical.vue.db7af6ac.js";import"./Badge.2abe7f2d.js";import"./index.31f5d814.js";import"./popupNotifcation.13f7057e.js";import"./record.3c40de6b.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]="7043dbea-4c19-4aa5-a24f-71b4f99eb0de",o._sentryDebugIdIdentifier="sentry-dbid-7043dbea-4c19-4aa5-a24f-71b4f99eb0de")}catch{}})();const Y=w({__name:"Tables",setup(o){const t=h(),a=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>d.list(a)),f=async e=>{const r=await d.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},y=()=>{t.push({name:"sql",params:{projectId:a}})},g=x(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=u.value)==null?void 0:e.map(n=>({key:n.id,cells:[{type:"link",text:n.name,to:{name:"tableEditor",params:{tableId:n.id,projectId:a}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:s}){t.push({name:"tableEditor",params:{tableId:s,projectId:a}})}},{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(a,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)=>(D(),N(T,{"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: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.a32e1fae.js.map
