import{C as _}from"./CrudView.2286e2df.js";import{o as l}from"./omniChatStore.d50d5d5e.js";import{a as k}from"./ant-design.b10abef3.js";import{a as C}from"./asyncComputed.3d996402.js";import{a as m}from"./string.9f615d28.js";import{G as T}from"./PhPencil.vue.127e2625.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 d,u as S,aR as v,o as A,eo as B}from"./jwt-decode.esm.43a112d3.js";import"./router.663c6f19.js";import{T as c}from"./tables.e2c76137.js";import{_ as R}from"./TablesTabs.vue_vue_type_script_setup_true_lang.de0ea06f.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.66110338.js";import"./constants.c15d871e.js";import"./url.b9e6dfc2.js";import"./PhDotsThreeVertical.vue.b0448dae.js";import"./index.b0d2e208.js";import"./record.dfeaef8c.js";import"./uuid.002be344.js";import"./PhCopySimple.vue.50d54635.js";import"./index.919e954c.js";import"./Card.cf40b61c.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]="cae22e50-d00b-4177-bfd6-531e5f9eb137",a._sentryDebugIdIdentifier="sentry-dbid-cae22e50-d00b-4177-bfd6-531e5f9eb137")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:b,result:p,refetch:s}=C(()=>c.list(t)),f=async e=>{const r=await c.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=p.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,[d(R),d(_,{"entity-name":"table",loading:S(b),"docs-path":"tools/tables",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:f},null,8,["loading","table"])],64))}});export{ae as default};
//# sourceMappingURL=Tables.b83a36eb.js.map
