import{C as T}from"./CrudView.c7c3d33a.js";import{a as _}from"./asyncComputed.6b2a5298.js";import{n as i}from"./string.b8fb39c3.js";import{G as k}from"./PhPencil.vue.3ad2fce1.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.eb498848.js";import"./router.dc5374c0.js";import{T as c}from"./tables.2249a1de.js";import"./index.38387dc8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.083d7014.js";import"./BookOutlined.d5ff4087.js";import"./url.1d686ce1.js";import"./Paragraph.82d8120c.js";import"./Base.60455d70.js";import"./Form.bd9a7b94.js";import"./hasIn.ceb11556.js";import"./Modal.19adabd3.js";import"./index.60acdd5f.js";import"./Title.ef0a0830.js";import"./Text.c3630863.js";import"./index.98ba73a6.js";import"./popupNotifcation.1234df84.js";import"./record.7cc6fca0.js";import"./pubsub.1ca1fb40.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]="75c7e4a4-35c2-4a1e-ae70-984093d65871",o._sentryDebugIdIdentifier="sentry-dbid-75c7e4a4-35c2-4a1e-ae70-984093d65871")}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.d335d8c2.js.map
