import{C as _}from"./CrudView.178ed8b6.js";import{o as l}from"./omniChatStore.5c421f6e.js";import{a as k}from"./ant-design.dcc4114a.js";import{a as C}from"./asyncComputed.15a1493f.js";import{a as m}from"./string.c6b418fe.js";import{G as T}from"./PhPencil.vue.8eeff64f.js";import{d as h,e5 as w,eb as I,c as x,k as E,aq as D,a5 as N,f as c,u as S,aR as v,o as A,ep as B}from"./jwt-decode.esm.95147216.js";import"./router.09c25b35.js";import{T as d}from"./tables.7fcaf771.js";import{_ as R}from"./TablesTabs.vue_vue_type_script_setup_true_lang.43b35389.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.bfb97102.js";import"./constants.5f7db9f7.js";import"./url.8c481a5a.js";import"./PhDotsThreeVertical.vue.3f13d85f.js";import"./index.b1615145.js";import"./record.44df96f2.js";import"./uuid.36c0f5f6.js";import"./PhCopySimple.vue.0dac09a8.js";import"./index.574c12ce.js";import"./Card.6c9b2903.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]="5010c293-0576-4f42-9084-118546f26769",a._sentryDebugIdIdentifier="sentry-dbid-5010c293-0576-4f42-9084-118546f26769")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:p,result:f,refetch:s}=C(()=>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:B,label:"Delete",dangerous:!0,async onClick(){!await k("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)=>(A(),N(v,null,[c(R),c(_,{"entity-name":"table",loading:S(p),"docs-path":"tools/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:b},null,8,["loading","table"])],64))}});export{ae as default};
//# sourceMappingURL=Tables.b86fdb7f.js.map
