import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.737278d2.js";import{v as w,g as h}from"./icons.00e0b192.js";import{a as x}from"./asyncComputed.a421a144.js";import"./authorManager.f6785b31.js";import{T as i}from"./tables.629040fe.js";import"./index.7dd076b6.js";import{C as D}from"./CrudView.094ad1c0.js";import{n as s}from"./string.9653ee3f.js";import"./record.605beade.js";import"./pubsub.88c6ed51.js";import"./gateway.5706e313.js";import"./index.cf4c23b9.js";import"./Text.208da576.js";import"./Title.17b695f3.js";import"./FormItem.b35c2502.js";import"./hasIn.1648684d.js";import"./Form.fbb1233f.js";import"./Modal.2dd7ed00.js";import"./router.c82f2111.js";import"./index.ab3c62e5.js";import"./url.2a6e0213.js";import"./index.5d720f89.js";import"./index.d4ece610.js";import"./index.b108b24d.js";import"./index.9006f0ce.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]="2ae95a9a-e0d4-4f2a-9676-194f799e5813",a._sentryDebugIdIdentifier="sentry-dbid-2ae95a9a-e0d4-4f2a-9676-194f799e5813")}catch{}})();const ee=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:d,refetch:p}=x(()=>i.list(t)),c=async e=>{const r=await i.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},u=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:[]}}),b=[{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:u.value,fields:b,"create-button-text":"Create Table",onCreate:c},null,8,["loading","table"]))}});export{ee as default};
//# sourceMappingURL=Tables.94de9482.js.map
