import{d as f,ex as y,ey as _,F as g,b as I,u as T,bu as w}from"./registerWidgets.751c4cc6.js";import{f as C,q as h}from"./icons.839289ff.js";import{a as k}from"./asyncComputed.4ba8b2d8.js";import{C as x}from"./CrudView.55a91fc3.js";import"./gateway.a29f1b8a.js";import"./index.1677387f.js";import{T as n}from"./tables.1c532c37.js";import"./DropdownMenu.3730f8d7.js";import"./Modal.2619bb1d.js";import"./LoadingIndicator.e1d41754.js";import"./lottie.2da9cd67.js";import"./passwordlessManager.8b22003c.js";import"./pubsub.87f27d54.js";import"./storage.fbef8aee.js";import"./activeRecord.91f4e05e.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6c8e458e-c2b5-4e8f-8a12-3e44f261f482",e._sentryDebugIdIdentifier="sentry-dbid-6c8e458e-c2b5-4e8f-8a12-3e44f261f482")}catch{}})();const J=f({__name:"Tables",setup(e){const t=y(),a=_().params.projectId,{loading:i,result:c,refetch:d}=k(()=>n.list(a)),m=async o=>{const s=await n.create(a,o.name);t.push({name:"tableEditor",params:{tableId:s.id,projectId:a}})},p=g(()=>{var o,s;return{columns:[{name:"Table Name"},{name:"Table Actions"}],rows:(s=(o=c.value)==null?void 0:o.map(r=>({key:r.id,cells:[{text:r.name,classes:["title","centered"]},{text:"Actions",classes:["centered"],actions:[{icon:C,label:"Edit Table",onClick({key:b}){t.push({name:"tableEditor",params:{tableId:b,projectId:a}})}},{icon:h,label:"Delete",dangerous:!0,async onClick(){await r.delete(a,r.id),d()}}]}]})))!=null?s:[]}}),u=[{key:"name",label:"Table name",type:"text"}];return(o,s)=>(I(),T(x,{"entity-name":"table",loading:w(i),title:"Database Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:p.value,fields:u,"create-button-text":"Create Table",onCreate:m},null,8,["loading","table"]))}});export{J as default};
//# sourceMappingURL=Tables.884d36ee.js.map
