import{C as _}from"./CrudView.56ebce1a.js";import{o as l}from"./omniChatStore.13045a23.js";import{a as k}from"./ant-design.9bb31d85.js";import{a as C}from"./asyncComputed.06839806.js";import{a as m}from"./string.2f1abff3.js";import{G as T}from"./PhPencil.vue.aaf907d1.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 d,u as S,aR as v,o as A,ep as B}from"./jwt-decode.esm.bcf2db26.js";import"./router.e5052323.js";import{T as c}from"./tables.ecf1f359.js";import{_ as R}from"./TablesTabs.vue_vue_type_script_setup_true_lang.58bcff9a.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.4eb7d335.js";import"./constants.d30e64e7.js";import"./url.79c72bde.js";import"./PhDotsThreeVertical.vue.275748da.js";import"./index.15909af6.js";import"./record.6b6d4da9.js";import"./uuid.3f5b8acd.js";import"./PhCopySimple.vue.1c5a0760.js";import"./index.cf5ef754.js";import"./Card.0b4293e1.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="581caa2c-ad97-40b4-8e19-dfaa3511600a",t._sentryDebugIdIdentifier="sentry-dbid-581caa2c-ad97-40b4-8e19-dfaa3511600a")}catch{}})();const te=h({__name:"Tables",setup(t){const o=w(),a=I().params.projectId,{loading:p,result:b,refetch:s}=C(()=>c.list(a)),f=async e=>{const r=await c.create(a,e.name);o.push({name:"tableEditor",params:{tableId:r.id,projectId:a}})},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:a}}},{type:"actions",actions:[{icon:T,label:"Edit Table",onClick({key:i}){o.push({name:"tableEditor",params:{tableId:i,projectId:a}})}},{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(a,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(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{te as default};
//# sourceMappingURL=Tables.ad8c6f7a.js.map
