import{C as T}from"./CrudView.30543074.js";import{a as _}from"./asyncComputed.c7982027.js";import{n as l}from"./string.79d7b0e1.js";import{G as k}from"./PhPencil.vue.5fbcac5a.js";import{d as h,eJ as w,eC as I,J as x,o as N,c as S,w as i,u as d,eP as D,b as E,ar as v,bG as B}from"./vue-router.6b399b0b.js";import"./gateway.34f2a318.js";import{T as m}from"./index.c3b84c4d.js";import"./router.ab3f179a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e21048fc.js";import"./BookOutlined.7993dbf1.js";import"./url.2f4a4260.js";import"./index.57cdc892.js";import"./index.2e72b67b.js";import"./popupNotifcation.17b9c327.js";import"./record.f5201a57.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]="6ffa214e-d01a-43ae-afed-834fda342bf4",o._sentryDebugIdIdentifier="sentry-dbid-6ffa214e-d01a-43ae-afed-834fda342bf4")}catch{}})();const U=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:u,refetch:f}=_(()=>m.list(a)),b=async e=>{const r=await m.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},s=()=>{t.push({name:"sql",params:{projectId:a}})},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:a}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:C}){t.push({name:"tableEditor",params:{tableId:C,projectId:a}})}},{icon:D,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,n.id),f()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>l(e,!0),blur:e=>l(e,!1)}];return(e,r)=>(N(),S(T,{"entity-name":"table",loading:d(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:b,onSecondaryClick:s},{more:i(()=>[E(d(B),{onClick:s},{default:i(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.0347e3b9.js.map
