import{C as T}from"./CrudView.426bc79f.js";import{a as _}from"./asyncComputed.0c2e75f9.js";import{n}from"./string.26e1c29c.js";import{G as k}from"./PhPencil.vue.5193f1aa.js";import{d as h,eq as w,ed as I,f as x,c as N,w as l,u as i,o as S,b as D,aF as E,bS as q,er as v}from"./vue-router.4a8a3251.js";import"./gateway.8fe65dcb.js";import{T as m}from"./tables.fc036ba1.js";import"./router.306a90e5.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.167ba099.js";import"./BookOutlined.302f99d5.js";import"./url.11181b9e.js";import"./PhDotsThreeVertical.vue.ccd7c778.js";import"./index.81074c92.js";import"./popupNotifcation.d430940c.js";import"./record.2a0e778d.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]="eab158f3-000d-4f70-8860-290c49f80be3",o._sentryDebugIdIdentifier="sentry-dbid-eab158f3-000d-4f70-8860-290c49f80be3")}catch{}})();const U=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:c,result:p,refetch:u}=_(()=>m.list(t)),b=async e=>{const r=await m.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},f=()=>{a.push({name:"sql",params:{projectId:t}})},y=x(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=p.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:k,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:v,label:"Delete",dangerous:!0,async onClick(){await s.delete(t,s.id),u()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>n(e,!0),blur:e=>n(e,!1)}];return(e,r)=>(S(),N(T,{"entity-name":"table",loading:i(c),"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},{more:l(()=>[D(i(q),{onClick:f},{default:l(()=>[E("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.2b4e7641.js.map
