import{C as _}from"./CrudView.f82e9dc8.js";import{o as l}from"./omniChatStore.4969ca65.js";import{a as k}from"./ant-design.985beb6c.js";import{a as C}from"./asyncComputed.2fb09f37.js";import{n as m}from"./string.f4728f35.js";import{G as T}from"./PhPencil.vue.2a1b4ce0.js";import{d as h,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,en as B}from"./jwt-decode.esm.9a8c48e0.js";import"./router.bdbe7e38.js";import{T as c}from"./tables.88c78a71.js";import{_ as j}from"./TablesTabs.vue_vue_type_script_setup_true_lang.bdd0d52d.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.1c57a8aa.js";import"./constants.4217f4ed.js";import"./url.143ffc6e.js";import"./PhDotsThreeVertical.vue.551c9cb1.js";import"./index.413cd7a4.js";import"./record.41081e53.js";import"./Card.ba30a3db.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]="d69a84d3-4b41-46f5-b9ca-3842f402f0f7",a._sentryDebugIdIdentifier="sentry-dbid-d69a84d3-4b41-46f5-b9ca-3842f402f0f7")}catch{}})();const Z=h({__name:"Tables",setup(a){const o=w(),t=I().params.projectId,{loading:f,result:b,refetch:s}=C(()=>c.list(t)),p=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=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 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(f),"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:p},null,8,["loading","table"])],64))}});export{Z as default};
//# sourceMappingURL=Tables.13ba0b20.js.map
