import{C as _}from"./CrudView.75d6f80a.js";import{o as l}from"./omniChatStore.6b2bc826.js";import{a as k}from"./ant-design.158d84ef.js";import{a as C}from"./asyncComputed.c4333d47.js";import{n as m}from"./string.dbe1a2f4.js";import{G as T}from"./PhPencil.vue.bc89e8c2.js";import{d as h,e5 as w,ea as I,c as x,k as E,aq as D,a5 as N,f as c,u as S,aR as v,o as A,eo as B}from"./jwt-decode.esm.c1356de1.js";import"./router.10a36819.js";import{T as d}from"./tables.356ea1ca.js";import{_ as R}from"./TablesTabs.vue_vue_type_script_setup_true_lang.beb27153.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e8f82a36.js";import"./constants.31a5b2c9.js";import"./url.99373f08.js";import"./PhDotsThreeVertical.vue.a655f2e4.js";import"./index.33815650.js";import"./record.6e317d8b.js";import"./index.70806805.js";import"./Card.9687d63b.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]="2424b2a8-f7bc-46ff-b095-ecb812869391",a._sentryDebugIdIdentifier="sentry-dbid-2424b2a8-f7bc-46ff-b095-ecb812869391")}catch{}})();const ee=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:b,result:f,refetch:s}=C(()=>d.list(t)),p=async e=>{const r=await d.create(t,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},y=x(()=>{var e,r;return{columns:[{title:"Table Name"},{title:"",align:"right"}],rows:(r=(e=f.value)==null?void 0:e.map(n=>({key:n.id,cells:[{type:"link",text:n.name,to:{name:"tableEditor",params:{tableId:n.id,projectId:t}}},{type:"actions",actions:[{icon:T,label:"Edit Table",onClick({key:i}){o.push({name:"tableEditor",params:{tableId:i,projectId:t}})}},{icon:B,label:"Delete",dangerous:!0,async onClick(){!await k("Are you sure you want to delete this table and all its data?")||(await n.delete(t,n.id),s())}}]}]})))!=null?r:[]}}),g=[{key:"name",label:"Table name",type:"text",format:e=>m(e,!0),blur:e=>m(e,!1)}];return E(()=>{const e=l.subscribe("tableCreated",()=>{s()});D(()=>{l.unsubscribe(e)})}),(e,r)=>(A(),N(v,null,[c(R),c(_,{"entity-name":"table",loading:S(b),"docs-path":"tools/tables/select",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:y.value,fields:g,"create-button-text":"Create Table",create:p},null,8,["loading","table"])],64))}});export{ee as default};
//# sourceMappingURL=Tables.4d628337.js.map
