import{C as T}from"./CrudView.b2407c91.js";import{a as _}from"./asyncComputed.78ec0807.js";import{n as i}from"./string.4736890d.js";import{G as k}from"./PhPencil.vue.427485d5.js";import{d as h,eJ as w,eD as I,I as x,b as D,c as N,w as l,u as m,eR as S,f as E,ar as R,bF as v}from"./outputWidgets.a321903e.js";import"./router.2245534d.js";import{T as c}from"./tables.b00c92d8.js";import"./index.579b421e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.29f4fec4.js";import"./BookOutlined.425445e6.js";import"./url.d108fea5.js";import"./Paragraph.53f5a9bc.js";import"./Text.b25e1b1d.js";import"./Form.e0cc6e8e.js";import"./hasIn.62bbbac0.js";import"./Modal.bcb9f272.js";import"./index.fd9a3d7c.js";import"./Title.e1cf3e99.js";import"./index.211632ef.js";import"./popupNotifcation.43dee970.js";import"./record.d39119c8.js";import"./pubsub.df0290b2.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]="2ffb1eee-1c04-453e-9967-e30c195510cc",o._sentryDebugIdIdentifier="sentry-dbid-2ffb1eee-1c04-453e-9967-e30c195510cc")}catch{}})();const ae=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>c.list(t)),f=async e=>{const r=await c.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:S,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=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(D(),N(T,{"entity-name":"table",loading:m(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:f,onSecondaryClick:s},{more:l(()=>[E(m(v),{onClick:s},{default:l(()=>[R("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{ae as default};
//# sourceMappingURL=Tables.365570fc.js.map
