import{C as T}from"./CrudView.cf099838.js";import{a as _}from"./asyncComputed.ee6673cb.js";import{n as i}from"./string.cb42bbf3.js";import{G as k}from"./PhPencil.vue.a781bcff.js";import{d as w,eo as h,ea as I,f as x,o as N,c as S,w as l,u as m,b as D,aF as E,bS as v,ep as A}from"./vue-router.25496eb3.js";import"./gateway.090a2504.js";import{T as c}from"./tables.732c3160.js";import{a as B}from"./ant-design.62a6773b.js";import"./router.92b9eafd.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.c4306070.js";import"./BookOutlined.23f627d4.js";import"./url.d7b430c5.js";import"./PhDotsThreeVertical.vue.eb15d37e.js";import"./Badge.0b8e6d1d.js";import"./index.cdda9ded.js";import"./popupNotifcation.ea7de34e.js";import"./record.0cf3393b.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]="f5982212-ccb8-4336-b73b-4b7a6bea7880",o._sentryDebugIdIdentifier="sentry-dbid-f5982212-ccb8-4336-b73b-4b7a6bea7880")}catch{}})();const Y=w({__name:"Tables",setup(o){const t=h(),a=I().params.projectId,{loading:p,result:b,refetch:u}=_(()=>c.list(a)),f=async e=>{const r=await c.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=b.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:A,label:"Delete",dangerous:!0,async onClick(){!await B("Are you sure you want to delete this table and all its data?")||(await n.delete(a,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)=>(N(),S(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(()=>[D(m(v),{onClick:y},{default:l(()=>[E("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.749a761f.js.map
