import{C as T}from"./CrudView.00070bd1.js";import{a as _}from"./asyncComputed.0723a843.js";import{n as i}from"./string.a1035618.js";import{G as k}from"./PhPencil.vue.a3f7e441.js";import{d as w,eq as h,ed as I,f as x,c as N,w as l,u as m,o as D,b as E,aF as S,bP as q,er as v}from"./vue-router.af270c71.js";import"./gateway.b1dc283d.js";import{T as c}from"./tables.cd566d4c.js";import{a as A}from"./ant-design.d04ab556.js";import"./router.637821ad.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.20cf0068.js";import"./BookOutlined.27f44505.js";import"./url.cabef638.js";import"./PhDotsThreeVertical.vue.332bc6e4.js";import"./Badge.febe68ac.js";import"./index.e2cc8758.js";import"./popupNotifcation.7284ddda.js";import"./record.489de623.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[a]="43c17c05-cef1-47f9-9f65-566282a53153",o._sentryDebugIdIdentifier="sentry-dbid-43c17c05-cef1-47f9-9f65-566282a53153")}catch{}})();const Y=w({__name:"Tables",setup(o){const a=h(),t=I().params.projectId,{loading:p,result:u,refetch:f}=_(()=>c.list(t)),b=async e=>{const r=await c.create(t,e.name);a.push({name:"tableEditor",params:{tableId:r.id,projectId:t}})},y=()=>{a.push({name:"sql",params:{projectId:t}})},g=x(()=>{var e,r;return{columns:[{name:"Table Name"},{name:"",align:"right"}],rows:(r=(e=u.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:k,label:"Edit Table",onClick({key:s}){a.push({name:"tableEditor",params:{tableId:s,projectId:t}})}},{icon:v,label:"Delete",dangerous:!0,async onClick(){!await A("Are you sure you want to delete this table and all its data?")||(await n.delete(t,n.id),f())}}]}]})))!=null?r:[]}}),C=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(D(),N(T,{"entity-name":"table",loading:m(p),"docs-path":"cloud/tables",title:"Tables",description:"Create and manage your database tables here.","empty-title":"No tables here yet",table:g.value,fields:C,"create-button-text":"Create Table",create:b},{more:l(()=>[E(m(q),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.84c1f305.js.map
