import{C as T}from"./CrudView.821928b5.js";import{a as _}from"./asyncComputed.4b2a24b4.js";import{n as i}from"./string.76ce519c.js";import{G as k}from"./PhPencil.vue.a8f9b005.js";import{d as h,eH as w,eu as I,f as x,c as N,w as l,u as c,eI as S,o as D,b as E,ax as v,bL as B}from"./vue-router.967882c8.js";import"./gateway.1fc7330e.js";import{T as m}from"./tables.784ba641.js";import"./router.b1ab1f0b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.2e123e3b.js";import"./BookOutlined.b1798d50.js";import"./url.ca479924.js";import"./PhDotsThree.vue.ed01f94c.js";import"./index.c157968f.js";import"./index.1d0b7068.js";import"./popupNotifcation.a1aa96a2.js";import"./record.b0f25f8f.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]="391f85ce-c1cd-4bef-8184-fb0206650ec4",o._sentryDebugIdIdentifier="sentry-dbid-391f85ce-c1cd-4bef-8184-fb0206650ec4")}catch{}})();const W=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>m.list(t)),f=async e=>{const r=await m.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},s=()=>{a.push({name:"sql",params:{projectId:t}})},y=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:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:S,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),b()}}]}]})))!=null?r:[]}}),g=[{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:c(p),"docs-path":"cloud/tables",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:y.value,fields:g,"create-button-text":"Create Table",onCreate:f,onSecondaryClick:s},{more:l(()=>[E(c(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.5298c91f.js.map
