import{C as T}from"./CrudView.187e7b93.js";import{a as _}from"./asyncComputed.a9aefa60.js";import{n as i}from"./string.c6f29545.js";import{G as k}from"./PhPencil.vue.16557b70.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 D,b as E,aF as S,bP as q,er as v}from"./vue-router.daa9090b.js";import"./gateway.143b9d5b.js";import{T as m}from"./tables.6c4080db.js";import{a as A}from"./ant-design.635db699.js";import"./router.2e40d4d3.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.ef44101d.js";import"./BookOutlined.37a8944e.js";import"./url.f89b68d7.js";import"./PhDotsThreeVertical.vue.00f8a21a.js";import"./index.91d5283b.js";import"./popupNotifcation.6bc3253c.js";import"./record.7a59ec24.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]="dc7f1488-23c1-47d0-b2ee-162fcd81235e",o._sentryDebugIdIdentifier="sentry-dbid-dc7f1488-23c1-47d0-b2ee-162fcd81235e")}catch{}})();const X=w({__name:"Tables",setup(o){const a=h(),t=I().params.projectId,{loading:u,result:p,refetch:f}=_(()=>m.list(t)),b=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=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),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: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",create:b},{more:l(()=>[E(d(q),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{X as default};
//# sourceMappingURL=Tables.93395e3b.js.map
