import{d as y,ez as g,eA as C,J as T,b as _,c as k,u as I}from"./outputWidgets.5ced94d7.js";import{e as w,q as h}from"./icons.157295a5.js";import{a as x}from"./asyncComputed.6f213f9d.js";import"./router.c33f3e79.js";import"./index.13e3df9c.js";import{T as s}from"./tables.4df54a6e.js";import{C as D}from"./CrudView.1c9778e2.js";import{n as i}from"./string.cd43f06a.js";import"./Title.74cb802d.js";import"./index.48bbb941.js";import"./gateway.06420003.js";import"./activeRecord.6ae8bce9.js";import"./pubsub.f395e26b.js";import"./index.8ea91ac5.js";import"./Form.3717142f.js";import"./url.b91ad4a3.js";import"./index.54325f84.js";import"./index.d48bc6c3.js";import"./index.c946e10c.js";import"./index.fe1573f2.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="28f37c8a-fcb5-4e8d-8fa1-d1aba2838a9d",t._sentryDebugIdIdentifier="sentry-dbid-28f37c8a-fcb5-4e8d-8fa1-d1aba2838a9d")}catch{}})();const W=y({__name:"Tables",setup(t){const o=g(),a=C().params.projectId,{loading:m,result:d,refetch:c}=x(()=>s.list(a)),p=async e=>{const r=await s.create(a,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},b=T(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"Actions",align:"right"}],rows:(r=(e=d.value)==null?void 0:e.map(n=>({key:n.id,cells:[{text:n.name,link:{name:"tableEditor",params:{tableId:n.id,projectId:a}}},{text:"Actions",actions:[{icon:w,label:"Edit Table",onClick({key:f}){o.push({name:"tableEditor",params:{tableId:f,projectId:a}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(a,n.id),c()}}]}]})))!=null?r:[]}}),u=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(_(),k(D,{"entity-name":"table",loading:I(m),title:"Database Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:b.value,fields:u,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.45c653f4.js.map
