import{C as T}from"./CrudView.153891cb.js";import{a as _}from"./asyncComputed.1c2e733f.js";import{n as i}from"./string.08374cff.js";import{G as k}from"./PhPencil.vue.a76c3b26.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 m,eS as N,f as D,as as v,bG as B}from"./outputWidgets.f4ff73cb.js";import"./router.579c91e6.js";import{T as c}from"./tables.15085f03.js";import"./index.4ca46dd8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.273d3e2a.js";import"./BookOutlined.eb157924.js";import"./url.f4aa4fed.js";import"./Paragraph.0762ff9a.js";import"./Base.2cf6cca2.js";import"./Form.c8ea7c3d.js";import"./hasIn.c05f2ad3.js";import"./Modal.fb9d97fb.js";import"./index.38a388d2.js";import"./Title.8356c432.js";import"./Text.b0ae0f80.js";import"./index.72e9756f.js";import"./popupNotifcation.d7d31af4.js";import"./record.06ee4427.js";import"./pubsub.f8e50115.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]="bef61d9c-8285-4903-8dda-bc1c3c6405d6",o._sentryDebugIdIdentifier="sentry-dbid-bef61d9c-8285-4903-8dda-bc1c3c6405d6")}catch{}})();const oe=h({__name:"Tables",setup(o){const a=w(),t=I().params.projectId,{loading:p,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(),E(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(()=>[D(m(B),{onClick:s},{default:l(()=>[v("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.da4fe242.js.map
