import{C as T}from"./CrudView.f65519c2.js";import{a as _}from"./asyncComputed.d236b901.js";import{n as i}from"./string.92e45c6b.js";import{G as k}from"./PhPencil.vue.f600964f.js";import{d as w,eo as h,ea as I,f as x,o as N,c as D,w as l,u as d,b as E,aF as S,bP as v,ep as A}from"./vue-router.2dfeb709.js";import"./gateway.f21c3c00.js";import{T as m}from"./tables.843bcdcf.js";import{a as B}from"./ant-design.7ab15150.js";import"./router.dafb8c51.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.b5277234.js";import"./BookOutlined.25147a11.js";import"./url.052bc6c8.js";import"./PhDotsThreeVertical.vue.b5648f64.js";import"./Badge.4e64bc72.js";import"./index.5e221b09.js";import"./popupNotifcation.b6ed4c39.js";import"./record.a5650be1.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]="311a26f4-de3d-45d3-9d9b-ce83641bd653",o._sentryDebugIdIdentifier="sentry-dbid-311a26f4-de3d-45d3-9d9b-ce83641bd653")}catch{}})();const Y=w({__name:"Tables",setup(o){const a=h(),t=I().params.projectId,{loading:p,result:u,refetch:b}=_(()=>m.list(t)),f=async e=>{const r=await m.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:A,label:"Delete",dangerous:!0,async onClick(){!await B("Are you sure you want to delete this table and all its data?")||(await n.delete(t,n.id),b())}}]}]})))!=null?r:[]}}),C=[{key:"name",label:"Table name",type:"text",format:e=>i(e,!0),blur:e=>i(e,!1)}];return(e,r)=>(N(),D(T,{"entity-name":"table",loading:d(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:f},{more:l(()=>[E(d(v),{onClick:y},{default:l(()=>[S("Run SQL")]),_:1})]),_:1},8,["loading","table"]))}});export{Y as default};
//# sourceMappingURL=Tables.1f02db94.js.map
