import{C as T}from"./CrudView.dfc4572e.js";import{a as _}from"./asyncComputed.cef7b9d8.js";import{n as i}from"./string.76b61cc9.js";import{G as k}from"./PhPencil.vue.e4db48af.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.85c27f05.js";import"./gateway.aa5a907a.js";import{T as d}from"./tables.8aae1278.js";import{a as A}from"./ant-design.83748870.js";import"./router.6a11826f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.2ed94dec.js";import"./BookOutlined.3c422224.js";import"./url.2f0a55dd.js";import"./PhDotsThreeVertical.vue.ceb80819.js";import"./Badge.6a9a7808.js";import"./index.b39fb56f.js";import"./popupNotifcation.db970277.js";import"./record.b6b15302.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]="fa6e0d6f-1f93-4eb7-98d5-0ba8ee0150a8",o._sentryDebugIdIdentifier="sentry-dbid-fa6e0d6f-1f93-4eb7-98d5-0ba8ee0150a8")}catch{}})();const Y=w({__name:"Tables",setup(o){const t=h(),a=I().params.projectId,{loading:p,result:u,refetch:f}=_(()=>d.list(a)),b=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),f())}}]}]})))!=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:b},{more:l(()=>[E(m(q),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.a31f4622.js.map
