import{d as T,eI as _,eA as k,H as w,b as h,c as I,w as i,u as l,eP as x,f as N,aq as S,bF as v}from"./outputWidgets.1c4947c7.js";import{G as D}from"./PhPencil.vue.d41e1ee1.js";import{a as E}from"./asyncComputed.ab9c45d0.js";import"./router.f814fb07.js";import{T as d}from"./tables.ab350b64.js";import"./index.bf745b17.js";import{C as q}from"./CrudView.54cbe4c4.js";import{n as m}from"./string.e807dded.js";import"./Form.cba5cdce.js";import"./hasIn.58acd238.js";import"./popupNotifcation.bd532d77.js";import"./record.438e3693.js";import"./pubsub.87f1efb9.js";import"./index.cf4c23b9.js";import"./Paragraph.110c4a21.js";import"./Text.4ed32514.js";import"./Modal.5c7e6d3c.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.f7859d2d.js";import"./url.ca3e5e32.js";import"./index.a9af7b0b.js";import"./Title.6f4ab7f6.js";import"./index.83f629a7.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]="d1a92d05-9d01-4f6c-aa6c-dfdb06780d34",o._sentryDebugIdIdentifier="sentry-dbid-d1a92d05-9d01-4f6c-aa6c-dfdb06780d34")}catch{}})();const ae=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:p,result:u,refetch:b}=E(()=>d.list(t)),f=async e=>{const r=await d.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:D,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=>m(e,!0),blur:e=>m(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(()=>[N(l(v),{onClick:s},{default:i(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{ae as default};
//# sourceMappingURL=Tables.4f3e6cc8.js.map
