import{d as T,eI as _,eA as k,H as w,b as h,c as I,w as i,u as l,eQ as x,f as E,aq as N,bE as S}from"./outputWidgets.67d01534.js";import{G as v}from"./PhPencil.vue.fd512d1d.js";import{a as D}from"./asyncComputed.9c2e7c90.js";import"./router.da0efacf.js";import{T as m}from"./tables.a3d58f38.js";import"./index.af8a2c28.js";import{C as q}from"./CrudView.d78585d4.js";import{n as c}from"./string.73a83215.js";import"./Form.18143f38.js";import"./hasIn.18867aca.js";import"./popupNotifcation.48a418fa.js";import"./record.97ce606c.js";import"./pubsub.ce0b10ac.js";import"./index.cf4c23b9.js";import"./Paragraph.5d6efe5b.js";import"./Text.fce07a64.js";import"./Modal.e44b2640.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.00cfbae2.js";import"./BookOutlined.93eb4c42.js";import"./url.df413b89.js";import"./index.3dca3a8f.js";import"./Title.3431c309.js";import"./index.378e6c26.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]="cced21ec-6d85-4c5c-8eb4-8400be5834f5",o._sentryDebugIdIdentifier="sentry-dbid-cced21ec-6d85-4c5c-8eb4-8400be5834f5")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:u,refetch:b}=D(()=>m.list(t)),f=async e=>{const r=await m.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},s=()=>{a.push({name:"sql",params:{projectId:t}})},y=w(()=>{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:v,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:x,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=>c(e,!0),blur:e=>c(e,!1)}];return(e,r)=>(h(),I(q,{"entity-name":"table",loading:l(p),"docs-path":"tables/overview",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:i(()=>[E(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.64b7a832.js.map
