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.260a3c99.js";import{G as v}from"./PhPencil.vue.78f87dc9.js";import{a as D}from"./asyncComputed.61df0e0c.js";import"./router.c6bba0da.js";import{T as m}from"./tables.89c8f202.js";import"./index.16d63baf.js";import{C as q}from"./CrudView.9c881ed3.js";import{n as c}from"./string.e9dcebd7.js";import"./Form.46e378f9.js";import"./hasIn.8ab3cbf4.js";import"./popupNotifcation.87bdba7f.js";import"./record.608c7c8c.js";import"./pubsub.ab27f2c0.js";import"./index.cf4c23b9.js";import"./Paragraph.482f5128.js";import"./Text.3b774738.js";import"./Modal.6a26a016.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e08dd3ee.js";import"./BookOutlined.9a33e452.js";import"./url.13938513.js";import"./index.34fd2dd9.js";import"./Title.9673e08a.js";import"./index.a74fba23.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]="4cbeadc4-3277-4a83-93df-374cfbc2aafd",o._sentryDebugIdIdentifier="sentry-dbid-4cbeadc4-3277-4a83-93df-374cfbc2aafd")}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.2d5af3f5.js.map
