import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.e60ab380.js";import{e as w,g as h}from"./icons.6c1915db.js";import{a as x}from"./asyncComputed.7ba647bd.js";import"./router.0cf2e70d.js";import"./columns.4c9d4799.js";import{T as s}from"./tables.76d4f4c4.js";import{C as D}from"./CrudView.a4f4d47c.js";import{n as i}from"./string.0562bcfe.js";import"./Base.0638c3f7.js";import"./transButton.1b3f66c8.js";import"./Text.742cb8ec.js";import"./Title.666a14b1.js";import"./index.1462457d.js";import"./record.04c6d5a0.js";import"./pubsub.e6733ea4.js";import"./gateway.990f0877.js";import"./url.7bd60adc.js";import"./index.ed25df4f.js";import"./index.aaa1fe24.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]="b12a0a61-b5c4-40b7-ab8d-6f8ece0b36b6",a._sentryDebugIdIdentifier="sentry-dbid-b12a0a61-b5c4-40b7-ab8d-6f8ece0b36b6")}catch{}})();const U=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:c,refetch:d}=x(()=>s.list(t)),b=async e=>{const r=await s.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},p=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=>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:p.value,fields:u,"create-button-text":"Create Table",onCreate:b},null,8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.fbf257e0.js.map
