import{C as T}from"./CrudView.08af3b90.js";import{a as _}from"./asyncComputed.a619212b.js";import{n as i}from"./string.ad40d63c.js";import{G as k}from"./PhPencil.vue.6be3e07b.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.be3472c2.js";import"./router.87bf43b6.js";import{T as d}from"./tables.b5d57d48.js";import"./index.86288308.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.f9aebc41.js";import"./BookOutlined.53049b66.js";import"./url.7fe1be7b.js";import"./Paragraph.7601abde.js";import"./Text.c9febe27.js";import"./Form.254a7379.js";import"./hasIn.bddd0a1a.js";import"./Modal.304207b8.js";import"./index.ba676107.js";import"./Title.65752aa0.js";import"./index.6773e8c7.js";import"./popupNotifcation.9025cc7b.js";import"./record.820df198.js";import"./pubsub.1063a0da.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]="1b3927dd-208e-4419-aaf3-13f494024119",o._sentryDebugIdIdentifier="sentry-dbid-1b3927dd-208e-4419-aaf3-13f494024119")}catch{}})();const ae=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: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.3a20282f.js.map
