import{C as T}from"./CrudView.5c576934.js";import{a as _}from"./asyncComputed.1e9d0abf.js";import{n as i}from"./string.6792602f.js";import{G as k}from"./PhPencil.vue.6b4fe7f8.js";import{d as w,eq as h,ed as I,f as x,c as N,w as l,u as d,o as S,b as D,aF as E,bS as q,er as v}from"./vue-router.2a09679a.js";import"./gateway.b08a6336.js";import{T as m}from"./tables.adb160d4.js";import{a as A}from"./ant-design.e55e1bbe.js";import"./router.c5972afe.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b6793306.js";import"./BookOutlined.b0ead745.js";import"./url.fd4f4aec.js";import"./PhDotsThreeVertical.vue.1b4932cb.js";import"./index.b153c6c8.js";import"./popupNotifcation.ed0bf79d.js";import"./record.1f9cddba.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]="22316e4a-fab3-4cd4-a63e-0913d91f7973",o._sentryDebugIdIdentifier="sentry-dbid-22316e4a-fab3-4cd4-a63e-0913d91f7973")}catch{}})();const X=w({__name:"Tables",setup(o){const t=h(),a=I().params.projectId,{loading:u,result:p,refetch:f}=_(()=>m.list(a)),b=async e=>{const r=await m.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=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: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)=>(S(),N(T,{"entity-name":"table",loading:d(u),"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",onCreate:b},{more:l(()=>[D(d(q),{onClick:y},{default:l(()=>[E("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{X as default};
//# sourceMappingURL=Tables.60f131e2.js.map
