import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.5836624b.js";import{e as w,g as h}from"./icons.715dfb53.js";import{a as x}from"./asyncComputed.134d378f.js";import"./router.6746eb60.js";import"./columns.4caf6e41.js";import{T as s}from"./tables.df4d016e.js";import{C as D}from"./CrudView.31db109e.js";import{n as i}from"./string.5f84c0cf.js";import"./Base.e549b429.js";import"./transButton.c5f8a15c.js";import"./Text.f4671d75.js";import"./Title.5e396b16.js";import"./index.ba80cfa7.js";import"./record.07dfd257.js";import"./pubsub.a82123ee.js";import"./gateway.681b899a.js";import"./url.3b0a0ce2.js";import"./index.636b5d6d.js";import"./index.8d4f5f15.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]="5229dea3-edb2-4b20-814d-9f1666a93a9d",a._sentryDebugIdIdentifier="sentry-dbid-5229dea3-edb2-4b20-814d-9f1666a93a9d")}catch{}})();const U=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}})},b=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:[]}}),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.0529382b.js.map
