import{C as T}from"./CrudView.b6646971.js";import{a as _}from"./asyncComputed.a7fc1aad.js";import{n as i}from"./string.3b3d0b2e.js";import{G as k}from"./PhPencil.vue.2e2de584.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.b408cd47.js";import"./gateway.5649747e.js";import{T as c}from"./index.a96bb8d2.js";import"./router.49371dd0.js";import"./Form.30ca3c8c.js";import"./hasIn.dda5a20c.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.21e15a66.js";import"./BookOutlined.9049fb63.js";import"./url.266b2c44.js";import"./Modal.7c3fbdf2.js";import"./index.c368a61e.js";import"./popupNotifcation.e99572f9.js";import"./record.7a308bd3.js";import"./pubsub.e8c4900b.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]="a855f2ed-ea3c-4c1a-a505-41299f2e1cf8",o._sentryDebugIdIdentifier="sentry-dbid-a855f2ed-ea3c-4c1a-a505-41299f2e1cf8")}catch{}})();const Y=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:p,result:u,refetch:f}=_(()=>c.list(a)),b=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:D,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,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)=>(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:b,onSecondaryClick:s},{more:l(()=>[E(m(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.8467ab5e.js.map
