import{C}from"./CrudView.31513f9f.js";import{a as _}from"./ant-design.bda2eb6f.js";import{a as k}from"./asyncComputed.ab04ecab.js";import{n as i}from"./string.cc8cb5c6.js";import{G as w}from"./PhPencil.vue.c2b1ae9d.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.d4880c83.js";import"./gateway.a0d137e9.js";import{T as d}from"./tables.d7ee83bc.js";import"./router.75fdc349.js";import"./Badge.9c173126.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.21dd9392.js";import"./BookOutlined.dde7ffd2.js";import"./url.d026de0f.js";import"./PhDotsThreeVertical.vue.484f3bdd.js";import"./index.b36f6da6.js";import"./index.7bae905a.js";import"./popupNotifcation.cffcf392.js";import"./record.e19ad39a.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]="44468457-54b9-4955-a1ae-2e85659640b5",o._sentryDebugIdIdentifier="sentry-dbid-44468457-54b9-4955-a1ae-2e85659640b5")}catch{}})();const Z=h({__name:"Tables",setup(o){const a=I(),t=x().params.projectId,{loading:p,result:u,refetch:b}=k(()=>d.list(t)),f=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),b())}}]}]})))!=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:f},{more:l(()=>[S(m(A),{onClick:y},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.d947ceba.js.map
