import{C as _}from"./CrudView.c16e2f81.js";import{o as l}from"./omniChatStore.3431c026.js";import{a as C}from"./ant-design.4952c8fb.js";import{a as k}from"./asyncComputed.25309626.js";import{a as m}from"./string.2ed1cde3.js";import{G as T}from"./PhPencil.vue.80ed4b2e.js";import{d as h,e5 as w,eb as I,c as x,J as E,aq as D,a5 as N,f as c,u as S,aR as v,o as A,eq as B}from"./jwt-decode.esm.7f2ef0df.js";import"./router.8fd5b2ad.js";import{T as d}from"./tables.be1c51f8.js";import{_ as R}from"./TablesTabs.vue_vue_type_script_setup_true_lang.63aa07d0.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.61381525.js";import"./constants.56e8988f.js";import"./url.8583a595.js";import"./PhDotsThreeVertical.vue.0ea03d82.js";import"./index.23283fbb.js";import"./record.4ffc477c.js";import"./uuid.dadede91.js";import"./PhCopySimple.vue.43c74ebe.js";import"./index.9021ba5d.js";import"./Card.1d1a9fb7.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]="038c04e3-a2c5-4d47-a2d3-4a41b3cc7563",a._sentryDebugIdIdentifier="sentry-dbid-038c04e3-a2c5-4d47-a2d3-4a41b3cc7563")}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:B,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)=>(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:f},null,8,["loading","table"])],64))}});export{ae as default};
//# sourceMappingURL=Tables.de30953b.js.map
