import{d as y,eA as g,eB as C,G as T,b as _,c as k,u as I}from"./outputWidgets.90a37dfb.js";import{v as w,g as h}from"./icons.9cf35040.js";import{a as x}from"./asyncComputed.04259b99.js";import"./authorManager.f2a35532.js";import{T as i}from"./tables.4b26b5d6.js";import"./index.c6f2c2d2.js";import{C as D}from"./CrudView.19bb4bce.js";import{n as s}from"./string.d36be973.js";import"./record.ebb65067.js";import"./pubsub.4fea4be7.js";import"./gateway.6f30a6bf.js";import"./index.cf4c23b9.js";import"./Text.215ae4f0.js";import"./Title.b52522ff.js";import"./FormItem.4720b0a3.js";import"./hasIn.1e7661e3.js";import"./Form.f5b3db33.js";import"./Modal.265d309e.js";import"./router.e0403360.js";import"./index.9624bf8d.js";import"./url.c4b5264e.js";import"./index.85b56a97.js";import"./index.f4297c2c.js";import"./index.6d664715.js";import"./index.52c09cf5.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]="c7fe18dc-21da-41e7-b27d-1475ccdf8e59",a._sentryDebugIdIdentifier="sentry-dbid-c7fe18dc-21da-41e7-b27d-1475ccdf8e59")}catch{}})();const ee=y({__name:"Tables",setup(a){const o=g(),t=C().params.projectId,{loading:m,result:d,refetch:c}=x(()=>i.list(t)),p=async e=>{const r=await i.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},u=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:[]}}),b=[{key:"name",label:"Table name",type:"text",format:e=>s(e,!0),blur:e=>s(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:u.value,fields:b,"create-button-text":"Create Table",onCreate:p},null,8,["loading","table"]))}});export{ee as default};
//# sourceMappingURL=Tables.961e5eb1.js.map
