import{d as y,ey as g,ez as k,H as C,b as T,c as _,u as I}from"./outputWidgets.1739e6b5.js";import{e as w,k as h}from"./icons.1c3e2bde.js";import{a as x}from"./asyncComputed.b4d87a94.js";import"./router.95125983.js";import"./columns.0d2e1661.js";import{T as s}from"./tables.10768e9f.js";import{C as D}from"./CrudView.245e4133.js";import{n as i}from"./string.1ae4cb50.js";import"./Title.1261c75a.js";import"./index.92715e30.js";import"./gateway.8b5d469f.js";import"./activeRecord.55a23e4a.js";import"./pubsub.e4395938.js";import"./index.f4ac7424.js";import"./Text.f4c0ef3e.js";import"./Form.6a4829ad.js";import"./url.8bddfe76.js";import"./index.aaa812ca.js";import"./index.663f575e.js";import"./index.366cf7e1.js";import"./index.8b3d4030.js";import"./index.55ff2de5.js";import"./index.fbff59b3.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]="acc30870-e20a-48ac-83a0-605239904717",a._sentryDebugIdIdentifier="sentry-dbid-acc30870-e20a-48ac-83a0-605239904717")}catch{}})();const Z=y({__name:"Tables",setup(a){const o=g(),t=k().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}})},u=C(()=>{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:[]}}),b=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(T(),_(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:u.value,fields:b,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{Z as default};
//# sourceMappingURL=Tables.8a297ab8.js.map
