import{C as T}from"./CrudView.b9ba563d.js";import{a as _}from"./asyncComputed.b227690c.js";import{n as i}from"./string.bb1c83aa.js";import{G as k}from"./PhPencil.vue.e931b93e.js";import{d as h,eK as w,eE as I,J as x,b as S,c as E,w as l,u as m,eS as N,f as D,as as v,bG as B}from"./outputWidgets.2c936b33.js";import"./router.9a76cc66.js";import{T as c}from"./tables.e9ddeeec.js";import"./index.bd2be0a2.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.dd7fbd1a.js";import"./BookOutlined.31cb7ffb.js";import"./url.a282f1d5.js";import"./Paragraph.51f31516.js";import"./Base.7b44942c.js";import"./Form.b5e24132.js";import"./hasIn.85b27717.js";import"./Modal.17cdde78.js";import"./index.18754ce2.js";import"./Title.6affb5db.js";import"./Text.a2f30647.js";import"./index.f0d39170.js";import"./popupNotifcation.a42892dc.js";import"./record.210736c4.js";import"./pubsub.4c454988.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]="5c673173-ccd1-444d-9e48-8e7db7d0b6c5",o._sentryDebugIdIdentifier="sentry-dbid-5c673173-ccd1-444d-9e48-8e7db7d0b6c5")}catch{}})();const oe=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>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=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:t}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:N,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,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)=>(S(),E(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(()=>[D(m(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.09f5f30a.js.map
