import{C as T}from"./CrudView.ea3cf78e.js";import{a as _}from"./asyncComputed.eac0df71.js";import{n as i}from"./string.110ad283.js";import{G as k}from"./PhPencil.vue.46f29c2d.js";import{d as w,eo as h,ea as I,f as x,o as N,c as D,w as l,u as m,b as E,aF as S,bP as v,ep as A}from"./vue-router.00a420cb.js";import"./gateway.3775a912.js";import{T as c}from"./tables.95e1ed3a.js";import{a as B}from"./ant-design.c8a1aa1d.js";import"./router.70041753.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.465b2cc4.js";import"./BookOutlined.df18764f.js";import"./url.fed57a6c.js";import"./PhDotsThreeVertical.vue.8b39bb89.js";import"./Badge.84a2436a.js";import"./index.b00d735b.js";import"./popupNotifcation.6aec82b8.js";import"./record.149dcd57.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]="4f41a57c-1204-42b9-8024-63d9711898c2",o._sentryDebugIdIdentifier="sentry-dbid-4f41a57c-1204-42b9-8024-63d9711898c2")}catch{}})();const Y=w({__name:"Tables",setup(o){const a=h(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>c.list(t)),f=async e=>{const r=await c.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=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:t}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:s}){a.push({name:"tableEditor",params:{tableId:s,projectId:t}})}},{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(t,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)=>(N(),D(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(v),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.54eff993.js.map
