import{d as y,eA as g,eB as k,G as C,b as T,c as _,u as I}from"./outputWidgets.f8f8676d.js";import{e as w,k as h}from"./icons.c3170cf4.js";import{a as x}from"./asyncComputed.9c91cdf6.js";import"./router.b4a342b4.js";import"./columns.dbb1c1df.js";import{T as s}from"./tables.d19838f3.js";import{C as D}from"./CrudView.fe3c74bf.js";import{n as i}from"./string.1a713e18.js";import"./Form.2b1bb5d1.js";import"./Title.53d37289.js";import"./transButton.ca7603a2.js";import"./Text.7ab5366c.js";import"./index.878fa14a.js";import"./gateway.209624eb.js";import"./activeRecord.913921b5.js";import"./pubsub.8eddc628.js";import"./index.cf4c23b9.js";import"./url.46c79102.js";import"./index.4c4e9bdd.js";import"./index.97771f01.js";import"./index.2ab0079e.js";import"./index.e041bc2d.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]="b4e9db95-6111-402e-b596-ed6948aee83e",a._sentryDebugIdIdentifier="sentry-dbid-b4e9db95-6111-402e-b596-ed6948aee83e")}catch{}})();const Y=y({__name:"Tables",setup(a){const o=g(),t=k().params.projectId,{loading:m,result:d,refetch:p}=x(()=>s.list(t)),c=async e=>{const r=await s.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},b=C(()=>{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),p()}}]}]})))!=null?r:[]}}),u=[{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:b.value,fields:u,"create-button-text":"Create Table",onCreate:c},null,8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.db6deef1.js.map
