import{d as y,ey as g,ez as C,H as T,b as _,c as k,u as I}from"./outputWidgets.397b3720.js";import{e as w,q as h}from"./icons.5e65f599.js";import{a as x}from"./asyncComputed.28fc9d36.js";import"./router.3bc1b205.js";import"./columns.37df3c3d.js";import{T as s}from"./tables.d75dd5b8.js";import{C as D}from"./CrudView.77c1d16d.js";import{n as i}from"./string.f3e41ceb.js";import"./Title.382247fb.js";import"./index.06276212.js";import"./gateway.b868389d.js";import"./activeRecord.6bb6b853.js";import"./pubsub.fe0f0397.js";import"./index.f4ac7424.js";import"./index.19008df2.js";import"./Form.5ce50c8f.js";import"./url.53bc193a.js";import"./index.4acaedbb.js";import"./index.c9ea7155.js";import"./index.40ca2e79.js";import"./index.e12747aa.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]="1a43a011-80b8-4db2-aace-62a87d7330f1",a._sentryDebugIdIdentifier="sentry-dbid-1a43a011-80b8-4db2-aace-62a87d7330f1")}catch{}})();const X=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{X as default};
//# sourceMappingURL=Tables.9b395483.js.map
