import{C}from"./CrudView.0f09fc7d.js";import{a as _}from"./ant-design.ac028450.js";import{a as k}from"./asyncComputed.63476e9c.js";import{n as i}from"./string.569a6924.js";import{G as w}from"./PhPencil.vue.a530f1af.js";import{d as h,eo as I,ea as x,f as N,o as D,c as E,w as l,u as m,b as S,aG as v,bT as A,ep as B}from"./index.e1ec3e10.js";import"./gateway.ab874197.js";import{T as d}from"./tables.6ebfa228.js";import"./router.eb7833e2.js";import"./Badge.d52f888f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.74d2d7e6.js";import"./BookOutlined.24fb62d6.js";import"./url.ab92de50.js";import"./PhDotsThreeVertical.vue.4d71fc8b.js";import"./index.3b0dcd0b.js";import"./index.73a3b654.js";import"./popupNotifcation.29a171ed.js";import"./record.e1888f50.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]="51383f6f-0fdc-4e27-b9e5-0b8278b13f1d",o._sentryDebugIdIdentifier="sentry-dbid-51383f6f-0fdc-4e27-b9e5-0b8278b13f1d")}catch{}})();const Z=h({__name:"Tables",setup(o){const a=I(),t=x().params.projectId,{loading:p,result:u,refetch:f}=k(()=>d.list(t)),b=async e=>{const r=await d.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},y=()=>{a.push({name:"sql",params:{projectId:t}})},g=N(()=>{var e,r;return{columns:[{title:"Table Name"},{title:"",align:"right"}],rows:(r=(e=u.value)==null?void 0:e.map(s=>({key:s.id,cells:[{type:"link",text:s.name,to:{name:"tableEditor",params:{tableId:s.id,projectId:t}}},{type:"actions",actions:[{icon:w,label:"Edit Table",onClick({key:n}){a.push({name:"tableEditor",params:{tableId:n,projectId:t}})}},{icon:B,label:"Delete",dangerous:!0,async onClick(){!await _("Are you sure you want to delete this table and all its data?")||(await s.delete(t,s.id),f())}}]}]})))!=null?r:[]}}),T=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(D(),E(C,{"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:T,"create-button-text":"Create Table",create:b},{more:l(()=>[S(m(A),{onClick:y},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.4f67f1ce.js.map
