import{C as _}from"./CrudView.0f228026.js";import{o as l}from"./omniChatStore.a8530684.js";import{a as C}from"./ant-design.c0d40dc3.js";import{a as k}from"./asyncComputed.4c162cf6.js";import{n as m}from"./string.c8ef8ac4.js";import{G as T}from"./PhPencil.vue.892b2722.js";import{d as h,e3 as w,e4 as I,g as x,J as E,aj as D,K as N,b as c,u as S,aL as j,o as v,es as A}from"./index.46377be8.js";import"./gateway.646e2031.js";import{T as d}from"./columns.27731a38.js";import{_ as B}from"./TablesTabs.vue_vue_type_script_setup_true_lang.e107ab66.js";import"./router.8a1b10e4.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.810b22c2.js";import"./url.ad55f26c.js";import"./PhDotsThreeVertical.vue.04f47317.js";import"./Badge.257224a1.js";import"./index.25e0e95f.js";import"./index.253f97ae.js";import"./record.4c221458.js";import"./popupNotifcation.7b9f946e.js";import"./TabPane.e3e81391.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]="0f5c78e4-ef24-4a16-95e8-216950ea3f30",a._sentryDebugIdIdentifier="sentry-dbid-0f5c78e4-ef24-4a16-95e8-216950ea3f30")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:p,result:f,refetch:s}=k(()=>d.list(t)),b=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:A,label:"Delete",dangerous:!0,async onClick(){!await C("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)=>(v(),N(j,null,[c(B),c(_,{"entity-name":"table",loading:S(p),"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:b},null,8,["loading","table"])],64))}});export{ae as default};
//# sourceMappingURL=Tables.cf42c7db.js.map
