import{C as T}from"./CrudView.88823d06.js";import{a as _}from"./asyncComputed.06ede41f.js";import{n as i}from"./string.21869e46.js";import{G as k}from"./PhPencil.vue.09a8c9d5.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 d,eS as N,f as D,as as v,bG as B}from"./outputWidgets.6e1c5425.js";import"./router.4a0ba06b.js";import{T as m}from"./tables.40d51dc6.js";import"./index.76daa7f6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.3a6e05dd.js";import"./BookOutlined.8202b78f.js";import"./url.5357e9db.js";import"./Paragraph.4ce326b3.js";import"./Base.0277cf44.js";import"./Form.b82a2cec.js";import"./hasIn.bf07751b.js";import"./Modal.e50e9e9a.js";import"./index.c12e1c2f.js";import"./Title.dfd37452.js";import"./Text.b10c1140.js";import"./index.1442882a.js";import"./popupNotifcation.76f4dd63.js";import"./record.c7d63161.js";import"./pubsub.4f3043c8.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]="3d4d73df-f99e-4cef-b61a-e6dd29e1d45f",o._sentryDebugIdIdentifier="sentry-dbid-3d4d73df-f99e-4cef-b61a-e6dd29e1d45f")}catch{}})();const oe=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:f}=_(()=>m.list(t)),b=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=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),f()}}]}]})))!=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:d(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:b,onSecondaryClick:s},{more:l(()=>[D(d(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.1253714f.js.map
