import{d as T,eI as _,eA as k,H as w,b as h,c as I,w as i,u as l,eQ as x,f as E,aq as N,bE as S}from"./outputWidgets.cb8d4118.js";import{G as v}from"./PhPencil.vue.1353d196.js";import{a as D}from"./asyncComputed.602f821b.js";import"./router.86733c93.js";import{T as m}from"./tables.ce03a2ac.js";import"./index.c95ca55f.js";import{C as q}from"./CrudView.e3bbbbbe.js";import{n as d}from"./string.cc9dacff.js";import"./Form.ecb5a9ca.js";import"./hasIn.9378fb46.js";import"./popupNotifcation.901fafde.js";import"./record.3c2cc598.js";import"./pubsub.6650fe4e.js";import"./index.cf4c23b9.js";import"./Paragraph.bf76481e.js";import"./Text.9ccde808.js";import"./Modal.6ccabc4f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.3ef122e0.js";import"./BookOutlined.8ba19dd1.js";import"./url.f415825b.js";import"./index.20961092.js";import"./Title.0c6e5569.js";import"./index.6c0be9cd.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]="ed796001-7e3b-49b1-a915-d898d64236e0",o._sentryDebugIdIdentifier="sentry-dbid-ed796001-7e3b-49b1-a915-d898d64236e0")}catch{}})();const oe=T({__name:"Tables",setup(o){const a=_(),t=k().params.projectId,{loading:c,result:u,refetch:b}=D(()=>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=w(()=>{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:v,label:"Edit Table",onClick({key:C}){a.push({name:"tableEditor",params:{tableId:C,projectId:t}})}},{icon:x,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=>d(e,!0),blur:e=>d(e,!1)}];return(e,r)=>(h(),I(q,{"entity-name":"table",loading:l(c),"docs-path":"tables/overview",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:i(()=>[E(l(S),{onClick:s},{default:i(()=>[N("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{oe as default};
//# sourceMappingURL=Tables.1c455951.js.map
