import{C as _}from"./CrudView.5ea4f8e5.js";import{o as l}from"./omniChatStore.51f8e32d.js";import{a as k}from"./ant-design.2cc25b54.js";import{a as C}from"./asyncComputed.f3fe22c0.js";import{a as m}from"./string.f661edcd.js";import{G as T}from"./PhPencil.vue.a29e7db1.js";import{d as h,e5 as w,ea as I,c as x,k as E,aq as D,a5 as N,f as d,u as S,aR as v,o as A,eo as B}from"./jwt-decode.esm.febfd28e.js";import"./router.f4c1fe8c.js";import{T as c}from"./tables.5938d0d9.js";import{_ as R}from"./TablesTabs.vue_vue_type_script_setup_true_lang.b6969f1d.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.70530128.js";import"./constants.48af5f1d.js";import"./url.092f6baf.js";import"./PhDotsThreeVertical.vue.7bdc070f.js";import"./index.0e1a642f.js";import"./record.a977dda7.js";import"./uuid.220f2065.js";import"./PhCopySimple.vue.54bfebb2.js";import"./index.ab72d4ab.js";import"./Card.ef0393b5.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]="aeef1242-7399-472f-bf57-63bbb1be9794",a._sentryDebugIdIdentifier="sentry-dbid-aeef1242-7399-472f-bf57-63bbb1be9794")}catch{}})();const ae=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:u,result:p,refetch:s}=C(()=>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: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,[d(R),d(_,{"entity-name":"table",loading:S(u),"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.3166b488.js.map
