import{C as _}from"./CrudView.cdf2b3ec.js";import{o as l}from"./omniChatStore.dbe1dbde.js";import{a as C}from"./ant-design.c46171b2.js";import{a as k}from"./asyncComputed.883f99d7.js";import{n as m}from"./string.33cd155c.js";import{G as T}from"./PhPencil.vue.f45c727f.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,es as A}from"./index.a59ca186.js";import"./gateway.e14a87cc.js";import{T as c}from"./columns.5de4a954.js";import{_ as B}from"./TablesTabs.vue_vue_type_script_setup_true_lang.01edb56e.js";import"./router.179446c8.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.e785979a.js";import"./url.058cc2c6.js";import"./PhDotsThreeVertical.vue.b78f3770.js";import"./Badge.d0d1aeb3.js";import"./index.c0748d2f.js";import"./index.1cf59b43.js";import"./record.6981eb70.js";import"./popupNotifcation.55c3d770.js";import"./TabPane.a71b57bf.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="a090a348-f36f-4d81-aa2a-64a26be4ea08",t._sentryDebugIdIdentifier="sentry-dbid-a090a348-f36f-4d81-aa2a-64a26be4ea08")}catch{}})();const te=h({__name:"Tables",setup(t){const o=w(),a=I().params.projectId,{loading:p,result:b,refetch:s}=k(()=>c.list(a)),f=async e=>{const r=await c.create(a,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},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:a}}},{type:"actions",actions:[{icon:T,label:"Edit Table",onClick({key:i}){o.push({name:"tableEditor",params:{tableId:i,projectId:a}})}},{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(a,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(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:f},null,8,["loading","table"])],64))}});export{te as default};
//# sourceMappingURL=Tables.8e4adaaa.js.map
