import{C as k}from"./CrudView.858975e6.js";import{a as T}from"./asyncComputed.bd2b6e70.js";import{n as i}from"./string.18a9daee.js";import{G as _}from"./PhPencil.vue.7371bf48.js";import{d as h,eF as w,ey as I,y as x,b as N,c as S,w as l,u as m,eL as D,f as E,ak as v,bz as B}from"./outputWidgets.f7b80e9f.js";import"./gateway.58b63376.js";import{T as c}from"./index.f21af923.js";import"./router.6fb3acdf.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b36f7510.js";import"./BookOutlined.12f9401e.js";import"./url.882128c4.js";import"./index.288a68e3.js";import"./index.86fdb625.js";import"./popupNotifcation.6f5b518c.js";import"./record.188928bf.js";import"./pubsub.10df5fd2.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]="f130f437-780b-4d2c-9fb7-b3dc3485be16",o._sentryDebugIdIdentifier="sentry-dbid-f130f437-780b-4d2c-9fb7-b3dc3485be16")}catch{}})();const W=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:b,refetch:u}=T(()=>c.list(t)),f=async e=>{const r=await c.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=b.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:_,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:D,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),u()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(N(),S(k,{"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:y.value,fields:g,"create-button-text":"Create Table",onCreate:f,onSecondaryClick:s},{more:l(()=>[E(m(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.735f7684.js.map
