import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.e33755f8.js";import{v as w,g as h}from"./icons.f6b19bc0.js";import{a as x}from"./asyncComputed.8bd4aeca.js";import"./authorManager.62b862f9.js";import{T as i}from"./tables.5b3d5fb0.js";import"./index.0a6756f7.js";import{C as D}from"./CrudView.2f0c3c83.js";import{n as s}from"./string.c37cf2a8.js";import"./record.fe2d13ca.js";import"./pubsub.d8fbcc91.js";import"./gateway.f3da19f9.js";import"./index.cf4c23b9.js";import"./Text.03e848c4.js";import"./Title.ac2baa04.js";import"./FormItem.fdb358e6.js";import"./hasIn.5c4a4bf3.js";import"./Form.e78b9235.js";import"./Modal.e934f1f6.js";import"./router.8c7b3fad.js";import"./index.9f6d3055.js";import"./url.3d250afc.js";import"./index.98828044.js";import"./index.58a4a13c.js";import"./index.4b06b554.js";import"./index.72b0b8fe.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]="945e68bc-8a4c-4a4a-93b4-f39d9f380114",a._sentryDebugIdIdentifier="sentry-dbid-945e68bc-8a4c-4a4a-93b4-f39d9f380114")}catch{}})();const ee=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:c,refetch:d}=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=c.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),d()}}]}]})))!=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.e011f0fe.js.map
