import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.31ce2d5c.js";import{v as w,g as h}from"./icons.266b547d.js";import{a as x}from"./asyncComputed.7e3e21f4.js";import"./router.8f071dc2.js";import{T as i}from"./tables.0f97709f.js";import"./index.e05c62e3.js";import{C as D}from"./CrudView.9d67f588.js";import{n as s}from"./string.e57cb081.js";import"./FormItem.5f0b61bf.js";import"./hasIn.932773c2.js";import"./index.0d76378d.js";import"./record.b2148451.js";import"./pubsub.2d9ab3f4.js";import"./gateway.3615e807.js";import"./index.cf4c23b9.js";import"./Text.46c5bec2.js";import"./Base.eeda2dae.js";import"./Form.482980d3.js";import"./Modal.32a7843c.js";import"./url.94a5ee71.js";import"./index.627ab86d.js";import"./index.ef6e34b6.js";import"./Title.951eccc5.js";import"./index.5765ee72.js";import"./index.f1d2e592.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]="5e4ec0bc-33ae-4d48-8e23-e8d575476b0a",a._sentryDebugIdIdentifier="sentry-dbid-5e4ec0bc-33ae-4d48-8e23-e8d575476b0a")}catch{}})();const ee=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:d,refetch:c}=x(()=>i.list(t)),p=async e=>{const r=await i.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),c()}}]}]})))!=null?r:[]}}),u=[{key:"name",label:"Table name",type:"text",format:e=>s(e,!0),blur:e=>s(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{ee as default};
//# sourceMappingURL=Tables.cf28e316.js.map
