import{C as _}from"./CrudView.4ab5ff38.js";import{o as l}from"./omniChatStore.11a1fa20.js";import{a as k}from"./ant-design.b6aa1f63.js";import{a as C}from"./asyncComputed.728c1605.js";import{n as m}from"./string.8136e838.js";import{G as h}from"./PhPencil.vue.af42f7c8.js";import{d as T,e4 as w,ec as I,c as x,k as E,ap as D,a4 as N,f as d,u as S,aQ as v,o as A,eh as B}from"./jwt-decode.esm.4aed0432.js";import"./router.8e8ef823.js";import{T as c}from"./tables.1494ceeb.js";import{_ as j}from"./TablesTabs.vue_vue_type_script_setup_true_lang.8933951b.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b5a50b94.js";import"./constants.6bea9d72.js";import"./url.b192466e.js";import"./PhDotsThreeVertical.vue.ee67ed4a.js";import"./index.58d4cba0.js";import"./record.c1a2f873.js";import"./Card.d2b6a792.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]="98621f4a-1798-46c0-be86-37b993d79d1b",a._sentryDebugIdIdentifier="sentry-dbid-98621f4a-1798-46c0-be86-37b993d79d1b")}catch{}})();const Z=T({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:b,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:h,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(j),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{Z as default};
//# sourceMappingURL=Tables.f8d2da38.js.map
