import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.c4f3de67.js";import{e as w,g as h}from"./icons.49e74e71.js";import{a as x}from"./asyncComputed.c75b06d6.js";import"./router.88734ca5.js";import"./columns.aa61756c.js";import{T as s}from"./tables.626ccc4e.js";import{C as D}from"./CrudView.4072ea68.js";import{n as i}from"./string.f2726d1b.js";import"./Base.9ed9c296.js";import"./transButton.ebe60b80.js";import"./Text.fcf8f28f.js";import"./Title.345a4775.js";import"./index.db3809d7.js";import"./record.685c8ba7.js";import"./pubsub.1842fa2d.js";import"./gateway.5578a098.js";import"./url.d2782274.js";import"./index.c4339fad.js";import"./index.b168b141.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]="90eeccee-a08b-47af-b7bb-efe6401cc597",a._sentryDebugIdIdentifier="sentry-dbid-90eeccee-a08b-47af-b7bb-efe6401cc597")}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)),p=async e=>{const r=await s.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=>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:b.value,fields:u,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{U as default};
//# sourceMappingURL=Tables.4b1c3d72.js.map
