import{C as _}from"./CrudView.28de36c2.js";import{o as l}from"./omniChatStore.3a22804a.js";import{a as C}from"./ant-design.1677616b.js";import{a as k}from"./asyncComputed.3313bf29.js";import{n as m}from"./string.be4a54d7.js";import{G as T}from"./PhPencil.vue.12e29d78.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 d,u as j,aL as v,eo as A}from"./index.f15cb536.js";import"./gateway.ee243f16.js";import{T as c}from"./columns.a76809c0.js";import{_ as B}from"./TablesTabs.vue_vue_type_script_setup_true_lang.55d5f3c4.js";import"./router.8f01412f.js";import"./Badge.55963c6c.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.08ad244b.js";import"./url.005bba68.js";import"./PhDotsThreeVertical.vue.b75560a4.js";import"./index.c9844082.js";import"./index.fe0be999.js";import"./record.88d9d564.js";import"./popupNotifcation.8270aa41.js";import"./TabPane.b1f788aa.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]="ebd4a4a7-1210-4742-8244-753b01215737",a._sentryDebugIdIdentifier="sentry-dbid-ebd4a4a7-1210-4742-8244-753b01215737")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:p,result:b,refetch:s}=k(()=>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=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,[d(B),d(_,{"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.dda41b9f.js.map
