import{d as y,ey as g,ez as C,H as T,b as _,c as k,u as I}from"./outputWidgets.942e04a7.js";import{e as w,q as h}from"./icons.c37bd5be.js";import{a as x}from"./asyncComputed.581a6d32.js";import"./router.88ac172f.js";import"./columns.b249ad7a.js";import{T as s}from"./tables.28f8e36d.js";import{C as D}from"./CrudView.ef33eac6.js";import{n as i}from"./string.04c89323.js";import"./Title.02f374d5.js";import"./index.6d3b437a.js";import"./gateway.c853ac2b.js";import"./activeRecord.c49c8827.js";import"./pubsub.c4874b0f.js";import"./index.f4ac7424.js";import"./index.a0056785.js";import"./Form.fa989528.js";import"./url.c27b4b3f.js";import"./index.afbbab9c.js";import"./index.a1c695e0.js";import"./index.f7b7cb5d.js";import"./index.182b7916.js";import"./index.90e879e1.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[o]="427b1e03-35ee-45f2-b8f5-edb4865a8652",a._sentryDebugIdIdentifier="sentry-dbid-427b1e03-35ee-45f2-b8f5-edb4865a8652")}catch{}})();const Y=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:d,refetch:p}=x(()=>s.list(t)),c=async e=>{const r=await s.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},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:t}}},{text:"Actions",actions:[{icon:w,label:"Edit Table",onClick({key:f}){o.push({name:"tableEditor",params:{tableId:f,projectId:t}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await n.delete(t,n.id),p()}}]}]})))!=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:c},null,8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.64dde81b.js.map
