import{C as y}from"./CrudView-wZnp03a2.js";import{o as s}from"./omniChatStore-Bi-5MYwj.js";import{a as g}from"./ant-design-12Ybi1Rk.js";import{a as _}from"./asyncComputed-IJY6wgme.js";import{n as i}from"./string-BYR4BIXr.js";import{G as C}from"./PhPencil.vue-DCNvh_hA.js";import{d as k,T,S as h,e as w,X as I,am as x,l as D,m as E,g as l,D as N,F as S,an as v}from"./jwt-decode.esm-Dca5fHH5.js";import"./router-D5wfdag3.js";import{T as m}from"./tables-BsqTY_wE.js";import{_ as A}from"./TablesTabs.vue_vue_type_script_setup_true_lang-BOH5jv3X.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-BnwqPwfA.js";import"./constants-B1LrRAnj.js";import"./url-CoyBb3Dp.js";import"./PhDotsThreeVertical.vue-B1x6I4wD.js";import"./index-ZQBk4l6i.js";import"./record-BZIfMWML.js";import"./uuid-CK8Ke_G7.js";import"./PhCopySimple.vue-C9uB_c9T.js";import"./index-Cyx2lZTa.js";import"./index-mvr8okoq.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]="9d1a75b2-d4a7-4a73-8ed0-a8c620e2aded",a._sentryDebugIdIdentifier="sentry-dbid-9d1a75b2-d4a7-4a73-8ed0-a8c620e2aded")}catch{}})();const ee=k({__name:"Tables",setup(a){const o=T(),t=h().params.projectId,{loading:c,result:u,refetch:n}=_(()=>m.list(t)),p=async e=>{const r=await m.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},b=w(()=>({columns:[{title:"Table Name"},{title:"",align:"right"}],rows:u.value?.map(e=>({key:e.id,cells:[{type:"link",text:e.name,to:{name:"tableEditor",params:{tableId:e.id,projectId:t}}},{type:"actions",actions:[{icon:C,label:"Edit Table",onClick({key:r}){o.push({name:"tableEditor",params:{tableId:r,projectId:t}})}},{icon:v,label:"Delete",dangerous:!0,async onClick(){await g("Are you sure you want to delete this table and all its data?")&&(await e.delete(t,e.id),n())}}]}]}))??[]})),f=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return I(()=>{const e=s.subscribe("tableCreated",()=>{n()});x(()=>{s.unsubscribe(e)})}),(e,r)=>(E(),D(S,null,[l(A),l(y,{"entity-name":"table",loading:N(c),"docs-path":"tools/tables",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:b.value,fields:f,"create-button-text":"Create Table",create:p},null,8,["loading","table"])],64))}});export{ee as default};
//# sourceMappingURL=Tables-CX1wUv59.js.map
