import{C as T}from"./CrudView.24263641.js";import{a as _}from"./asyncComputed.7a4cd8c0.js";import{n as i}from"./string.01321463.js";import{G as k}from"./PhPencil.vue.d1503007.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.0112c29a.js";import"./router.baccdf57.js";import{T as c}from"./tables.4f273d67.js";import"./index.01d20c53.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e7adff9f.js";import"./BookOutlined.cb11abba.js";import"./url.3a6cd3b5.js";import"./Paragraph.a79b7e0d.js";import"./Text.7fd7d6e4.js";import"./Form.f084c7e0.js";import"./hasIn.9ed92b42.js";import"./Modal.4672b2be.js";import"./index.0b86c71c.js";import"./Title.06b9fc65.js";import"./index.84aac883.js";import"./popupNotifcation.b5f4e167.js";import"./record.63beb4c2.js";import"./pubsub.bc9264fd.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="6be493a1-262f-4e8a-aef6-7f7c8245afab",o._sentryDebugIdIdentifier="sentry-dbid-6be493a1-262f-4e8a-aef6-7f7c8245afab")}catch{}})();const te=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>c.list(a)),f=async e=>{const r=await c.create(a,e.name);t.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},s=()=>{t.push({name:"sql",params:{projectId:a}})},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:a}}},{type:"actions",actions:[{icon:k,label:"Edit Table",onClick({key:C}){t.push({name:"tableEditor",params:{tableId:C,projectId:a}})}},{icon:S,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,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{te as default};
//# sourceMappingURL=Tables.b0dc1628.js.map
