import{C as T}from"./CrudView.542c4e4e.js";import{a as _}from"./asyncComputed.2210bd1a.js";import{n as i}from"./string.569e33f0.js";import{G as k}from"./PhPencil.vue.155bd1a7.js";import{d as h,eM as w,eG as I,D as x,b as S,c as D,w as l,u as m,eS as N,f as E,au as v,bI as B}from"./outputWidgets.e5f9ffc6.js";import"./router.dd631582.js";import{T as d}from"./tables.ec911373.js";import"./index.889e1616.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.670b5628.js";import"./BookOutlined.7d01e6a5.js";import"./url.c11ddd9f.js";import"./Paragraph.1cbc8077.js";import"./Base.d0d329e2.js";import"./Form.b45c0335.js";import"./hasIn.54609e4a.js";import"./Modal.e18542c5.js";import"./index.2570caf9.js";import"./Title.f988141d.js";import"./Text.e6c27a3b.js";import"./index.f056a823.js";import"./popupNotifcation.9671db62.js";import"./record.3c5b5204.js";import"./pubsub.75396d00.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]="8b57dba2-71d1-4eba-a2b8-e1ad25ae621a",o._sentryDebugIdIdentifier="sentry-dbid-8b57dba2-71d1-4eba-a2b8-e1ad25ae621a")}catch{}})();const oe=h({__name:"Tables",setup(o){const t=w(),a=I().params.projectId,{loading:c,result:b,refetch:u}=_(()=>d.list(a)),f=async e=>{const r=await d.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=b.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:N,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,n.id),u()}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(S(),D(T,{"entity-name":"table",loading:m(c),"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{oe as default};
//# sourceMappingURL=Tables.15e77d2b.js.map
