import{C as T}from"./CrudView.5a4776e3.js";import{a as _}from"./asyncComputed.8f047c40.js";import{n as i}from"./string.8d4f9524.js";import{G as k}from"./PhPencil.vue.a435f271.js";import{d as h,eK as w,eE as I,J as x,b as S,c as E,w as l,u as d,eS as N,f as D,as as v,bG as B}from"./outputWidgets.7dd23d3d.js";import"./router.55ae8196.js";import{T as m}from"./tables.554d7ec4.js";import"./index.c33cd5e4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e5b6cc98.js";import"./BookOutlined.ecab59cc.js";import"./url.6301f7e9.js";import"./Paragraph.7df229fc.js";import"./Base.4bf9624b.js";import"./Form.9f41d3b4.js";import"./hasIn.7d5dcda7.js";import"./Modal.5fb5fcda.js";import"./index.8d63ab0d.js";import"./Title.0952eb37.js";import"./Text.8f0caa1d.js";import"./index.a5cb16ca.js";import"./popupNotifcation.f54fc99f.js";import"./record.4544f931.js";import"./pubsub.692bcdfa.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]="dcca8faf-c588-441b-bd6f-8dcd7bd3d82a",o._sentryDebugIdIdentifier="sentry-dbid-dcca8faf-c588-441b-bd6f-8dcd7bd3d82a")}catch{}})();const oe=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>m.list(t)),f=async e=>{const r=await m.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:N,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)=>(S(),E(T,{"entity-name":"table",loading:d(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(()=>[D(d(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.af03e1ea.js.map
