import{C as _}from"./CrudView.f8c62bd5.js";import{o as l}from"./omniChatStore.755c548d.js";import{a as C}from"./ant-design.e632b777.js";import{a as k}from"./asyncComputed.6b1d4165.js";import{n as m}from"./string.a01d17aa.js";import{G as T}from"./PhPencil.vue.001dc101.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 d,u as S,aL as j,o as v,ep as A}from"./index.e310aebb.js";import"./gateway.4d0dc75b.js";import{T as c}from"./columns.b1346706.js";import{_ as B}from"./TablesTabs.vue_vue_type_script_setup_true_lang.7d1be8e5.js";import"./router.2399bbbf.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.d13fff5d.js";import"./url.fb968ca0.js";import"./PhDotsThreeVertical.vue.86ea10eb.js";import"./Badge.a954551a.js";import"./index.3d882fa8.js";import"./index.850d1dd3.js";import"./record.d2935dfa.js";import"./popupNotifcation.fa3e65fc.js";import"./TabPane.9d204c54.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]="36e878be-6244-4ca2-bc80-ed6b8f6809d7",a._sentryDebugIdIdentifier="sentry-dbid-36e878be-6244-4ca2-bc80-ed6b8f6809d7")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:b,result:p,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=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: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,[d(B),d(_,{"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:f},null,8,["loading","table"])],64))}});export{ae as default};
//# sourceMappingURL=Tables.e15299e2.js.map
