import{C as T}from"./CrudView.429e2094.js";import{a as _}from"./asyncComputed.7ed124a4.js";import{n as i}from"./string.8f29ec33.js";import{G as k}from"./PhPencil.vue.1a0543c3.js";import{d as h,f7 as w,f1 as I,y as x,b as N,c as S,w as l,u as m,fd as D,f as E,am as v,bF as B}from"./outputWidgets.fb72f334.js";import"./gateway.9d0e9a56.js";import{T as c}from"./index.6110cacc.js";import"./router.775ef26f.js";import"./Form.829a2cd2.js";import"./hasIn.ebbb1eda.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.96c0e5a0.js";import"./BookOutlined.6eee3e13.js";import"./url.14a615f7.js";import"./Modal.082f2dc7.js";import"./index.5b13efd4.js";import"./popupNotifcation.d53949ca.js";import"./record.7e471bce.js";import"./pubsub.b6388b69.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]="947355e7-8b38-40e4-a452-97e13ba5c15a",o._sentryDebugIdIdentifier="sentry-dbid-947355e7-8b38-40e4-a452-97e13ba5c15a")}catch{}})();const Y=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>c.list(a)),f=async e=>{const r=await c.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),b()}}]}]})))!=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(T,{"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{Y as default};
//# sourceMappingURL=Tables.b6947ec7.js.map
