import{C as T}from"./CrudView.797f086e.js";import{a as _}from"./asyncComputed.72143f3b.js";import{n}from"./string.4a3650cc.js";import{G as k}from"./PhPencil.vue.bb6c5a6a.js";import{d as h,ek as w,e7 as x,f as I,c as N,w as l,u as i,el as D,o as E,b as S,ax as v,bL as B}from"./vue-router.97d0d8a6.js";import"./gateway.91a35dd3.js";import{T as c}from"./tables.8944c1e2.js";import"./router.bf9d2a86.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.05d4ef76.js";import"./BookOutlined.868baafb.js";import"./url.6a6403b0.js";import"./PhDotsThree.vue.3d83613d.js";import"./index.557e8025.js";import"./popupNotifcation.80047f06.js";import"./record.a84b6d90.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]="40ca454d-124c-48e9-a8c1-c1d1feff3f10",o._sentryDebugIdIdentifier="sentry-dbid-40ca454d-124c-48e9-a8c1-c1d1feff3f10")}catch{}})();const U=h({__name:"Tables",setup(o){const t=w(),a=x().params.projectId,{loading:d,result:p,refetch:u}=_(()=>c.list(a)),f=async e=>{const r=await c.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},b=()=>{t.push({name:"sql",params:{projectId:a}})},y=I(()=>{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: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 s.delete(a,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)=>(E(),N(T,{"entity-name":"table",loading:i(d),"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},{more:l(()=>[S(i(B),{onClick:b},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.7f1beabb.js.map
