import{C as T}from"./CrudView.8a89e4ec.js";import{a as _}from"./asyncComputed.ce6d6eed.js";import{n as i}from"./string.539604a2.js";import{G as k}from"./PhPencil.vue.63507ef7.js";import{d as h,f7 as w,f1 as I,y as x,b as N,c as S,w as l,u as m,fd as D,f as E,am as v,bF as B}from"./outputWidgets.bff33647.js";import"./gateway.fd75c1ba.js";import{T as d}from"./tables.ffe6f8c7.js";import"./index.b40d3bd7.js";import"./router.8006b2c4.js";import"./Form.70e7f6b0.js";import"./hasIn.edcda2a9.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.2be6635f.js";import"./BookOutlined.62d0439b.js";import"./url.9e111d9b.js";import"./Modal.b7012161.js";import"./index.652b8bc4.js";import"./popupNotifcation.29ddd2ec.js";import"./record.29a71a1c.js";import"./pubsub.897f848f.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]="6b24fbd9-3e78-43fc-9a56-e16b82d81e3f",o._sentryDebugIdIdentifier="sentry-dbid-6b24fbd9-3e78-43fc-9a56-e16b82d81e3f")}catch{}})();const Z=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>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=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:D,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)=>(N(),S(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(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.562e0aeb.js.map
