import{C as _}from"./CrudView.4f2e069f.js";import{o as l}from"./omniChatStore.cbca1242.js";import{a as C}from"./ant-design.495703a7.js";import{a as k}from"./asyncComputed.9c066391.js";import{n as m}from"./string.c8a67ded.js";import{G as T}from"./PhPencil.vue.a4f06d6f.js";import{d as h,eH as w,e3 as I,g as x,J as E,aj as D,o as N,K as S,b as c,u as j,aL as v,eo as A}from"./index.56a4aa2e.js";import"./gateway.03a16684.js";import{T as d}from"./columns.1a209a57.js";import{_ as B}from"./TablesTabs.vue_vue_type_script_setup_true_lang.f0200cf1.js";import"./router.184d5b82.js";import"./Badge.19f199e3.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.a3da320f.js";import"./url.7ee1877f.js";import"./PhDotsThreeVertical.vue.12681250.js";import"./index.036fb779.js";import"./index.31820966.js";import"./record.1426f0e6.js";import"./popupNotifcation.2b90a8f1.js";import"./TabPane.f81b8fb1.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]="a784ce0c-fae6-4a01-a395-d2987504efb0",a._sentryDebugIdIdentifier="sentry-dbid-a784ce0c-fae6-4a01-a395-d2987504efb0")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:p,result:b,refetch:s}=k(()=>d.list(t)),f=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=b.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)=>(N(),S(v,null,[c(B),c(_,{"entity-name":"table",loading:j(p),"docs-path":"cloud/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.9c24eb63.js.map
