import{C as T}from"./CrudView.e2192329.js";import{a as _}from"./asyncComputed.a50f21d4.js";import{n as i}from"./string.3bdd59f2.js";import{G as k}from"./PhPencil.vue.75024b51.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.7323a17d.js";import"./router.7bb92c0e.js";import{T as c}from"./tables.380f1031.js";import"./index.c9f11f2b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d07c372f.js";import"./BookOutlined.22bb6522.js";import"./url.50c4a8f0.js";import"./Paragraph.1e67eefb.js";import"./Base.003f7172.js";import"./Form.4d35a934.js";import"./hasIn.adc00278.js";import"./Modal.8e6a9189.js";import"./index.42443749.js";import"./Title.88a7d0e4.js";import"./Text.a0b69008.js";import"./index.211f7220.js";import"./popupNotifcation.4e57751c.js";import"./record.1f033572.js";import"./pubsub.2c3883f4.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]="140e1995-5732-4e0b-9f4e-f52a149ae2c8",o._sentryDebugIdIdentifier="sentry-dbid-140e1995-5732-4e0b-9f4e-f52a149ae2c8")}catch{}})();const oe=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:d,result:u,refetch:b}=_(()=>c.list(t)),f=async e=>{const r=await c.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(),D(T,{"entity-name":"table",loading:m(d),"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.4cc4cec9.js.map
