import{d as y,ez as g,eA as C,J as T,b as _,c as k,u as I}from"./outputWidgets.3f6d0550.js";import{e as w,q as h}from"./icons.51140278.js";import{a as x}from"./asyncComputed.bd80460e.js";import"./router.f2ffb037.js";import"./index.4a6147e4.js";import{T as s}from"./tables.db3bfca4.js";import{C as D}from"./CrudView.7764d20a.js";import{n as i}from"./string.75fd4786.js";import"./Title.d85134a2.js";import"./index.3719e3b6.js";import"./gateway.985e8615.js";import"./activeRecord.4331371e.js";import"./pubsub.0f07f3a4.js";import"./index.eb4bb603.js";import"./Form.7ff4c526.js";import"./url.980858d4.js";import"./index.6a58cd86.js";import"./index.9fce520b.js";import"./index.4614c424.js";import"./index.dee2e461.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]="e4bc6df2-048d-4b87-80fb-86019a397533",a._sentryDebugIdIdentifier="sentry-dbid-e4bc6df2-048d-4b87-80fb-86019a397533")}catch{}})();const W=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{W as default};
//# sourceMappingURL=Tables.3f0cf6b4.js.map
