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 E,aq as N,bE as S}from"./outputWidgets.8f35e76b.js";import{G as v}from"./PhPencil.vue.a25e7075.js";import{a as D}from"./asyncComputed.b2c7682e.js";import"./router.eb6cf81e.js";import{T as m}from"./tables.7c5791e9.js";import"./index.fb4a4209.js";import{C as q}from"./CrudView.4b14d77c.js";import{n as c}from"./string.c4caf5ac.js";import"./Form.357810f8.js";import"./hasIn.38270313.js";import"./popupNotifcation.20f659d9.js";import"./record.56272af3.js";import"./pubsub.aac2ae7d.js";import"./index.cf4c23b9.js";import"./Paragraph.5b35e944.js";import"./Text.cb1b4ad4.js";import"./Modal.3cec70ce.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.7378a41f.js";import"./BookOutlined.b79ac83a.js";import"./url.99f1e379.js";import"./index.30032ec4.js";import"./Title.984d5105.js";import"./index.1d88a799.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]="85bf8372-a28f-4a69-9bc0-13d1feeac38c",o._sentryDebugIdIdentifier="sentry-dbid-85bf8372-a28f-4a69-9bc0-13d1feeac38c")}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.8659c4ce.js.map
