import{d as y,ez as g,eA as C,J as T,b as _,c as k,u as I}from"./outputWidgets.800838e3.js";import{e as w,q as h}from"./icons.93f59c4e.js";import{a as x}from"./asyncComputed.982dc1f5.js";import"./router.ba9fc25a.js";import"./index.46095ec8.js";import{T as s}from"./tables.f56a3b85.js";import{C as D}from"./CrudView.b259bd34.js";import{n as i}from"./string.6bed8f1b.js";import"./Title.28613ffd.js";import"./index.cc2e9ddf.js";import"./gateway.872328f1.js";import"./activeRecord.9d8d542d.js";import"./pubsub.3b460539.js";import"./index.e0615505.js";import"./Form.b8148ab8.js";import"./url.e7bb6b8a.js";import"./index.9edddcd4.js";import"./index.70fbd67e.js";import"./index.c4440e89.js";import"./index.960544fb.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]="81d7a9ff-cb5f-4c45-a140-1de4da46104a",a._sentryDebugIdIdentifier="sentry-dbid-81d7a9ff-cb5f-4c45-a140-1de4da46104a")}catch{}})();const W=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:d,refetch:c}=x(()=>s.list(t)),p=async e=>{const r=await s.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),c()}}]}]})))!=null?r:[]}}),b=[{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:u.value,fields:b,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{W as default};
//# sourceMappingURL=Tables.9e81e3ba.js.map
